Skip to Content
0
Dec 12, 2022 at 02:04 PM

Use of SUBMIT statement for program RSWILOAD of Tcode SWI5

90 Views Last edit Dec 13, 2022 at 05:12 AM 2 rev

Hello Experts,
Requirement is to get the 'Work Load Analysis' for multiple Agent Ids in ALV format. So I used the SUBMIT statement with program of Tcode SWI5 in loop for multiple Agent Ids.
Problems are 1. After execution of submit statement output of SWI5 is displayed, which is not required.
2. FM 'LIST FROM MEMORY' is not returning any value in tt_list_tab.
Kindly guide.


Code: -


DATA tt_list_tab TYPE TABLE OF abaplist,
tt_list_final TYPE TABLE OF abaplist.
SELECT-OPTIONS : s_objid FOR swhactor-objid NO INTERVALS,
s_date FOR sy-datum.
PARAMETERS: p_taskid TYPE swwwihead-wi_rh_task.
LOOP AT s_objid.
SUBMIT RSWILOAD WITH otype = 'US' WITH objid = s_objid-low with SELDATUM = '20201120'
WITH wi_rh_task = p_taskid AND RETURN EXPORTING LIST TO MEMORY.
IF sy-subrc = 0.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = tt_list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
APPEND LINES OF tt_list_tab TO tt_list_final.
CLEAR tt_list_tab.
ENDIF.
ENDIF.
ENDLOOP.
IF tt_list_final IS NOT INITIAL .
call function 'WRITE_LIST'
tables
listobject = tt_list_final
exceptions
empty_list = 1
others = 2.
* DELETE tt_list_final WHERE date NOT IN s_date.
TRY.
CALL METHOD cl_salv_table=>factory "get SALV factory instance
IMPORTING
r_salv_table = lr_alv
CHANGING
t_table = tt_list_final. "lt_swwwihead.
CATCH cx_salv_msg .
ENDTRY.
lr_func = lr_alv->get_functions( ).
lr_func->set_all( abap_true ).
lr_alv->display( ). "display grid
ENDIF.