‎2005 Jun 02 8:10 PM
Hello,
I am trying to understand how to process mass data in parallel. I was successfully able to call a function module in a new task (actually in my case I have 4 tasks). The program runs and executes entirely, but I cant get any results.
In the call back form I have inserted a RECEIVE RESULTS statement, but maybe I dont have the syntax correct, I just cant get the results. Maybe in the RECEIVE RESULTS statement Im not putting the task name... Your help would be great.
Here is my code:
DESCRIBE TABLE izusername LINES recordcount.
time = sy-uzeit.
batchsize = recordcount / cpus. "CPUS = # of WPs
LOOP AT izusername.
MOVE-CORRESPONDING izusername TO izusername1.
APPEND izusername1.
IF sy-tabix = batchsize.
task_count = task_count + 1.
CONCATENATE time task_count INTO task_name.
CALL FUNCTION 'Z_GET_USER_NAME'
STARTING NEW TASK task_name DESTINATION IN GROUP DEFAULT
PERFORMING return_info ON END OF TASK
TABLES
izusername = izusername1.
REFRESH izusername1.
CLEAR izusername1.
ENDIF.
ENDLOOP.
LOOP AT izusername3.
WRITE:/ izusername3.
ENDLOOP.
FORM return_info USING task_name.
receive results from function 'Z_GET_USER_NAME'
tables
izusername = izusername2.
APPEND LINES OF izusername2 TO izusername3.
refresh izusername2.
ENDFORM.
Thank you.
ss
‎2005 Jun 03 6:46 AM
Hello SS!
You're missing a wait statement. The receiver-routine can only be triggered, if execution of your calling program is in a wait status - otherwise it would corrupt the sequentiell program execution to much.
Have a look at FM WBB_CHANGE_ARTICLE_FIND, e.g. routine bdcp2_analysis to see a working parall execution.
do.
"table filling
curr_proc_nr = send - receive.
"max process handling
WAIT UNTIL receive >= send.
curr_proc_nr = send - receive.
CALL
if sy-subrc = 0.
send = send + 1.
endif.
exit when all packs are sent.
enddo.
WAIT UNTIL receive >= send .
...
form receiver.
receive = receive + 1.
endform.
Regards,
Christian
‎2005 Jun 03 6:46 AM
Hello SS!
You're missing a wait statement. The receiver-routine can only be triggered, if execution of your calling program is in a wait status - otherwise it would corrupt the sequentiell program execution to much.
Have a look at FM WBB_CHANGE_ARTICLE_FIND, e.g. routine bdcp2_analysis to see a working parall execution.
do.
"table filling
curr_proc_nr = send - receive.
"max process handling
WAIT UNTIL receive >= send.
curr_proc_nr = send - receive.
CALL
if sy-subrc = 0.
send = send + 1.
endif.
exit when all packs are sent.
enddo.
WAIT UNTIL receive >= send .
...
form receiver.
receive = receive + 1.
endform.
Regards,
Christian
‎2005 Jun 03 6:14 PM
‎2005 Jun 04 6:02 PM
Another question I wanted to ask, can I submit the FM in parallel and perform wait at 2 (or more) different times in the same program? What I mean is, there are two parts of the program that take the longest time. I want to process both parts in parallel processing, separately.
I want to:
1) Create separate FMs of those two parts and submit the first part in parallel processing.
2) Receive all information from 1st part, do some processing and/or data manipulation on it.
3) Then submit the 2nd part in parallel processing also. This would be dependent on data received from 1st part.
Can that be done? I'm assuming as long as the task names are different, this should be possible. The only concern that I have is, that I don't want the 2nd part to be processed before I get the results from the 1st part.
Thanks.
ss
‎2005 Jun 05 9:53 AM
Hi SS,
There's a weblog that I have written on Parallel Processing sometime back. You might want to take a look at that as well. Here's the link - /people/sap.user72/blog/2005/04/22/parallel-processing--an-introduction
Regards,
Anand Mandalika.
‎2005 Jun 06 6:26 AM
Hello SS,
when you use 'WAIT UNTIL receive >= send.' in step 2), you will receive all FMs of first processing. Be sure, your wait is placed <i>after</i> loop for sending your FMs in step 1).
Then no general problem should occur, this scenario is a quite common one.
Regards,
Christian
‎2005 Jun 17 8:38 PM
Thanks, Anand. That was a informative intorduction.
It (actually Hint #3) talks about executing in background. Is that possible in 4.7 (6.20) or even 4.6 (4.6D)? I'm trying to figure out if there is a way to use the background work processes instead of dialog work process.
Thanks,
ss