2011 Aug 09 11:48 AM
Hi,
I have made a RFC by using BAPI_GOODSMVT_CREATE, but some some times in case the document is not posted due to some error the material is getting lock entry in SM12, and system is not allowing to perform any other work for that material the code part is below
**************
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
TESTRUN = TESTRUN
GOODSMVT_REF_EWM =
IMPORTING
goodsmvt_headret = goodsmvt_headret
materialdocument = materialdocument
matdocumentyear = matdocumentyear
TABLES
goodsmvt_item = goodsmvt_item
goodsmvt_serialnumber = goodsmvt_serialnumber
return = return
GOODSMVT_SERV_PART_DATA =
EXTENSIONIN =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
****************
what can be done for this also try by adding the
IF NOT materialdocument IS INITIAL., " befoe commit FM
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
endif.
regards,
zafar
Hi,
I have made a RFC by using BAPI_GOODSMVT_CREATE, but some some times in case the document is not posted due to some error the material is getting lock entry in SM12, and system is not allowing to perform any other work for that material the code part is below
**************
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
TESTRUN = TESTRUN
GOODSMVT_REF_EWM =
IMPORTING
goodsmvt_headret = goodsmvt_headret
materialdocument = materialdocument
matdocumentyear = matdocumentyear
TABLES
goodsmvt_item = goodsmvt_item
goodsmvt_serialnumber = goodsmvt_serialnumber
return = return
GOODSMVT_SERV_PART_DATA =
EXTENSIONIN =
.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
****************
what can be done for this also try by adding the
IF NOT materialdocument IS INITIAL., " befoe commit FM
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
endif.
regards,
zafar
2011 Aug 09 12:25 PM
Hi,
Use the FM (enqueue_read) to check whether there is lock for the material
if you find it is locked then use the function module(DEQUEUE_ERSPLS_LOCK_SYNC) to release the lock.
Make sure you use these function modules correctly in appropriate place.
Regards,
Nagaraj
2011 Aug 09 12:28 PM
Hi,
What parameters required to be pass for this DEQUEUE_ERSPLS_LOCK_SYNC,
regards,
zafar
2011 Aug 09 4:23 PM
Hi,
You are using the standard bapi BAPI_GOODSMVT_CREATE. Its returning the exact message when the entry is locked.
What is the problem in it ? If its locked then somebody else is using the material.
kesav
2011 Aug 10 4:49 AM
Hi,
The probelm is when we execute the RFC at that time no other user using it , as we are doing iin development, also the material get lock only when the document is not posted means if there if some error msg. and it is lock by same user by which we execute the RFC from non SAP system.
regards,
zafar
2011 Aug 10 4:56 AM
Zafar,
IT is standard SAP behaviour to give error is material is locked by some other user/session/process. So, you should just put an automatic retry kind of thing for this particular error to get your BAPI run successfully as soon as material lock is released.
Check that who/why is material being locked. If it some parallel process and the locks are getting released after that particular process is complete then it is Fine and NORMAL.
BR,
Diwakar
2011 Aug 10 7:13 AM
solve by adding below code
************
if not materialdocument is initial.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
else.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
RETURN = RETURN1.
endif.
************
regards,
zafar
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |