Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Use of SUBMIT statement for program RSWILOAD of Tcode SWI5

percy_686
Explorer
0 Kudos
498

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.
1 ACCEPTED SOLUTION

jmodaal
Active Contributor
0 Kudos
408

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

5 REPLIES 5

jmodaal
Active Contributor
408

Hello,

have a look at this thread, where a better approach for catching the ALV list is shown.

Kind regards

Jan

Sandra_Rossi
Active Contributor
408

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!

percy_686
Explorer
0 Kudos
408

@ 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.

jmodaal
Active Contributor
0 Kudos
409

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

0 Kudos
408

Hi Jan,

I debugged RSWIDONE and part of it's code is useful for my requirement.
Thank you. 🙂

Regards,

Prasabap