Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Call FM IN BACKGROUND TASK

Former Member
0 Likes
3,191

Hi,

after calling a FM WITH 'IN BACKGROUND TASK',

what's the difference between 'commit work' and 'commit work and wait' ?

Thanks!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,558

HI Edgar,

The function of the COMMIT WORK statement is extended when you use it in conjunction with Object Services. Before COMMIT WORK closes the SAP LUW and triggers an update, it calls internal methods of the Persistence Service. These methods bundle the changes made to managed objects of the Persistence Service and pass them to a special update function module using CALL FUNCTION ... IN UPDATE TASK. Thus the Persistence Service works with traditional update methods. The update module is usually registered after any update modules that have already been registered. The update is then triggered and the update task executes the update module in the order in which they were registered.

After the system executes the COMMIT WORK statement, it sets the attributes of each persistent object in the ABAP program to initial. (That is, it calls the IF_OS_STATE~INVALIDATE method).

regards

Sathish

Hi,

after calling a FM WITH 'IN BACKGROUND TASK',

what's the difference between 'commit work' and 'commit work and wait' ?

Thanks!

5 REPLIES 5
Read only

Former Member
0 Likes
1,558

Hi,

COMMIT WORK AND WAIT will wait for all the updates to complete..

Thanks,

Naren

Read only

Former Member
0 Likes
1,559

HI Edgar,

The function of the COMMIT WORK statement is extended when you use it in conjunction with Object Services. Before COMMIT WORK closes the SAP LUW and triggers an update, it calls internal methods of the Persistence Service. These methods bundle the changes made to managed objects of the Persistence Service and pass them to a special update function module using CALL FUNCTION ... IN UPDATE TASK. Thus the Persistence Service works with traditional update methods. The update module is usually registered after any update modules that have already been registered. The update is then triggered and the update task executes the update module in the order in which they were registered.

After the system executes the COMMIT WORK statement, it sets the attributes of each persistent object in the ABAP program to initial. (That is, it calls the IF_OS_STATE~INVALIDATE method).

regards

Sathish

Read only

Former Member
0 Likes
1,558

Hi,

to add one more pt,, in simple

Asynchronous Update – The program does not wait for the work process to finish the update. Commit Work.

Synchronous Update – The program wait for the work process to finish the update. Commit Work and Wait.

regards

Sathish

Read only

0 Likes
1,558

Thanks for all reply!

CALL FUNCTION 'ZRFC_TS_SCM_BOMRTNG'

in background task

................................

if sy-subrc eq 0.

commit work and wait.

endif.

the above is synchronous ;

-


CALL FUNCTION 'ZRFC_TS_SCM_BOMRTNG'

in background task

................................

if sy-subrc eq 0.

commit work.

endif.

the above is asynchronous ?

Read only

Former Member
0 Likes
1,558

hi

good

To apply the changes made to the runtime objects of persistent classes to the actual persistent objects in the database, execute the COMMIT WORK statement. (Alternatively, use COMMIT WORK AND WAIT or SET UPDATE TASK LOCAL). Unless you are executing an object-oriented transaction from within the Transaction Service, you must include the COMMIT WORK statement explicitly in the program. Otherwise, it is encapsulated in the Transaction Service. (If you explicitly include the COMMIT WORK statement as described here, the t op-level transaction runs in compatibility mode).

http://help.sap.com/saphelp_nw04/helpdata/en/d2/7849b8bec911d4b2e80050dadfb92b/content.htm

thanks

mrutyun^