<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Parallel processing program switches to seq. processing after some time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing-program-switches-to-seq-processing-after-some-time/m-p/2827295#M661577</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing a peculiar issue in one of my || processing program. The program, when executed with a data-set of 10,000 records takes 65 minutes to complete. One would expect it to take 650 minutes (or even lesser) to process a data-set of app. 100,000 records. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I run the program for a file with app. 100,000 records the program runs OK initially (i.e; I could see multiple dialog processes getting invoked in SM50) but, after a while it starts running on ONLY ONE dialog process. I am not quite sure where, when and why this PARALLEL to SEQUENTIAL switch is happening. Due to this, the program drags on and on and on. I would highly appreciate your suggestions/tips to put this bug to sleep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a summary of the logic used...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  w_group = 'BATCH_PARALLEL'.&lt;/P&gt;&lt;P&gt;  w_task  = w_task + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'SPBT_INITIALIZE'&lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;P&gt;     group_name                           = w_group&lt;/P&gt;&lt;P&gt;   IMPORTING&lt;/P&gt;&lt;P&gt;     max_pbt_wps                          = w_pr_total   "Total processes&lt;/P&gt;&lt;P&gt;     free_pbt_wps                         = w_pr_avl     "Avail processes&lt;/P&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;P&gt;     invalid_group_name                   = 1&lt;/P&gt;&lt;P&gt;     internal_error                       = 2&lt;/P&gt;&lt;P&gt;     pbt_env_already_initialized          = 3&lt;/P&gt;&lt;P&gt;     currently_no_resources_avail         = 4&lt;/P&gt;&lt;P&gt;     no_pbt_resources_found               = 5&lt;/P&gt;&lt;P&gt;     cant_init_different_pbt_groups       = 6&lt;/P&gt;&lt;P&gt;     OTHERS                               = 7.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Raise error mesage and quit&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_wait = c_x.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If everything went well, continue processing &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    CLEAR: w_wait.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The subroutine that receives results from the parallel FMs will reduce&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;this counter and set the flag W_WAIT once the value is equal to ZERO&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_count = LINES( data ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Refresh the temporary table that will be populated for every partner&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    REFRESH: t_data.&lt;/P&gt;&lt;P&gt;    LOOP AT data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Keep appending data to the temporary table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      APPEND data TO t_data.&lt;/P&gt;&lt;P&gt;      AT END OF partner.&lt;/P&gt;&lt;P&gt;        CLEAR: w_subrc.&lt;/P&gt;&lt;P&gt;        CALL FUNCTION 'Z_PARALLEL_FUNCTION'&lt;/P&gt;&lt;P&gt;          STARTING NEW TASK w_task&lt;/P&gt;&lt;P&gt;          DESTINATION IN GROUP w_group&lt;/P&gt;&lt;P&gt;          PERFORMING process_return ON END OF TASK&lt;/P&gt;&lt;P&gt;          TABLES&lt;/P&gt;&lt;P&gt;            data                  = t_data&lt;/P&gt;&lt;P&gt;          EXCEPTIONS&lt;/P&gt;&lt;P&gt;            communication_failure = 1      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;            system_failure        = 2      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;            RESOURCE_FAILURE      = 3      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;            OTHERS                = 4.&lt;/P&gt;&lt;P&gt;        w_subrc = sy-subrc.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check if everything went well...&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        CLEAR: w_rfcdest.&lt;/P&gt;&lt;P&gt;        CASE w_subrc.&lt;/P&gt;&lt;P&gt;          WHEN 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This variable keeps track of the number of threads initiated. In case&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;all the processes are busy, we should compare this with the variable&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_recd (set later in the subroutine 'PROCESS_RETURN'), and wait till&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_sent &amp;gt;= w_recd.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            w_sent = w_sent + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Track all the tasks initiated.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            CLEAR: wa_tasklist.&lt;/P&gt;&lt;P&gt;            wa_tasklist-taskname = w_task.&lt;/P&gt;&lt;P&gt;            APPEND wa_tasklist TO t_tasklist.&lt;/P&gt;&lt;P&gt;          WHEN 1 OR 2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate the error log table and continue to process the rest.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          WHEN OTHERS.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;There might be a lack of resources. Wait till some processes&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;are freed again. Populate the records back to the main table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            CLEAR: wa_data.&lt;/P&gt;&lt;P&gt;            LOOP AT t_data INTO wa_data.&lt;/P&gt;&lt;P&gt;              APPEND wa_data TO data.&lt;/P&gt;&lt;P&gt;            ENDLOOP.&lt;/P&gt;&lt;P&gt;            WAIT UNTIL w_recd &amp;gt;= w_sent. "IS THIS THE CULPRIT?&lt;/P&gt;&lt;P&gt;        ENDCASE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Increment the task number&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        w_task = w_task + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Refresh the temporary table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        REFRESH t_data.&lt;/P&gt;&lt;P&gt;      ENDAT.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Wait till all the records are returned.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  WAIT UNTIL w_wait = c_x UP TO '120' SECONDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM process_return USING p_taskname.                       "#EC CALLED&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  REFRESH: t_data_tmp.&lt;/P&gt;&lt;P&gt;  CLEAR  : w_subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check the task for which this subroutine is processed!!!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CLEAR: wa_tasklist.&lt;/P&gt;&lt;P&gt;  READ TABLE t_tasklist INTO wa_tasklist WITH KEY taskname = p_taskname.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If the task wasn't already processed...&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF sy-subrc eq 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delete the task from the table T_TASKLIST&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DELETE TABLE t_tasklist FROM wa_tasklist.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Receive the results back from the function module&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    RECEIVE RESULTS FROM FUNCTION 'Z_PARALLEL_FUNCTION'&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        address_data          = t_data_tmp&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        communication_failure = 1      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;        system_failure        = 2      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;        RESOURCE_FAILURE      = 3      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;        OTHERS                = 4.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Store sy-subrc in a temporary variable.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_subrc = sy-subrc.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Update the counter (Number of tasks/jobs/threads received)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_recd = w_recd + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check the returned values&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF w_subrc EQ 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Do necessary processing!!!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Subtract the number of records that were returned back from the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;total number of records to be processed&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_count = w_count - LINES( t_data_tmp ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If the counter is ZERO, set W_WAIT.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF w_count = 0.&lt;/P&gt;&lt;P&gt;      w_wait = c_x.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " process_return&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Muthu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Sep 2007 13:55:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-09-26T13:55:28Z</dc:date>
    <item>
      <title>Parallel processing program switches to seq. processing after some time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing-program-switches-to-seq-processing-after-some-time/m-p/2827295#M661577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing a peculiar issue in one of my || processing program. The program, when executed with a data-set of 10,000 records takes 65 minutes to complete. One would expect it to take 650 minutes (or even lesser) to process a data-set of app. 100,000 records. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I run the program for a file with app. 100,000 records the program runs OK initially (i.e; I could see multiple dialog processes getting invoked in SM50) but, after a while it starts running on ONLY ONE dialog process. I am not quite sure where, when and why this PARALLEL to SEQUENTIAL switch is happening. Due to this, the program drags on and on and on. I would highly appreciate your suggestions/tips to put this bug to sleep.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a summary of the logic used...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  w_group = 'BATCH_PARALLEL'.&lt;/P&gt;&lt;P&gt;  w_task  = w_task + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'SPBT_INITIALIZE'&lt;/P&gt;&lt;P&gt;   EXPORTING&lt;/P&gt;&lt;P&gt;     group_name                           = w_group&lt;/P&gt;&lt;P&gt;   IMPORTING&lt;/P&gt;&lt;P&gt;     max_pbt_wps                          = w_pr_total   "Total processes&lt;/P&gt;&lt;P&gt;     free_pbt_wps                         = w_pr_avl     "Avail processes&lt;/P&gt;&lt;P&gt;   EXCEPTIONS&lt;/P&gt;&lt;P&gt;     invalid_group_name                   = 1&lt;/P&gt;&lt;P&gt;     internal_error                       = 2&lt;/P&gt;&lt;P&gt;     pbt_env_already_initialized          = 3&lt;/P&gt;&lt;P&gt;     currently_no_resources_avail         = 4&lt;/P&gt;&lt;P&gt;     no_pbt_resources_found               = 5&lt;/P&gt;&lt;P&gt;     cant_init_different_pbt_groups       = 6&lt;/P&gt;&lt;P&gt;     OTHERS                               = 7.&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  Raise error mesage and quit&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_wait = c_x.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If everything went well, continue processing &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    CLEAR: w_wait.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The subroutine that receives results from the parallel FMs will reduce&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;this counter and set the flag W_WAIT once the value is equal to ZERO&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_count = LINES( data ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Refresh the temporary table that will be populated for every partner&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    REFRESH: t_data.&lt;/P&gt;&lt;P&gt;    LOOP AT data.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Keep appending data to the temporary table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      APPEND data TO t_data.&lt;/P&gt;&lt;P&gt;      AT END OF partner.&lt;/P&gt;&lt;P&gt;        CLEAR: w_subrc.&lt;/P&gt;&lt;P&gt;        CALL FUNCTION 'Z_PARALLEL_FUNCTION'&lt;/P&gt;&lt;P&gt;          STARTING NEW TASK w_task&lt;/P&gt;&lt;P&gt;          DESTINATION IN GROUP w_group&lt;/P&gt;&lt;P&gt;          PERFORMING process_return ON END OF TASK&lt;/P&gt;&lt;P&gt;          TABLES&lt;/P&gt;&lt;P&gt;            data                  = t_data&lt;/P&gt;&lt;P&gt;          EXCEPTIONS&lt;/P&gt;&lt;P&gt;            communication_failure = 1      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;            system_failure        = 2      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;            RESOURCE_FAILURE      = 3      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;            OTHERS                = 4.&lt;/P&gt;&lt;P&gt;        w_subrc = sy-subrc.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check if everything went well...&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        CLEAR: w_rfcdest.&lt;/P&gt;&lt;P&gt;        CASE w_subrc.&lt;/P&gt;&lt;P&gt;          WHEN 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This variable keeps track of the number of threads initiated. In case&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;all the processes are busy, we should compare this with the variable&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_recd (set later in the subroutine 'PROCESS_RETURN'), and wait till&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;w_sent &amp;gt;= w_recd.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            w_sent = w_sent + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Track all the tasks initiated.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            CLEAR: wa_tasklist.&lt;/P&gt;&lt;P&gt;            wa_tasklist-taskname = w_task.&lt;/P&gt;&lt;P&gt;            APPEND wa_tasklist TO t_tasklist.&lt;/P&gt;&lt;P&gt;          WHEN 1 OR 2.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populate the error log table and continue to process the rest.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          WHEN OTHERS.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;There might be a lack of resources. Wait till some processes&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;are freed again. Populate the records back to the main table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;            CLEAR: wa_data.&lt;/P&gt;&lt;P&gt;            LOOP AT t_data INTO wa_data.&lt;/P&gt;&lt;P&gt;              APPEND wa_data TO data.&lt;/P&gt;&lt;P&gt;            ENDLOOP.&lt;/P&gt;&lt;P&gt;            WAIT UNTIL w_recd &amp;gt;= w_sent. "IS THIS THE CULPRIT?&lt;/P&gt;&lt;P&gt;        ENDCASE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Increment the task number&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        w_task = w_task + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Refresh the temporary table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        REFRESH t_data.&lt;/P&gt;&lt;P&gt;      ENDAT.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Wait till all the records are returned.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  WAIT UNTIL w_wait = c_x UP TO '120' SECONDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM process_return USING p_taskname.                       "#EC CALLED&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  REFRESH: t_data_tmp.&lt;/P&gt;&lt;P&gt;  CLEAR  : w_subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check the task for which this subroutine is processed!!!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CLEAR: wa_tasklist.&lt;/P&gt;&lt;P&gt;  READ TABLE t_tasklist INTO wa_tasklist WITH KEY taskname = p_taskname.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If the task wasn't already processed...&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF sy-subrc eq 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Delete the task from the table T_TASKLIST&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    DELETE TABLE t_tasklist FROM wa_tasklist.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Receive the results back from the function module&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    RECEIVE RESULTS FROM FUNCTION 'Z_PARALLEL_FUNCTION'&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        address_data          = t_data_tmp&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        communication_failure = 1      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;        system_failure        = 2      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;        RESOURCE_FAILURE      = 3      "Mandatory for || processing&lt;/P&gt;&lt;P&gt;        OTHERS                = 4.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Store sy-subrc in a temporary variable.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_subrc = sy-subrc.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Update the counter (Number of tasks/jobs/threads received)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_recd = w_recd + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Check the returned values&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF w_subrc EQ 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Do necessary processing!!!&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Subtract the number of records that were returned back from the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;total number of records to be processed&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    w_count = w_count - LINES( t_data_tmp ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If the counter is ZERO, set W_WAIT.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    IF w_count = 0.&lt;/P&gt;&lt;P&gt;      w_wait = c_x.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " process_return&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Muthu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 13:55:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing-program-switches-to-seq-processing-after-some-time/m-p/2827295#M661577</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T13:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel processing program switches to seq. processing after some time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing-program-switches-to-seq-processing-after-some-time/m-p/2827296#M661578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have not gone through your code, but this is what i think:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The number of dialog work processes available is limited. Once you reach the limit all the processing happens only in the last work process, as no new work processes can be created . (Not too sure about this).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Sep 2007 14:02:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing-program-switches-to-seq-processing-after-some-time/m-p/2827296#M661578</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-09-26T14:02:07Z</dc:date>
    </item>
  </channel>
</rss>

