11-13-2008 1:47 AM
I get the error sales document xxxx currently being edited by xxxx in bapi_sales_order_change though the sales order being processed are not opened simultaneously. Based on previous suggestions and other techniques,
The following have been already taken care of:
1. Explicitly handling and releasing the lock for the given sales order with all other parameters as default.
I am locking it before bapi_billing_cancel1 and releasing it after bapi commit. Enqueue before sales order and dequeue after committing bapi_sales_order_change.
2. Refreshing the data.
3. Explicit wait time as buffer ( wait up to 5 seconds ) on top of BAPI wait time
Do you have any other suggestions to work around a way with out actually increasing the buffer time.
Any input will be helpful.
11-19-2008 7:43 AM
11-19-2008 7:28 AM
Hi...
Use following code for locking ... then try
SELECT * FROM VBAK INTO TABLE TMP_VBAK
WHERE VBELN = P_SO_NO.
CALL FUNCTION 'SD_SALES_DOCUMENT_ENQUEUE'
EXPORTING
VBELN = P_SO_NO
I_CHECK_SCENARIO_A = 'X'
I_VBAK = TMP_VBAK
I_XVBAK_UPDKZ = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
NO_CHANGE = 3
OTHERS = 4.
DA_UNAME = SY-MSGV1.
IF SY-SUBRC <> 0.
STATUS_FLAG_SINGLE = 'X'.
EXPORT STATUS_FLAG_SINGLE TO MEMORY ID 'NEW1'.
MESSAGE E031 WITH DA_UNAME.
ENDIF.
Salil .....
11-19-2008 7:43 AM
11-19-2008 2:56 PM
Yes. I was also doing BAPI transaction commit. What seems to have worked best was ..
"set update task local." before calling a BAPI and then "commit work" after returning from BAPI commit.
So far I have not come across that locking error after this modification.
Thanks all for your help and other postings in forum where I found information on 'set update task local'.