How to write the code to make hierarchical ALV? You must use REUSE_ALV_HIERSEQ_LIST_DISPLAY function. Sample code for output: *&---------------------------------------------------------------------* *& Form output *&---------------------------------------------------------------------* FORM output. * menge_muh LIKE ekbe-menge, CLEAR gs_fcat. gs_fcat-fieldname = 'XBLNR_MUH'. gs_fcat-tabname = 'ITAB_MUH'. gs_fcat-col_pos = 1. gs_fcat-outputlen = 18. gs_fcat-seltext_s = 'Ýrsaliye No'. APPEND gs_fcat TO gt_fcat. CLEAR gs_fcat. gs_fcat-fieldname = 'MENGE_MUH'. gs_fcat-tabname = 'ITAB_MUH'. gs_fcat-col_pos = 2. gs_fcat-outputlen = 18. gs_fcat-seltext_s = 'Miktar'. APPEND gs_fcat TO gt_fcat. * dmbtr_muh LIKE ekbe-dmbtr, CLEAR gs_fcat. gs_fcat-fieldname = 'DMBTR_MUH'. gs_fcat-tabname = 'ITAB_MUH'. gs_fcat-col_pos = 3. gs_fcat-outputlen = 18. gs_fcat-seltext_s = 'Tutar'. APPEND gs_fcat TO gt_fcat. * waers_muh LIKE ekbe-waers, CLEAR gs_fcat. gs_fcat-fieldname = 'WAERS_MUH'. gs_fcat-tabname = 'ITAB_MUH'. gs_fcat-col_pos = 4. gs_fcat-outputlen = 12. gs_fcat-seltext_s = 'Para Birimi'. APPEND gs_fcat TO gt_fcat. * matnr_muh LIKE ekbe-matnr, CLEAR gs_fcat. gs_fcat-fieldname = 'MATNR_MUH'. gs_fcat-tabname = 'ITAB_MUH'. gs_fcat-col_pos = 5. gs_fcat-outputlen = 10. gs_fcat-seltext_s = 'Malzeme No'. APPEND gs_fcat TO gt_fcat. * ernam_muh LIKE ekbe-ernam, CLEAR gs_fcat. gs_fcat-fieldname = 'ERNAM_MUH'. gs_fcat-tabname = 'ITAB_MUH'. gs_fcat-col_pos = 6. gs_fcat-outputlen = 16. gs_fcat-seltext_s = 'Yaratan'. APPEND gs_fcat TO gt_fcat. ********itab_zgi***************** * ebeln LIKE ekbe-ebeln, CLEAR gs_fcat. gs_fcat-fieldname = 'EBELN'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 1. gs_fcat-outputlen = 20. gs_fcat-seltext_s = 'Sipariþ'. APPEND gs_fcat TO gt_fcat. * ebelp LIKE ekbe-ebelp, CLEAR gs_fcat. gs_fcat-fieldname = 'EBELP'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 2. gs_fcat-outputlen = 5. gs_fcat-seltext_s = 'Kalem'. APPEND gs_fcat TO gt_fcat. * vgabe like ekbe-vgabe, CLEAR gs_fcat. gs_fcat-fieldname = 'VGABE'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-no_out = 'X'. APPEND gs_fcat TO gt_fcat. * gjahr LIKE ekbe-gjahr, CLEAR gs_fcat. gs_fcat-fieldname = 'GJAHR'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-no_out = 'X'. APPEND gs_fcat TO gt_fcat. * bewtp LIKE ekbe-bewtp, CLEAR gs_fcat. gs_fcat-fieldname = 'BEWTP'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-no_out = 'X'. APPEND gs_fcat TO gt_fcat. * bwart LIKE ekbe-bwart, CLEAR gs_fcat. gs_fcat-fieldname = 'BWART'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-no_out = 'X'. APPEND gs_fcat TO gt_fcat. * budat LIKE ekbe-budat, CLEAR gs_fcat. gs_fcat-fieldname = 'BUDAT'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-no_out = 'X'. APPEND gs_fcat TO gt_fcat. * menge LIKE ekbe-menge, CLEAR gs_fcat. gs_fcat-fieldname = 'MENGE'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 3. gs_fcat-outputlen = 18. gs_fcat-seltext_s = 'Miktar'. APPEND gs_fcat TO gt_fcat. * dmbtr LIKE ekbe-dmbtr, CLEAR gs_fcat. gs_fcat-fieldname = 'DMBTR'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 4. gs_fcat-outputlen = 18. gs_fcat-seltext_s = 'Tutar'. APPEND gs_fcat TO gt_fcat. * waers LIKE ekbe-waers, CLEAR gs_fcat. gs_fcat-fieldname = 'WAERS'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 5. gs_fcat-outputlen = 12. gs_fcat-seltext_s = 'Para Birimi'. APPEND gs_fcat TO gt_fcat. * xblnr LIKE ekbe-xblnr, * matnr LIKE ekbe-matnr, CLEAR gs_fcat. gs_fcat-fieldname = 'MATNR'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 6. gs_fcat-outputlen = 10. gs_fcat-seltext_s = 'Malzeme No'. APPEND gs_fcat TO gt_fcat. CLEAR gs_fcat. gs_fcat-fieldname = 'MAKTX'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 7. gs_fcat-outputlen = 40. gs_fcat-seltext_s = 'Malzeme Taným'. APPEND gs_fcat TO gt_fcat. * ernam LIKE ekbe-ernam, CLEAR gs_fcat. gs_fcat-fieldname = 'ERNAM'. gs_fcat-tabname = 'ITAB_ZGI'. gs_fcat-col_pos = 8. gs_fcat-outputlen = 16. gs_fcat-seltext_s = 'Yaratan'. APPEND gs_fcat TO gt_fcat. gs_layout-expand_fieldname = 'EXPAND'. gs_keyinfo-header01 = 'XBLNR_MUH'. gs_keyinfo-item01 = 'XBLNR'. CLEAR gt_events. gs_event-name = 'TOP_OF_PAGE'. gs_event-form = 'TOP_OF_PAGE'. APPEND gs_event TO gt_events. CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' EXPORTING i_callback_program = gv_program_name is_layout = gs_layout it_fieldcat = gt_fcat i_tabname_header = 'ITAB_MUH' i_tabname_item = 'ITAB_ZGI' is_keyinfo = gs_keyinfo i_save = 'X' it_events = gt_events TABLES t_outtab_header = itab_muh t_outtab_item = itab_zgi EXCEPTIONS program_error = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. " output Read Also
ABAP Books List
Smart Forms
ABAP Menu:
Return to Index:-
(c) www.gotothings.com All material on this site is Copyright.
|