Loading
To display the alv using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' FM
To display the alv in a different manner we have to pass some additional parameters.
For the header as in the output maintain a separate internal table it_final_hdr.
To get the code click on below link :
BEGIN OF t_final_hdr,
vkorg TYPE vbak-vkorg,
vname TYPE tvkot-vtext(tvkot),
kunnr TYPE vbak-kunnr,
kname TYPE kna1-name1,
expand,
END OF t_final_hdr,
i_final_hdr TYPE TABLE OF t_final_hdr.
I_final is the final table.
w_fcat-fieldname = 'VNAME'.
w_fcat-outputlen = '25'.
w_fcat-seltext_m = 'Sales Organisation'(002).
w_fcat-tabname = 'I_FINAL_HDR'.
APPEND w_fcat TO fcat.
CLEAR w_fcat .
w_fcat-fieldname = 'KNAME'.
w_fcat-outputlen = '25'.
w_fcat-seltext_m = ‘BUYER.
w_fcat-tabname = 'I_FINAL_HDR'.
APPEND w_fcat TO fcat.
CLEAR w_fcat .
gs_layout-expand_fieldname = 'EXPAND'.
gs_layout-expand_all = 'X'.
gs_layout-subtotals_text = text-018.
After that built the catalog for the fields for final table.
LOOP AT i_final INTO w_final.
w_final_hdr-kunnr = w_final-kunnr.
w_final_hdr-vkorg = w_final-vkorg.
CLEAR: w_kna1, w_vkorg.
READ TABLE i_kna1 INTO w_kna1 WITH KEY kunnr = w_final-kunnr.
w_final_hdr-kname = w_kna1-name1.
READ TABLE i_vkorg INTO w_vkorg WITH KEY vkorg = w_final-vkorg.
w_final_hdr-vname = w_vkorg-vtext.
APPEND w_final_hdr TO i_final_hdr.
ENDLOOP.
FORM key_info.
gs_key-header01 = 'VKORG'.
gs_key-item01 = 'VKORG'.
gs_key-header02 = 'KUNNR'.
gs_key-item02 = 'KUNNR'.
ENDFORM.
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
i_callback_program = v_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
is_layout = gs_layout
it_fieldcat = fcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = it_sort
* IT_FILTER =
* IS_SEL_HIDE =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
i_default = 'X'
i_save = 'X'
* IS_VARIANT =
it_events = fevents[]
* IT_EVENT_EXIT =
i_tabname_header = 'I_FINAL_HDR'
i_tabname_item = 'I_FINAL'
* I_STRUCTURE_NAME_HEADER =
* I_STRUCTURE_NAME_ITEM =
is_keyinfo = gs_key
* IS_PRINT =
* IS_REPREP_ID =
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* IR_SALV_HIERSEQ_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab_header = i_final_hdr
t_outtab_item = i_final
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.
This entry was posted on Wednesday, September 21, 2011 at 6:50 AM. You can follow any responses to this entry through the RSS 2.0. You can leave a response.
- No comments yet.