*----------------------------------------------------------------------* * DECLARATIONS * *----------------------------------------------------------------------* DATA: BEGIN OF gt_header OCCURS 0, bukrs LIKE BKPF-BUKRS, butxt LIKE T001-BUTXT, gjahr LIKE BKPF-GJAHR, [...] expand TYPE C, END OF gt_header. DATA: BEGIN OF gt_items OCCURS 0, bukrs LIKE BSEG-BUKRS, belnr LIKE BSEG-BELNR, gjahr LIKE BSEG-GJAHR, [...] END OF gt_items. DATA: gs_header LIKE LINE OF gt_header, gs_items LIKE LINE OF gt_items. TYPE-POOLS SLIS. DATA: gt_fieldcat TYPE SLIS_T_FIELDCAT_ALV, gs_fieldcat TYPE SLIS_FIELDCAT_ALV, gs_layout TYPE SLIS_LAYOUT_ALV, gs_key TYPE SLIS_KEYINFO_ALV. *----------------------------------------------------------------------* * FORM OUTPUT_ALV * *----------------------------------------------------------------------* FORM output_alv. PERFORM fieldcat_list. PERFORM fieldcat_mod. PERFORM layout_list. PERFORM key_list. PERFORM display_list. ENDFORM. "output_alv *----------------------------------------------------------------------* * FORM FIELDCAT_LIST * *----------------------------------------------------------------------* FORM fieldcat_list. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING I_PROGRAM_NAME = SY-CPROG I_INTERNAL_TABNAME = 'GT_HEADER' I_INCLNAME = SY-CPROG CHANGING CT_FIELDCAT = gt_fieldcat EXCEPTIONS INCONSISTENT_INTERFACE = 1 PROGRAM_ERROR = 2 OTHERS = 3. CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING I_PROGRAM_NAME = SY-CPROG I_INTERNAL_TABNAME = 'GT_ITEMS' I_INCLNAME = SY-CPROG CHANGING CT_FIELDCAT = gt_fieldcat EXCEPTIONS INCONSISTENT_INTERFACE = 1 PROGRAM_ERROR = 2 OTHERS = 3. ENDFORM. "fieldcat_list *----------------------------------------------------------------------* * FORM FIELDCAT_MOD * *----------------------------------------------------------------------* FORM fieldcat_mod. CLEAR gs_fieldcat. gs_fieldcat-no_out = 'X'. MODIFY gt_fieldcat FROM gs_fieldcat TRANSPORTING no_out WHERE fieldname = 'EXPAND'. ENDFORM. "fieldcat_mod *----------------------------------------------------------------------* * FORM LAYOUT_LIST * *----------------------------------------------------------------------* FORM layout_list. gs_layout-window_titlebar = 'ALV: Libro Giornale'(A01). gs_layout-colwidth_optimize = 'X'. gs_layout-expand_fieldname = 'EXPAND'. gs_layout-lights_tabname = 'GT_ITEMS'. ENDFORM. "layout_list *----------------------------------------------------------------------* * FORM KEY_LIST * *----------------------------------------------------------------------* FORM key_list. gs_key-header01 = 'BUKRS'. gs_key-item01 = 'BUKRS'. gs_key-header02 = 'BELNR'. gs_key-item02 = 'BELNR'. gs_key-header03 = 'GJAHR'. gs_key-item03 = 'GJAHR'. ENDFORM. "key_list *----------------------------------------------------------------------* * FORM DISPLAY_LIST * *----------------------------------------------------------------------* FORM display_list. CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = SY-CPROG IS_LAYOUT = gs_layout IT_FIELDCAT = gt_fieldcat I_TABNAME_HEADER = 'GT_HEADER' I_TABNAME_ITEM = 'GT_ITEMS' IS_KEYINFO = gs_key TABLES T_OUTTAB_HEADER = gt_header T_OUTTAB_ITEM = gt_items EXCEPTIONS PROGRAM_ERROR = 1 OTHERS = 2. ENDFORM. "display_list
giovedì 28 maggio 2015
ALV gerarchica
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento