Skip to Content
-3

parallel processing issues

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.

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Oct 12, 2016 at 06:26 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

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

  • Oct 13, 2016 at 05:02 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 13, 2016 at 06:58 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 14, 2016 at 07:16 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2016 at 04:57 PM

    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!!

    Add comment
    10|10000 characters needed characters exceeded