on ‎2020 Nov 02 8:18 AM
Hi,
Can we call Report program in parallel Processing?
if anyone has solution , please share.
i have to call zwf_workprocess_test report in parallel processing, right now called inside loop.
Thanks
Vikash
REPORT zwf_parallel_test.
Do 10 Times.
SUBMIT zwf_workprocess_test WITH p_text = lv_string AND RETURN.
ENDDO.
Request clarification before answering.
Hello vikash.pathak
Sure you can. One way is to wrap it in an RFC function module and call this module in parallel. There are example on the web.
https://blogs.sap.com/2012/08/20/parallel-processing-example-code/
Kind regards,You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mateuszadamus
Thanks for your suggestion, i created a RFC and submit report statement i have written inside FM ( SUBMIT zwf_workprocess_test WITH p_text = im_run AND RETURN. )
and below code i have written in my ABAP report program, but the DO ENDO is being called around 50 times which is taking long time in execution and as many time DO will iterate That many time FM will be called , my requirement is that FM should be called only 10 times ,
like Do should be called 1 or 2 time and FM should be called in different work processes , if DO execute 2 time so FM should be split in 5 work process in each iteration . which is not happening for now.
Please suggest.
CALL FUNCTION 'SPBT_INITIALIZE'
EXPORTING
group_name = gv_group
IMPORTING
max_pbt_wps = lv_max
free_pbt_wps = lv_free
EXCEPTIONS
invalid_group_name = 1
internal_error = 2
pbt_env_already_initialized = 3
currently_no_resources_avail = 4
no_pbt_resources_found = 5
cant_init_different_pbt_groups = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF sy-subrc = 0.
* Split the data to be processed into no of work processes.
lv_occupied = lv_max - lv_free.
* Calculate the difference in percentage
lv_diff = ( lv_free * 100 ) / lv_max.
* Based on the available no of workprocess split the data
IF lv_diff <= 25.
lv_split = lv_free DIV 2.
ELSEIF lv_diff BETWEEN 25 AND 50.
lv_split = lv_free * 2 DIV 3.
ELSEIF lv_diff >= 50.
lv_split = lv_free * 3 DIV 4.
ENDIF.
ENDIF.
lv_lines = 5000.
lv_lines_tab = lv_lines / lv_split.
DO 10 TIMES. "lv_split TIMES.
lv_index = sy-index.
CONCATENATE 'task' lv_index INTO lv_task.
lv_start = lv_start + lv_lines_tab.
lv_end = lv_lines_tab + 1.
IF lv_index = 1.
lv_start = 0.
ENDIF.
IF lv_split = lv_index.
lv_end = 0.
ENDIF.
* DO 10 TIMES.
lv_count = lv_count + 1.
lv_string = |Run| && lv_count && || .
CALL FUNCTION 'ZWF_PARALLEL_CALL'
STARTING NEW TASK lv_task
DESTINATION IN GROUP gv_group
PERFORMING f_callback ON END OF TASK
EXPORTING
im_run = lv_string
.
IF sy-subrc = 0.
lv_sent = lv_sent + 1.
ENDIF.
WAIT UNTIL lv_comp >= lv_sent.
WRITE : / 'The no of packets sent' , lv_sent,
'The no of packets completed', lv_comp.
ENDDO.
*ENDDO.
FORM f_callback USING lv_task .
DATA lv_done TYPE flag.
lv_comp = lv_comp + 1.
RECEIVE RESULTS FROM FUNCTION 'ZWF_PARALLEL_CALL'
IMPORTING
ex_done = lv_done.
IF lv_done EQ abap_true.
lv_result_string = 'Success'.
ELSE.
lv_result_string = 'Failure'.
ENDIF.
CONCATENATE 'The data passed via task' lv_task 'updation is' lv_result_string INTO lv_result_string SEPARATED BY space.
WRITE : / lv_result_string.
ENDFORM.
Hi vikash.pathak
You should not hardcode the number of DO loops. It should be dynamic based on the number of records for processing divided by records per package (per execution). Sometimes, if job fails, you might want to have more DO loops, to re-run the job.
Where is this DO ENDDO? Where is it called from?
Kind regards,Hi Mateusz Adamus,
i am not processing any records , i just have to call ABAP report program from another report program which should be called inside loop which iterate 10 times, but it was taking very long for execution thats why placing this in Parallel processing to reduce the time .
Thanks
Look at FM /AIF/SUBMIT_FUNCTION.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 7 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.