Skip to Content
-3

parallel processing issues

Oct 12, 2016 at 06:21 AM

264

avatar image

Hello Experts,

I am having an issue with implementing parallel processing for an SQVI query. The query takes too long, so we decided to wrap the query in a custom FM and then call the custom FM in parallel for chunks of data. problem is return_data method is not getting called, below is the code :

I did try to search the existing forums but didnt find an appropriate answers.

CALL FUNCTION 'ZTEST_AM' STARTING NEW TASK lv_task DESTINATION IN GROUP DEFAULT "'parallel_generators'
CALLING return_data ON END OF TASK
TABLES
xt_ever = lt_ever
" yt_device = gt_device[]
EXCEPTIONS
no_data = 1
OTHERS = 2.
IF sy-subrc EQ 0.
COMMIT WORK.
lv_sent = lv_sent + 1.
ENDIF.
ENDDO.

WAIT UNTIL gv_comp LE lv_sent.

*****************************************

METHOD return_data.

DATA : lt_device2 TYPE TABLE OF zemst_device.

RECEIVE RESULTS FROM FUNCTION 'ZTEST_AM'
TABLES
yt_device = lt_device2[].

APPEND LINES OF lt_device2[] TO gt_device[].
gv_comp = gv_comp + 1.

ENDMETHOD.

***********************************

10 |10000 characters needed characters left characters exceeded

Can you paste the signature of return_data? Is it a public method? 1 clike importing parameter?

BTW: use WAIT FOR ASYNCHRONOUS TASKS

0
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Matthew Billingham
Oct 12, 2016 at 06:26 AM
6

How do you know that the method isn't being called? Have you run in debug? Is suspect not, or you would have noticed that your code contains a pretty basic error. You wait until gv_comp until it is less than lv_sent. Then in each return you add 1 to gv_comp. Not going to work, is it? Maybe you should wait until gv_comp is greater than or equal to lv_sent?

Tip: when you have a program not working as expected, try running in debug before posting here.

Show 3 Share
10 |10000 characters needed characters left characters exceeded

There's no proof that the OP didn't debug, because, as you said, the WAIT UNTIL doesn't wait, so probably the query terminates and displays the result, and consequently the callback method cannot be called.

0

Debugging the process would have caught that. So, no proof, but there is evidence...

0

My bad, I wasn't clear too. I mean that the OP might have debugged by setting a break point at the callback method only, so he just didn't debug enough ; it happens to everybody to not see an obvious problem, and need to ask fellow developers to point it out.

0
Jelena Perfiljeva
Oct 13, 2016 at 05:02 PM
2

I suspect the real problem is right here: "parallel processing for an SQVI query". Why are you doing this in a user-specific query? Have you tried to find the root cause of the bad performance? Maybe much better solution would be to create an ABAP program and have more efficient data selection without any parallel processing? I like queries (SQ01 ones, not SQVI) as much as the next guy but they have some limitations.

Share
10 |10000 characters needed characters left characters exceeded
Pavel Anisimov Oct 13, 2016 at 06:58 AM
0

Hello Ankit,

As you have provided only parts of the source it is hard to see the actual scope of the variables. What I would suggest is to have a single variable containing the number of started parallel processes (for example "gv_started_processes"), which should be increased by 1 if the function "ZTEST_AM" has been executed successfully and decreased by 1 in a call-back method, when new data has been received.

After that you could use the statement "WAIT UNTIL gv_started_processes = 0".

Share
10 |10000 characters needed characters left characters exceeded
Gerrit Beukema Oct 14, 2016 at 07:16 AM
0

In addition to what Matthew mentions you will also need to add the following exceptions to your function call:

COMMUNICATION_FAILURE
SYSTEM_FAILURE
RESOURCE_FAILURE

Otherwise you won't really know that the call was triggered successfully.

Also your code has an ENDDO but no DO. I suspect you chop up the EVER table into chunks in your DO and pass those to function call. If you create more chunks than you have processes available the call will fail and you'd have to wait for processes to become available. The SAP help has a sample program, I know it has a few syntax errors, if I remember correctly there is at least an ENDCASE missing but it does give a good outline on how to do parallel processing. Also, make sure your LV_TASK is unique for every call you make.

Share
10 |10000 characters needed characters left characters exceeded
Ankit Munshi Oct 31, 2016 at 04:57 PM
0

Thank you guys!!

There was a typo in the program . Wait statement had LE in it (instead of GE). I debugged and found it out finally. Remaining code is working fine.

Thank you very much for your valuable inputs all!!

Share
10 |10000 characters needed characters left characters exceeded