<?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 Commit for Asynchronous Function Module in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217804#M1627947</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Halo Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on an Perfomance Optimization project . I am trying to optimize the program by scehduling the individual methods inside the program via asynchronous function modules . By this way I can run this independent methods parallely ( and not sequentailly) . for eg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the program has&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
 me-&amp;gt;m1( ).
 
me-&amp;gt;m2( ).
 
me-&amp;gt;m3( )
 


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;if m2 and m3 are independent of each other I schedule them parallely by&lt;/P&gt;&lt;P&gt;me-&amp;gt;run_m2_m3_parallely(  ) see the below code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 

CALL FUNCTION 'ZM2'
    STARTING NEW TASK 'FUNC1'
    DESTINATION 'NONE'
    CALLING ZCLASS=&amp;gt;set_flag_4_m2 ON END OF TASK.
 
CALL FUNCTION 'ZM3'
    STARTING NEW TASK 'FUNC2'
    DESTINATION 'NONE'
    CALLING ZCLASS=&amp;gt;set_flag_4_m3 ON END OF TASK.
 
 
 
 
  WAIT UNTIL l_m2_flag = 'X' AND
             l_m3_flag = 'X'.
 
  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;the FMs ZM2 and ZM3 are updating Z Database tables( say ZM2  and  ZM3 ) . Do I need an explicit commit work for Individual FMs or a single commit work for both the FMs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I roll back both the updates to the database if a dump occurs ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should the commit work statement be in this case ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arshad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Sep 2011 09:38:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-09-20T09:38:46Z</dc:date>
    <item>
      <title>Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217804#M1627947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Halo Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on an Perfomance Optimization project . I am trying to optimize the program by scehduling the individual methods inside the program via asynchronous function modules . By this way I can run this independent methods parallely ( and not sequentailly) . for eg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if the program has&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 
 me-&amp;gt;m1( ).
 
me-&amp;gt;m2( ).
 
me-&amp;gt;m3( )
 


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;if m2 and m3 are independent of each other I schedule them parallely by&lt;/P&gt;&lt;P&gt;me-&amp;gt;run_m2_m3_parallely(  ) see the below code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; 

CALL FUNCTION 'ZM2'
    STARTING NEW TASK 'FUNC1'
    DESTINATION 'NONE'
    CALLING ZCLASS=&amp;gt;set_flag_4_m2 ON END OF TASK.
 
CALL FUNCTION 'ZM3'
    STARTING NEW TASK 'FUNC2'
    DESTINATION 'NONE'
    CALLING ZCLASS=&amp;gt;set_flag_4_m3 ON END OF TASK.
 
 
 
 
  WAIT UNTIL l_m2_flag = 'X' AND
             l_m3_flag = 'X'.
 
  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;the FMs ZM2 and ZM3 are updating Z Database tables( say ZM2  and  ZM3 ) . Do I need an explicit commit work for Individual FMs or a single commit work for both the FMs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I roll back both the updates to the database if a dump occurs ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How should the commit work statement be in this case ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arshad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 09:38:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217804#M1627947</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-20T09:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217805#M1627948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Arshad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you're using asynch-RFC(aRFC) they are run in separate RFC contexts which don't share a common LUW. You need to maintain an explicit commit to store the data in the DB tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;How can I roll back both the updates to the database if a dump occurs?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;What exactly is your requirement, can you elaborate?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: If you're using a transactioncal RFC(tRFC), they are registed in a common LUW.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 09:53:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217805#M1627948</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-20T09:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217806#M1627949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can solve your issue by using the KEEPING TASK addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your ZCLASS=&amp;gt;set_flag_4_m2 method try this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
METHOD set_flag_4_m2.
  RECEIVE RESULTS FROM FUNCTION 'ZM2 ' KEEPING TASK.
 
ENDMETHOD.
METHOD set_flag_4_m3.
  RECEIVE RESULTS FROM FUNCTION 'ZM3 ' KEEPING TASK.
ENDMETHOD.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And after your wait you can try to do this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WAIT UNTIL l_m2_flag = 'X' AND
             l_m3_flag = 'X'.

* In set_func2_commited you must receive results from BAPI_tRANSACTION_COMMIT and set global flag g_func2_commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    STARTING NEW TASK 'FUNC2'
    DESTINATION 'NONE'
    CALLING ZCLASS=&amp;gt;set_func2_commited ON END OF TASK.

* In set_func3_commited you must receive results from BAPI_tRANSACTION_COMMIT and set global flag g_func3_commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    STARTING NEW TASK 'FUNC3'
    DESTINATION 'NONE'
    CALLING ZCLASS=&amp;gt;set_func3_commited ON END OF TASK.
WAIT UNTIL g_func3_commit EQ 'X' and g_func2_commit EQ 'X'.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 10:21:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217806#M1627949</guid>
      <dc:creator>arseni_gallardo</dc:creator>
      <dc:date>2011-09-20T10:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217807#M1627950</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Halo Suhas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My aim is to run independent methods parallely so that I can optimise the perfomance of the program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question regarding roll back was if some exception happens and dumps in Zm3 , will the M2 update be rolled back also?( because we are having individual commits inside Zm2 and Zm3 )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this parallel execution , it is succesfully updating table m2 ( same as the number of entries of sequential run ) and table m3 it is not updating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But the strange thing is if I put user defined break point in Zm3 and executing the program it is correctly updating m3 table . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arshad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Sep 2011 20:27:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217807#M1627950</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-20T20:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217808#M1627951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Arshad,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;My question regarding roll back was if some exception happens and dumps in Zm3 , will the M2 update be rolled back also?( because we are having individual commits inside Zm2 and Zm3 )&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;No, because you're running the updates in parallel, if you want to achieve this requirement you'll have to bundle the updates in a single LUW. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;I tried this parallel execution , it is succesfully updating table m2 ( same as the number of entries of sequential run ) and table m3 it is not updating.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Are you issuing a COMMIT WORK in the asych task 'M3'?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 04:48:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217808#M1627951</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-21T04:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217809#M1627952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I am using commit work inside task M3 also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arshad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 08:35:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217809#M1627952</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-21T08:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217810#M1627953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As said by Suhas, bundle into one LUW. then it will work..&lt;/P&gt;&lt;P&gt;Instead of upadating tables directly in FM Z2 , and Z3 , recieve the results back to main internal session and use UPDATE Function module to update the tables..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;RECEIVE RESULTS FROM FUNCTION z2 
                parameter_list 

RECEIVE RESULTS FROM FUNCTION z3 
                parameter_list&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Sep 2011 09:07:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217810#M1627953</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-21T09:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217811#M1627954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Halo Arseni,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply . I tried the same but still the table M3 is not updated . While going in debugging its still updated . Dont know what really is the issue here ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arshad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 13:53:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217811#M1627954</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-23T13:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Commit for Asynchronous Function Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217812#M1627955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Halo rshankar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cant change the existing logic of the program . So the table updates takes place in method m2 and m3 . and I need to put the same inside Async FM ZM2 and ZM3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arshad&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2011 13:55:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/commit-for-asynchronous-function-module/m-p/8217812#M1627955</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-23T13:55:56Z</dc:date>
    </item>
  </channel>
</rss>

