<?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 Re: Parallel Processing in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159203#M119917</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found an example program description (copyright SAP), which looks being able to start new tasks immediately after a session is available again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's displayed in two columns: left with code, right with explanation - but here everything is places after each other. If it sounds more ABAP than English, then it's a new line...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Required Data&lt;/P&gt;&lt;P&gt;Input parameters:&lt;/P&gt;&lt;P&gt;PARAMETERS MAX_PROC_NUM type i. &lt;/P&gt;&lt;P&gt;Limits the maximum number of&lt;/P&gt;&lt;P&gt;parallel jobs. Alternatively, the&lt;/P&gt;&lt;P&gt;system uses as many jobs as can be&lt;/P&gt;&lt;P&gt;started in the system.&lt;/P&gt;&lt;P&gt;PARAMETERS SERV_GROUP type rfcgr. &lt;/P&gt;&lt;P&gt;Name of the server group that is to be&lt;/P&gt;&lt;P&gt;used (required entry for parallel&lt;/P&gt;&lt;P&gt;processing)&lt;/P&gt;&lt;P&gt;PARAMETERS TIMEOUT type I &lt;/P&gt;&lt;P&gt;Maximum waiting time after last package&lt;/P&gt;&lt;P&gt;sent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further data&lt;/P&gt;&lt;P&gt;DATA STARTED type i value 0. &lt;/P&gt;&lt;P&gt;Counter for jobs started so far&lt;/P&gt;&lt;P&gt;DATA RETURNED type i value 0.&lt;/P&gt;&lt;P&gt;Counter for jobs finished so far&lt;/P&gt;&lt;P&gt;DATA RUNNING type i value 0. &lt;/P&gt;&lt;P&gt;Counter for jobs currently running&lt;/P&gt;&lt;P&gt;DATA PROC_NUM_LIMIT type i. &lt;/P&gt;&lt;P&gt;Current maximum value for the number of&lt;/P&gt;&lt;P&gt;jobs running in parallel&lt;/P&gt;&lt;P&gt;DATA NUM_LINES type i. &lt;/P&gt;&lt;P&gt;Number of work items in worklist&lt;/P&gt;&lt;P&gt;DATA TAB_IDX type i. &lt;/P&gt;&lt;P&gt;Table index of current package&lt;/P&gt;&lt;P&gt;DATA RESULT like sy-subrc. &lt;/P&gt;&lt;P&gt;Return value of aRFC&lt;/P&gt;&lt;P&gt;DATA WORK_ITEMS like standard table&lt;/P&gt;&lt;P&gt;of ???? occurs 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table of worklist; the data&lt;/P&gt;&lt;P&gt;type naturally depends on the task in&lt;/P&gt;&lt;P&gt;question.&lt;/P&gt;&lt;P&gt;DATA WA_PACKET like ????. &lt;/P&gt;&lt;P&gt;Work area for data of the current work&lt;/P&gt;&lt;P&gt;item; same data type as WORK_ITEMS&lt;/P&gt;&lt;P&gt;DATA TASKNAME(8). &lt;/P&gt;&lt;P&gt;Variable for a unique name for identifying the started job and thus the processed work item. This is needed if the job returns results data. A simple option is the table index TAB_IDX of the package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initialization&lt;/P&gt;&lt;P&gt;IF MAX_PROC_NUM &amp;lt;= 1.&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;Maybe incorrect entry; possible program&lt;/P&gt;&lt;P&gt;reactions:&lt;/P&gt;&lt;P&gt;1) Use of the maximum number of parallel jobs in the system&lt;/P&gt;&lt;P&gt;2) Re-display selection screen with error message&lt;/P&gt;&lt;P&gt;3) End program with error message&lt;/P&gt;&lt;P&gt;4) At a value of 1, sequential instead&lt;/P&gt;&lt;P&gt;of parallel processing (makes sense for&lt;/P&gt;&lt;P&gt;tests, for example) &lt;/P&gt;&lt;P&gt;SELECT * FROM .... into TABLE&lt;/P&gt;&lt;P&gt;WORK_ITEMS WHERE...&lt;/P&gt;&lt;P&gt;Fill internal table WORK_ITEMS with&lt;/P&gt;&lt;P&gt;required worklist data&lt;/P&gt;&lt;P&gt;Note: This table must not become too&lt;/P&gt;&lt;P&gt;large (memory required!). If necessary,&lt;/P&gt;&lt;P&gt;only key information needs to be read,&lt;/P&gt;&lt;P&gt;or the data can be read in smaller&lt;/P&gt;&lt;P&gt;packages.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE WORK_ITEMS LINES&lt;/P&gt;&lt;P&gt;NUM_LINES.&lt;/P&gt;&lt;P&gt;Determine the size of the worklist in&lt;/P&gt;&lt;P&gt;table WORK_ITEMS. If the table is empty, nothing needs to be done.&lt;/P&gt;&lt;P&gt;TAB_IDX = 1.&lt;/P&gt;&lt;P&gt;CLEAR STARTED.&lt;/P&gt;&lt;P&gt;CLEAR RETURNED.&lt;/P&gt;&lt;P&gt;PROC_NUM_LIMIT = MAX_PROC_NUM.&lt;/P&gt;&lt;P&gt;Initialize variables that control flow.&lt;/P&gt;&lt;P&gt;Limit for the number of parallel jobs is currently the transferred value. This can be changed at runtime.&lt;/P&gt;&lt;P&gt;CALL FUNCTION &amp;#145;SPBT_INITALIZE&amp;#146;&lt;/P&gt;&lt;P&gt;EXPORTING GROUP_NAME=SERV_GROUP&lt;/P&gt;&lt;P&gt;Initialization of server group&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Processing the Worklist in a Loop&lt;/P&gt;&lt;P&gt;WHILE TAB_IDX &amp;lt;= NUM_LINES.&lt;/P&gt;&lt;P&gt;Loop on complete worklist table&lt;/P&gt;&lt;P&gt;RUNNING = STARTED - RETURNED&lt;/P&gt;&lt;P&gt;IF RUNNING &amp;gt;= PROC_NUM_LIMIT.&lt;/P&gt;&lt;P&gt;WAIT UNTIL RUNNING &amp;lt; PROC_NUM_LIMIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;Check whether the maximum number of parallel jobs has already been reached.&lt;/P&gt;&lt;P&gt;If so, wait until one has finished&lt;/P&gt;&lt;P&gt;PROC_NUM_LIMIT = MAX_PROC_NUM. &lt;/P&gt;&lt;P&gt;A new job can now be started. Program tries (again) to use the maximum number of jobs.&lt;/P&gt;&lt;P&gt;READ TABLE WORK_ITEMS INDEX TAB_IDX INTO WA_PACKET.&lt;/P&gt;&lt;P&gt;Read next work item from internal table with worklist in work area.&lt;/P&gt;&lt;P&gt;TASKNAME = TAB_IDX. &lt;/P&gt;&lt;P&gt;Define a unique name for the next job (if necessary). The table index of the work item can be used for this, for example.&lt;/P&gt;&lt;P&gt;CALL FUNCTION &amp;#146;MY_PROCESSING_FUNCTION'&lt;/P&gt;&lt;P&gt;STARTING NEW TASK TASKNAME&lt;/P&gt;&lt;P&gt;DESTINATION IN GROUP SERV_GROUP&lt;/P&gt;&lt;P&gt;PERFORMING COME_BACK ON END OF TASK&lt;/P&gt;&lt;P&gt;EXPORTING ....&lt;/P&gt;&lt;P&gt;TABLES ...&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;RESOURCE_FAILURE = 1&lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE = 2&lt;/P&gt;&lt;P&gt;COMMUNICATION_FAILURE = 3&lt;/P&gt;&lt;P&gt;OTHERS = 4.&lt;/P&gt;&lt;P&gt;RESULT = SY-SUBRC.&lt;/P&gt;&lt;P&gt;Start function module for processing as aRFC in server group SERV_GROUP. When aRFC finishes, form routine COME_BACK is activated. &lt;/P&gt;&lt;P&gt;It is important to record&lt;/P&gt;&lt;P&gt;any system errors at the start of the aRFC, in particular, the exception RESOURCE_FAILURE. The return value is stored in RESULT and then evaluated.&lt;/P&gt;&lt;P&gt;CASE RESULT. &lt;/P&gt;&lt;P&gt;Evaluation of return code.&lt;/P&gt;&lt;P&gt;WHEN 0.&lt;/P&gt;&lt;P&gt;STARTED = STARTED + 1.&lt;/P&gt;&lt;P&gt;RUNNING = RUNNING + 1.&lt;/P&gt;&lt;P&gt;TAB_IDX = TAB_IDX + 1.&lt;/P&gt;&lt;P&gt;Start of aRFC was successful   Update control variables and go on to next work item &lt;/P&gt;&lt;P&gt;Note: At this point, useful trace information can be collected for&lt;/P&gt;&lt;P&gt;subsequent analysis and tuning&lt;/P&gt;&lt;P&gt;WHEN 1.&lt;/P&gt;&lt;P&gt;IF RUNNING = 0.&lt;/P&gt;&lt;P&gt;................&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;PROC_NUM_LIMIT = RUNNING.&lt;/P&gt;&lt;P&gt;Resource problem; this must only be a temporary situation   Make note in Trace File if necessary The program waits until one of the jobs that is still running returns and tries to start the job later. The value for the maximum&lt;/P&gt;&lt;P&gt;number of jobs running is temporarily reduced to the number of jobs currently running. If no job is running, the problem is with the load distribution   Terminate program with error message if necessary&lt;/P&gt;&lt;P&gt;WHEN OTHERS.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;Greater problem in RFC communication. Possible reactions:&lt;/P&gt;&lt;P&gt;1)Terminate program with error message&lt;/P&gt;&lt;P&gt;2)Use local instance only&lt;/P&gt;&lt;P&gt;3)Only use sequential processing in this process&lt;/P&gt;&lt;P&gt;ENDCASE&lt;/P&gt;&lt;P&gt;ENDWHILE. " TAB_IDX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final Processing&lt;/P&gt;&lt;P&gt;WAIT UNTIL RUNNING = 0.&lt;/P&gt;&lt;P&gt;The job for the last work item has now been started. However, processing of this package is not yet finished. Wait until all the jobs that were started have finished. This may be necessary for a follow-on process. In addition, if you do not do this,&lt;/P&gt;&lt;P&gt;COME_BACK will no longer find the context. The waiting time can be restricted as in some cases the end of&lt;/P&gt;&lt;P&gt;a job is not confirmed (e.g. termination of the process at operating system level).&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;All work items have been processed.&lt;/P&gt;&lt;P&gt;Final tasks, such as writing of a log&lt;/P&gt;&lt;P&gt;file, can be carried out, and the&lt;/P&gt;&lt;P&gt;program then finishes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COME_BACK Routine&lt;/P&gt;&lt;P&gt;FORM COME_BACK USING NAME.&lt;/P&gt;&lt;P&gt;When a job ends, form COME_BACK is&lt;/P&gt;&lt;P&gt;activated.&lt;/P&gt;&lt;P&gt;NAME identifies the job. The system&lt;/P&gt;&lt;P&gt;gives the variable the name that was&lt;/P&gt;&lt;P&gt;defined at the start via ....STARTING&lt;/P&gt;&lt;P&gt;NEW TASK TASKNAME... .&lt;/P&gt;&lt;P&gt;RETURNED = RETURNED + 1.&lt;/P&gt;&lt;P&gt;RUNNING = RUNNING - 1.&lt;/P&gt;&lt;P&gt;Update of controlling variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RECEIVE RESULTS FROM FUNCTION&lt;/P&gt;&lt;P&gt;'MY_PROCESSING_FUNCTION'&lt;/P&gt;&lt;P&gt;IMPORTING ...&lt;/P&gt;&lt;P&gt;TABLES ...&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;COMMUNICATION_FAILURE = 1&lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE = 2&lt;/P&gt;&lt;P&gt;OTHERS = 3.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;If necessary, results data can be read&lt;/P&gt;&lt;P&gt;and evaluated. As at the start,&lt;/P&gt;&lt;P&gt;communication problems must be taken&lt;/P&gt;&lt;P&gt;into account.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Feb 2006 04:06:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-02-09T04:06:51Z</dc:date>
    <item>
      <title>Parallel Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159200#M119914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;We Have this following Requirement.&lt;/P&gt;&lt;P&gt;1. Write a Z program that will submit a main ABAP Program  multiple times. &lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;P&gt;2. Modify IF program to check table which is locked. Confirm if all runs for main ABAP Program are successful. &lt;/P&gt;&lt;P&gt;3. Create facility to modify ZINTF_CHECK table via sm30. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody throw some insights and ideas on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Raj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 03:59:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159200#M119914</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T03:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159201#M119915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;go through  this  link  may  be  help  u .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.sdn.sap.com/irj/sdn/collaboration" target="test_blank"&gt;https://www.sdn.sap.com/irj/sdn/collaboration&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 04:02:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159201#M119915</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T04:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159202#M119916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Kishan,&lt;/P&gt;&lt;P&gt;Your link doesnt work. Please check it again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Raj.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 04:05:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159202#M119916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T04:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Parallel Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159203#M119917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found an example program description (copyright SAP), which looks being able to start new tasks immediately after a session is available again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's displayed in two columns: left with code, right with explanation - but here everything is places after each other. If it sounds more ABAP than English, then it's a new line...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Required Data&lt;/P&gt;&lt;P&gt;Input parameters:&lt;/P&gt;&lt;P&gt;PARAMETERS MAX_PROC_NUM type i. &lt;/P&gt;&lt;P&gt;Limits the maximum number of&lt;/P&gt;&lt;P&gt;parallel jobs. Alternatively, the&lt;/P&gt;&lt;P&gt;system uses as many jobs as can be&lt;/P&gt;&lt;P&gt;started in the system.&lt;/P&gt;&lt;P&gt;PARAMETERS SERV_GROUP type rfcgr. &lt;/P&gt;&lt;P&gt;Name of the server group that is to be&lt;/P&gt;&lt;P&gt;used (required entry for parallel&lt;/P&gt;&lt;P&gt;processing)&lt;/P&gt;&lt;P&gt;PARAMETERS TIMEOUT type I &lt;/P&gt;&lt;P&gt;Maximum waiting time after last package&lt;/P&gt;&lt;P&gt;sent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Further data&lt;/P&gt;&lt;P&gt;DATA STARTED type i value 0. &lt;/P&gt;&lt;P&gt;Counter for jobs started so far&lt;/P&gt;&lt;P&gt;DATA RETURNED type i value 0.&lt;/P&gt;&lt;P&gt;Counter for jobs finished so far&lt;/P&gt;&lt;P&gt;DATA RUNNING type i value 0. &lt;/P&gt;&lt;P&gt;Counter for jobs currently running&lt;/P&gt;&lt;P&gt;DATA PROC_NUM_LIMIT type i. &lt;/P&gt;&lt;P&gt;Current maximum value for the number of&lt;/P&gt;&lt;P&gt;jobs running in parallel&lt;/P&gt;&lt;P&gt;DATA NUM_LINES type i. &lt;/P&gt;&lt;P&gt;Number of work items in worklist&lt;/P&gt;&lt;P&gt;DATA TAB_IDX type i. &lt;/P&gt;&lt;P&gt;Table index of current package&lt;/P&gt;&lt;P&gt;DATA RESULT like sy-subrc. &lt;/P&gt;&lt;P&gt;Return value of aRFC&lt;/P&gt;&lt;P&gt;DATA WORK_ITEMS like standard table&lt;/P&gt;&lt;P&gt;of ???? occurs 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table of worklist; the data&lt;/P&gt;&lt;P&gt;type naturally depends on the task in&lt;/P&gt;&lt;P&gt;question.&lt;/P&gt;&lt;P&gt;DATA WA_PACKET like ????. &lt;/P&gt;&lt;P&gt;Work area for data of the current work&lt;/P&gt;&lt;P&gt;item; same data type as WORK_ITEMS&lt;/P&gt;&lt;P&gt;DATA TASKNAME(8). &lt;/P&gt;&lt;P&gt;Variable for a unique name for identifying the started job and thus the processed work item. This is needed if the job returns results data. A simple option is the table index TAB_IDX of the package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initialization&lt;/P&gt;&lt;P&gt;IF MAX_PROC_NUM &amp;lt;= 1.&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;Maybe incorrect entry; possible program&lt;/P&gt;&lt;P&gt;reactions:&lt;/P&gt;&lt;P&gt;1) Use of the maximum number of parallel jobs in the system&lt;/P&gt;&lt;P&gt;2) Re-display selection screen with error message&lt;/P&gt;&lt;P&gt;3) End program with error message&lt;/P&gt;&lt;P&gt;4) At a value of 1, sequential instead&lt;/P&gt;&lt;P&gt;of parallel processing (makes sense for&lt;/P&gt;&lt;P&gt;tests, for example) &lt;/P&gt;&lt;P&gt;SELECT * FROM .... into TABLE&lt;/P&gt;&lt;P&gt;WORK_ITEMS WHERE...&lt;/P&gt;&lt;P&gt;Fill internal table WORK_ITEMS with&lt;/P&gt;&lt;P&gt;required worklist data&lt;/P&gt;&lt;P&gt;Note: This table must not become too&lt;/P&gt;&lt;P&gt;large (memory required!). If necessary,&lt;/P&gt;&lt;P&gt;only key information needs to be read,&lt;/P&gt;&lt;P&gt;or the data can be read in smaller&lt;/P&gt;&lt;P&gt;packages.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE WORK_ITEMS LINES&lt;/P&gt;&lt;P&gt;NUM_LINES.&lt;/P&gt;&lt;P&gt;Determine the size of the worklist in&lt;/P&gt;&lt;P&gt;table WORK_ITEMS. If the table is empty, nothing needs to be done.&lt;/P&gt;&lt;P&gt;TAB_IDX = 1.&lt;/P&gt;&lt;P&gt;CLEAR STARTED.&lt;/P&gt;&lt;P&gt;CLEAR RETURNED.&lt;/P&gt;&lt;P&gt;PROC_NUM_LIMIT = MAX_PROC_NUM.&lt;/P&gt;&lt;P&gt;Initialize variables that control flow.&lt;/P&gt;&lt;P&gt;Limit for the number of parallel jobs is currently the transferred value. This can be changed at runtime.&lt;/P&gt;&lt;P&gt;CALL FUNCTION &amp;#145;SPBT_INITALIZE&amp;#146;&lt;/P&gt;&lt;P&gt;EXPORTING GROUP_NAME=SERV_GROUP&lt;/P&gt;&lt;P&gt;Initialization of server group&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Processing the Worklist in a Loop&lt;/P&gt;&lt;P&gt;WHILE TAB_IDX &amp;lt;= NUM_LINES.&lt;/P&gt;&lt;P&gt;Loop on complete worklist table&lt;/P&gt;&lt;P&gt;RUNNING = STARTED - RETURNED&lt;/P&gt;&lt;P&gt;IF RUNNING &amp;gt;= PROC_NUM_LIMIT.&lt;/P&gt;&lt;P&gt;WAIT UNTIL RUNNING &amp;lt; PROC_NUM_LIMIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;Check whether the maximum number of parallel jobs has already been reached.&lt;/P&gt;&lt;P&gt;If so, wait until one has finished&lt;/P&gt;&lt;P&gt;PROC_NUM_LIMIT = MAX_PROC_NUM. &lt;/P&gt;&lt;P&gt;A new job can now be started. Program tries (again) to use the maximum number of jobs.&lt;/P&gt;&lt;P&gt;READ TABLE WORK_ITEMS INDEX TAB_IDX INTO WA_PACKET.&lt;/P&gt;&lt;P&gt;Read next work item from internal table with worklist in work area.&lt;/P&gt;&lt;P&gt;TASKNAME = TAB_IDX. &lt;/P&gt;&lt;P&gt;Define a unique name for the next job (if necessary). The table index of the work item can be used for this, for example.&lt;/P&gt;&lt;P&gt;CALL FUNCTION &amp;#146;MY_PROCESSING_FUNCTION'&lt;/P&gt;&lt;P&gt;STARTING NEW TASK TASKNAME&lt;/P&gt;&lt;P&gt;DESTINATION IN GROUP SERV_GROUP&lt;/P&gt;&lt;P&gt;PERFORMING COME_BACK ON END OF TASK&lt;/P&gt;&lt;P&gt;EXPORTING ....&lt;/P&gt;&lt;P&gt;TABLES ...&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;RESOURCE_FAILURE = 1&lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE = 2&lt;/P&gt;&lt;P&gt;COMMUNICATION_FAILURE = 3&lt;/P&gt;&lt;P&gt;OTHERS = 4.&lt;/P&gt;&lt;P&gt;RESULT = SY-SUBRC.&lt;/P&gt;&lt;P&gt;Start function module for processing as aRFC in server group SERV_GROUP. When aRFC finishes, form routine COME_BACK is activated. &lt;/P&gt;&lt;P&gt;It is important to record&lt;/P&gt;&lt;P&gt;any system errors at the start of the aRFC, in particular, the exception RESOURCE_FAILURE. The return value is stored in RESULT and then evaluated.&lt;/P&gt;&lt;P&gt;CASE RESULT. &lt;/P&gt;&lt;P&gt;Evaluation of return code.&lt;/P&gt;&lt;P&gt;WHEN 0.&lt;/P&gt;&lt;P&gt;STARTED = STARTED + 1.&lt;/P&gt;&lt;P&gt;RUNNING = RUNNING + 1.&lt;/P&gt;&lt;P&gt;TAB_IDX = TAB_IDX + 1.&lt;/P&gt;&lt;P&gt;Start of aRFC was successful   Update control variables and go on to next work item &lt;/P&gt;&lt;P&gt;Note: At this point, useful trace information can be collected for&lt;/P&gt;&lt;P&gt;subsequent analysis and tuning&lt;/P&gt;&lt;P&gt;WHEN 1.&lt;/P&gt;&lt;P&gt;IF RUNNING = 0.&lt;/P&gt;&lt;P&gt;................&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;PROC_NUM_LIMIT = RUNNING.&lt;/P&gt;&lt;P&gt;Resource problem; this must only be a temporary situation   Make note in Trace File if necessary The program waits until one of the jobs that is still running returns and tries to start the job later. The value for the maximum&lt;/P&gt;&lt;P&gt;number of jobs running is temporarily reduced to the number of jobs currently running. If no job is running, the problem is with the load distribution   Terminate program with error message if necessary&lt;/P&gt;&lt;P&gt;WHEN OTHERS.&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;Greater problem in RFC communication. Possible reactions:&lt;/P&gt;&lt;P&gt;1)Terminate program with error message&lt;/P&gt;&lt;P&gt;2)Use local instance only&lt;/P&gt;&lt;P&gt;3)Only use sequential processing in this process&lt;/P&gt;&lt;P&gt;ENDCASE&lt;/P&gt;&lt;P&gt;ENDWHILE. " TAB_IDX&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final Processing&lt;/P&gt;&lt;P&gt;WAIT UNTIL RUNNING = 0.&lt;/P&gt;&lt;P&gt;The job for the last work item has now been started. However, processing of this package is not yet finished. Wait until all the jobs that were started have finished. This may be necessary for a follow-on process. In addition, if you do not do this,&lt;/P&gt;&lt;P&gt;COME_BACK will no longer find the context. The waiting time can be restricted as in some cases the end of&lt;/P&gt;&lt;P&gt;a job is not confirmed (e.g. termination of the process at operating system level).&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;All work items have been processed.&lt;/P&gt;&lt;P&gt;Final tasks, such as writing of a log&lt;/P&gt;&lt;P&gt;file, can be carried out, and the&lt;/P&gt;&lt;P&gt;program then finishes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COME_BACK Routine&lt;/P&gt;&lt;P&gt;FORM COME_BACK USING NAME.&lt;/P&gt;&lt;P&gt;When a job ends, form COME_BACK is&lt;/P&gt;&lt;P&gt;activated.&lt;/P&gt;&lt;P&gt;NAME identifies the job. The system&lt;/P&gt;&lt;P&gt;gives the variable the name that was&lt;/P&gt;&lt;P&gt;defined at the start via ....STARTING&lt;/P&gt;&lt;P&gt;NEW TASK TASKNAME... .&lt;/P&gt;&lt;P&gt;RETURNED = RETURNED + 1.&lt;/P&gt;&lt;P&gt;RUNNING = RUNNING - 1.&lt;/P&gt;&lt;P&gt;Update of controlling variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RECEIVE RESULTS FROM FUNCTION&lt;/P&gt;&lt;P&gt;'MY_PROCESSING_FUNCTION'&lt;/P&gt;&lt;P&gt;IMPORTING ...&lt;/P&gt;&lt;P&gt;TABLES ...&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;COMMUNICATION_FAILURE = 1&lt;/P&gt;&lt;P&gt;SYSTEM_FAILURE = 2&lt;/P&gt;&lt;P&gt;OTHERS = 3.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;ENDFORM.&lt;/P&gt;&lt;P&gt;If necessary, results data can be read&lt;/P&gt;&lt;P&gt;and evaluated. As at the start,&lt;/P&gt;&lt;P&gt;communication problems must be taken&lt;/P&gt;&lt;P&gt;into account.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2006 04:06:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/parallel-processing/m-p/1159203#M119917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-09T04:06:51Z</dc:date>
    </item>
  </channel>
</rss>

