Application Development 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: 

sales document xxxx currently being edited by xxxx

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Are you using bapi_transaction_commit.

3 REPLIES 3

Former Member
0 Kudos

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 .....

Former Member
0 Kudos

Are you using bapi_transaction_commit.

Former Member
0 Kudos

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'.