‎2010 Feb 27 9:58 AM
Hi,
I am using BAPI_SALESORDER_CHANGE to update a salesorder delivery date. After the call to the BAPI, if sy-subrc EQ 0, I am calling BAPI_TRANSACTION_COMMIT with 'WAIT' parameter = 'X'.
After this call to the BAPI, the same salesorder is updated by some other process. But I am getting intermittent error like this:
'Salesorder XXXXXXXXXX is locked by user XXXX'
My understanding was that since the 'WAIT' parameter was set in the BAPI_TRANSACTION_COMMIT, this error would not occur since the program is waiting for the commit to complete and locks should be released after the update process. So this error should not have occured.
Moreover, this is happening not for all cases, only some of them..
Any help in finding out why this is happening would be highly appreciated. Thanks.
Regards,
Arun.
‎2010 Feb 27 10:39 AM
Hi,
BAPIs will never return exceptions. So there is no need to check subrc after calling a bapi. Instead, we need to check the return table exported by the BAPI. If it contains any error messages, call 'BAPI_TRANSACTION_ROLLBACK'; if not commit the data to DB by calling 'BAPI_TRANSACTION_COMMIT' by passing WAIT = 'X'.
Regarding your locking issue, before calling bapi for changing the sales order, use the below statement.
SET UPDATE TASK LOCAL.
This will post data without taking much time. Press F1 on the above statement and read SAP documentation.
Hope this helps you!!!
Regards,
Ganga
‎2010 Feb 27 10:55 AM
I think update task local will though increase performance but it will be at cost of your server resources as change
requests ar not written to VBLOG ,instead main memoryYour workpreocess will be exclusively used.
You use them only in batch mode.
‎2010 Feb 27 7:34 PM
Hi Arun,
the program will not continue after BAPI_TRANSACTION_COMMIT with WAIT = 'X' until the update task has completed the saving of the changed order.
Please explain how you make sure that 'some other process' does not start before?
Update Task local will not be persistent solution.
I think the order change process takes place before the program continues after waiting for update task being completete and locks released.
Post some code lines, perhaps it is obvious.
Regards,
Clemens
‎2010 Feb 27 8:26 PM
hi
try to call ur RFC as background task
or
do one thing
before try to change the existing sales order through BAPI
try uing ENQUEUE_READ_TABLE FM to check that particular record is being locked
if it is not lockeed proceed with ur bapi call
else
throw a message saying the record is being locked by some other user
cheers
s.janagar