2022 Dec 12 2:04 PM
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.
2022 Dec 13 10:10 AM
Hello percy_686,
I had a look into RSWILOAD, and actually the program forwards the work to reports RSWIWORK resp. RSWIDONE - without 'EXPORTING LIST TO MEMORY', therefore in any case a list will be displayed and not put into memory.
So, I see no chance for your approach to catch the list of RSWILOAD. Maybe you can use RSWIWORK resp. RSWIDONE, or you should look for suitable function modules / classes, methods.
Kind regards
Jan
2022 Dec 12 2:27 PM
Hello,
have a look at this thread, where a better approach for catching the ALV list is shown.
Kind regards
Jan
2022 Dec 12 4:32 PM
Also, please edit your question, select your code and press the button [CODE], which makes the code appear colored/indented, it will be easier for people to look at it. Thank you!
2022 Dec 13 6:02 AM
@ Jan Modaal ,
Thank you for the reply. The better approach for ALV list is given.
As mentioned in the question ,
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.
are not solved.
2022 Dec 13 10:10 AM
Hello percy_686,
I had a look into RSWILOAD, and actually the program forwards the work to reports RSWIWORK resp. RSWIDONE - without 'EXPORTING LIST TO MEMORY', therefore in any case a list will be displayed and not put into memory.
So, I see no chance for your approach to catch the list of RSWILOAD. Maybe you can use RSWIWORK resp. RSWIDONE, or you should look for suitable function modules / classes, methods.
Kind regards
Jan
2022 Dec 13 5:22 PM
Hi Jan,
I debugged RSWIDONE and part of it's code is useful for my requirement.
Thank you. 🙂
Regards,
Prasabap