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

commit work and wait OR 'BAPI_TRANSACTION_COMMIT' doesnt work..

kowong
Participant
0 Likes
886

Dear Expert,

After a BAPI called, i do commit work and wait, or

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

For both, it return "XXXX is still processed by user XXXX".

This shows that the second loop of job is starting even the first job havent completed the update. i have tried commit work and wait, or bapi_transaction_commit with wait = 'X' .

It works in Debug mode, when I stop break on the line BAPI_TRANSACTION_COMMIT.

Is there any other way to do this ?

These are my codes:

CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'

EXPORTING

entrysheetheader = l_entrysheetheader

IMPORTING

entrysheet = v_entrysheet

TABLES

return = it_messages .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = it_messages2.

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
710

Try to set the update as local,

SET UPDATE TASK LOCAL. 

Regards

Read only

0 Likes
710

Or you can wait using FMCT_WAIT_FOR_UPDATE function module or WAIT instruction.

Regards

Read only

former_member873340
Active Participant
0 Likes
710

Hi kokwei,

The same problem was faced by me once.

If time is not the major factor in your report.

try using wait command.

Eg : WAIT UP TO '2' SECONDS.

Or any seconds. Try doing it to the minimum time possible and use it.

In the function module also try using some value instead of X

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = '7'

IMPORTING

return = it_messages2.

Surely it will work. Let me know if it does not.

<b><REMOVED BY MODERATOR></b>

Gowri

Message was edited by:

Gowri Shankar

Message was edited by:

Alvaro Tejada Galindo

Read only

Former Member
0 Likes
710

You could debug this message and see if it is being issued based on an enqueue wait for some object.

If so you could check this in your program before doing the commit and loop till it is available.

Andrew