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 locked by some user.

Former Member
0 Kudos

Hi friends,

I have a problem with locking issues.

I have used BAPI_SALESORDER_CHANGE for updating the details. Before this BAPI i have used the FM with the following details,

CALL FUNCTION 'SD_SALES_DOCUMENT_ENQUEUE'

EXPORTING

vbeln = t_idoc-vbeln

EXCEPTIONS

foreign_lock = 2

system_failure = 3

no_change = 4.

after the BAPI i have used the FM.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

The BAPI_SALESORDER_CHANGE proceeds only after the successfull enqueue. if the sy-subrc is not equal to 0 then it will not reach this bapi.

Actually, the problem is even after passing to the FM 'SD_SALES_DOCUMENT_ENQUEUE' it has reached the BAPI for changing and displayed a message saying "Sales document XXXXXXXXX is currently being processed (by user XXXXXXX)".

Wat could be the problem? please guide me.

Thanks in advance.

3 REPLIES 3

Former Member
0 Kudos

Hi there,

sales document you trying to update is opened by someone or check ur windows if the same sales document is opened by yourself , if it is just close it.

Edited by: BrightSide on Feb 28, 2009 1:15 PM

Former Member
0 Kudos

Hi Mullai Malar,

Once you check if the Sales Document is locked by using FM SD_SALES_DOCUMENT_ENQUEUE, the Sales document is locked by you.

Before calling the BAPI, pls release the lock using DEQUEUE FM.

Pls check if there is a similar FM SD_SALES_DOCUMENT_DEQUEUE .

Code Logic:

1. SD_SALES_DOCUMENT_ENQUEUE

2. Successful lock (sy-subrc = 0)

3. SD_SALES_DOCUMENT_DEQUEUE

4. Successful Release (sy-subrc = 0)

5. BAPI-BAPI_SALESORDER_CHANGE

Pls. check if this works.

Note that the FM SD_SALES_DOCUMENT_ENQUEUE actually locks the Sales Document.

Regards,

harshada

Former Member
0 Kudos

I guess, BAPI_SALESORDER_CHANGE itself locks the sales order! i mean, there is not necessory for explicit locking code, not sure!!

thanq