REPORT ZALV_WITH_FCAT_MERGE. TYPE-POOLS SLIS . DATA : BEGIN OF I_MARA OCCURS 0, MATNR LIKE MARA-MATNR, MTART LIKE MARA-MTART, MBRSH LIKE MARA-MBRSH, MEINS LIKE MARA-MEINS, END OF I_MARA. DATA : I_FCAT TYPE SLIS_T_FIELDCAT_ALV . DATA : WA_FCAT LIKE LINE OF I_FCAT . START-OF-SELECTION . PERFORM GET_DATA . * PERFORM CREATE_FCAT. PERFORM CREATE_FCAT_MERGE . END-OF-SELECTION . PERFORM DISP_ALV . FORM GET_DATA . SELECT * FROM MARA INTO CORRESPONDING FIELDS OF TABLE I_MARA . ENDFORM. " GET_DATA FORM DISP_ALV . CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING I_CALLBACK_PROGRAM = SY-REPID IT_FIELDCAT = I_FCAT TABLES T_OUTTAB = I_MARA. ENDFORM. " DISP_ALV FORM CREATE_FCAT . WA_FCAT-COL_POS = '1' . WA_FCAT-FIELDNAME = 'MATNR' . WA_FCAT-TABNAME = 'I_MARA' . WA_FCAT-SELTEXT_M = 'MATERIALNO' . WA_FCAT-KEY = 'X' . APPEND WA_FCAT TO I_FCAT . CLEAR WA_FCAT . WA_FCAT-COL_POS = '2' . WA_FCAT-FIELDNAME = 'MTART' . WA_FCAT-TABNAME = 'I_MARA' . WA_FCAT-SELTEXT_M = 'MATERIALTYPE' . * WA_FCAT-NO_OUT = 'X' . WA_FCAT-HOTSPOT = 'X' . APPEND WA_FCAT TO I_FCAT . CLEAR WA_FCAT . WA_FCAT-COL_POS = '3' . WA_FCAT-FIELDNAME = 'MBRSH' . WA_FCAT-REF_FIELDNAME = 'MBRSH' . WA_FCAT-REF_TABNAME = 'MARA' . * WA_FCAT-TABNAME = 'I_MARA' . * WA_FCAT-SELTEXT_M = 'INDSECTOR' . * WA_FCAT-EDIT = 'X' . APPEND WA_FCAT TO I_FCAT . CLEAR WA_FCAT . WA_FCAT-COL_POS = '4' . WA_FCAT-FIELDNAME = 'MEINS' . WA_FCAT-TABNAME = 'I_MARA' . WA_FCAT-SELTEXT_M = 'MAT.UNITS' . WA_FCAT-EMPHASIZE = 'C610'. APPEND WA_FCAT TO I_FCAT . CLEAR WA_FCAT . ENDFORM. " CREATE_FCAT FORM CREATE_FCAT_MERGE . CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE' EXPORTING I_PROGRAM_NAME = SY-REPID I_INTERNAL_TABNAME = 'I_MARA' I_INCLNAME = SY-REPID CHANGING CT_FIELDCAT = I_FCAT. ********************MODIFYING AUTOMATIC FILEDCATOG LOOP AT I_FCAT INTO WA_FCAT. IF WA_FCAT-FIELDNAME = 'MBRSH' . WA_FCAT-NO_OUT = 'X' . ENDIF . MODIFY I_FCAT FROM WA_FCAT INDEX SY-TABIX . ENDLOOP. ENDFORM. " CREATE_FCAT_MERGE
Serkan AKKAVAK Bilgisayar Mühendisi serkurumsal@yandex.com
Social Plugin