‎2006 Jul 05 2:49 AM
Hi all,
May I know what is the usage of 'COMMIT WORK AND WAIT.
' ??
Thank you all...
‎2006 Jul 05 6:47 AM
Hi Kokwei,
You have to use <b>BAPI_TRANSACTION_COMMIT</b> just after you have called the BAPI.
Consider this sample code.
CALL FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
EXPORTING
quotation_header_in = it_quotation_header_in
quotation_header_inx = it_quotation_header_inx
convert = 'X'
IMPORTING
salesdocument = salesdocument
TABLES
return = ret_text1
quotation_items_in = it_quotation_items_in
quotation_items_inx = it_quotation_items_inx
quotation_partners = it_quotation_partners
quotation_schedules_in = it_quotation_schedules_in
quotation_schedules_inx = it_quotation_schedules_inx.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ret_text2.
ENDIF.
<b>" After this step proceed with your further processing</b>
Regards,
Arun Sambargi.
Message was edited by: Arun Sambargi
‎2006 Jul 05 3:15 AM
this statement will apply any outstanding database updates and wait until they have actually been put on the database before proceeding to the next statement.
An ordinary commit work will initiate the process to update the databases in a separate task and will press on in your abap.
So if the rest of your program does not rely on any of the database updates you don't need the 'and wait'.
‎2006 Jul 05 3:29 AM
In standard ABAP reports, the use of this statement is not recommended without FULL knowledge of intent.
It violates SAP's Logical Unit of Work concept, which requires that a business transaction/LUW must run to completion BEFORE a database commit is performed.
Some BAPIs (for example) do require it's usage.
If you are in doubt, do not use it. Research the effects of an "early" DB update before the program completes it's processing.
‎2006 Jul 05 4:45 AM
Hi,
Function modules that run in the update task can run synchronously or asynchronously. You determine this by the form of the COMMIT statement you use:
<b>COMMIT WORK AND WAIT</b>
This form specifies synchronous processing. The COMMITstatement waits for the end of processing. Control returns to your program after all high priority (V1) function modules have run successfully.
The AND WAIT form is convenient for switching old programs to synchronous processing without having to re-write the code. Functionally, using AND WAIT for update-task updates is just the same as dialog-task updates with PERFORM ON COMMIT.
<b>COMMIT WORK</b>
This is the standard form, which specifies asynchronous processing. Your program does not wait for the requested functions to finish processing.
Hope this will help.
Regards,
Ferry Lianto
‎2006 Jul 05 4:50 AM
Hi,
'COMMIT WORK AND WAIT' is used when u want to do an update using Synchronous mode... means it will have to wait till the processing is complete then only it could move ahead whereas 'COMMIT WORK' is for asynchronous update mode...
Hope this would help u.
Seema.
‎2006 Jul 05 4:55 AM
Hi,
Please refer to following links for commit work.
http://www.sap-img.com/fu018.htm
http://help.sap.com/saphelp_nw04/helpdata/en/d2/7849b8bec911d4b2e80050dadfb92b/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/content.htm
http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/commit-work-and-rollback-work-871915
http://www.sapgenie.com/abap/fieldexits.htm
For wait event
http://dev.mysql.com/doc/maxdb/en/36/d13d408ae01f24e10000000a1550b0/content.htm
http://www.sapdb.org/htmhelp/dc/b277598fe811d5aab3006094b92fad/content.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/b0/eaff4f5f75764bba8b325d221551bf/content.htm
Please reward for the same.
‎2006 Jul 05 5:23 AM
Hi,
COMMIT WORK AND WAIT: ( Synchronous processing ). The next line after this statement in the program will start executing only after getting the acknowledgement.
COMMIT WORK: ( Asynchronous)
Your program does not wait for any acknowledgement. it just start executing the next statment after COMMIT WORK.
Regs,
Venkat Ramanan
‎2006 Jul 05 6:31 AM
I use BAPI to do an account posting , and after that 'COMMIT WORK AND WAIT.' then only proceed to the next screen, but it seems doesnt work, when the process going too slow, the next screen came out faster than the document number of the posting was generated...
‎2006 Jul 05 6:38 AM
‎2006 Jul 05 6:38 AM
Hi kokwei,
1. I use BAPI to do an account posting
If the BAPI is an UPDATE Module (Update FM)
,
the data is updated in background, in a separate
process,
which is independent of the calling program.
2. Hence, WAIT concept will not work.
regards,
amit m.
‎2006 Jul 05 6:40 AM
Hi,
After calling a BAPI, use COMMIT WORK and not COMMIT WORK and WAIT.
Regs,
Venkat Ramanan
‎2006 Jul 05 6:47 AM
Hi Kokwei,
You have to use <b>BAPI_TRANSACTION_COMMIT</b> just after you have called the BAPI.
Consider this sample code.
CALL FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'
EXPORTING
quotation_header_in = it_quotation_header_in
quotation_header_inx = it_quotation_header_inx
convert = 'X'
IMPORTING
salesdocument = salesdocument
TABLES
return = ret_text1
quotation_items_in = it_quotation_items_in
quotation_items_inx = it_quotation_items_inx
quotation_partners = it_quotation_partners
quotation_schedules_in = it_quotation_schedules_in
quotation_schedules_inx = it_quotation_schedules_inx.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ret_text2.
ENDIF.
<b>" After this step proceed with your further processing</b>
Regards,
Arun Sambargi.
Message was edited by: Arun Sambargi