Application Development and Automation 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: 
Read only

Delivery Document Lock Issue in Z Program using BAPI(s)

Former Member
0 Likes
2,941

Hi,

I am a functional consultant posting this in ABAP forum. We have developed a Z-Program.

User enters the Service Order no. in this program and executes it.

The program then updates the following linked documents in the following sequence using BAPI(s)

Outbound Delivery

Service Notification

Service Order (This is done using BDC of IW32)

It sometimes happens that once the Program reaches the iw32 bdc, it gives error "Delivery XXXXXXXX is locked by User ID XXXXXX"

The user ID being that of the person executing the transaction.

This happens like 3 out of 100 times in the Production Server. We are unable to replicate this issue in Quality or Development Server.

We believe it to be a performance issue (database updating is slow)

However Client wants us to investigate the Program and see what is possible.

We are thinking of putting WAIT after the BAPI(s) of the Delivery Update.

Any suggestions, please help.

7 REPLIES 7
Read only

Former Member
0 Likes
1,392

HI

Run Tcode SM12

Enter user id And delete locked delivery .

Regards

Ajit

Read only

0 Likes
1,392

Dear Sir,

That is not the solution. If i Delete the update key, it would then not do the update which I require.

Anyways, we don't have access to sm12 in production.

Read only

deepak_dhamat
Active Contributor
0 Likes
1,392

Hi ,

Check whenever you are getting this error Delivery Document Lock Issue using BAPI : Transaction code VL02N or VL01n with same document delivery might be accesed by that USER .

regards

Deepak.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,392

Hello Nitin,

First we need to understand as per the business process whether the updates for Outbound Delivery, Service Notification & Service Order are disjoint.

Considering they are disjoint, you need to sit with the ABAPer & check which BAPIs are used to update these business objects. Whether the BAPI issues a COMMIT internally or should the caller explicitly call BAPI_TRANSACTION_COMMIT to commit the changes.

If BAPI_TRANSACTION_COMMIT has to be called, then you need to make the update synchronous by passing 'X' to the WAIT param.

We are thinking of putting WAIT after the BAPI(s) of the Delivery Update.

You should consider the implications of WAIT before using it. Major problem with WAIT is that it triggers a implict DB-commit

Hope i'm clear.

BR,

Suhas

Read only

Former Member
0 Likes
1,392

Hello Suhas,

Thanks for the reply.

These documents are seperate objects but are interlinked. i.e I can see in the Document Flow for Service Order, which is the Service Notification and Outbound Delivery for the Material.

Also, If I'm in change mode in the Outbound Delivery, I cannot go into the change mode of the Service Order.

Yes, we are using BAPI_TRANSACTION_COMMIT after each BAPI in the Program. We have used the Wait Statement in all BAPIs for the Service Notification. These BAPI(s) are before the IW32 BDC.

I am copying code from one of the commit BAPI(s)

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = c_x.

WAIT UP TO 1 SECONDS.

I noticed in the Outbound Delivery BAPI(s) (two of them) don't have the wait in the BAPI_TRANSACTION_COMMIT. Hence I though if we add this, could this resolve the issue?

Service Order gets updated last through BDC for IW32 after all the BAPI(s) are executed for Outbound Delivery and Service Notification.

I understand WAIT would increase processing time, that is why I am posting this to know if we have some other solution available for such a lock issue.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,392

Hello Nitin,

Sorry but i'm confused

First you say,

I am copying code from one of the commit BAPI(s)

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x.
WAIT UP TO 1 SECONDS.

Then,

I noticed in the Outbound Delivery BAPI(s) (two of them) don't have the wait in the BAPI_TRANSACTION_COMMIT. Hence I though if we add this, could this resolve the issue?

Please clarify whether your BAPI commits have 'X' passed to the WAIT param or they don't. If the latter, then try passing 'X' to the BAPI commit & check

BR,

Suhas

PS: If you've passed 'X' to the WAIT param, you need not use WAIT statement

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,392

- As you have identified the object which is locked by the update process, don't use a WAIT (except the COMMIT WORK/BAPI_TRANSACTION_COMMIT with WAIT option) but try to lock yourself the delivery after the BAPI (look via SM12 or in the error message to get the correct object to lock) perform a loop (like DO/ENQUEUE_EVVBLKE/ENDDO) until you are able to get the lock on the delivery, then release it (DEQUEUE_EVVBLKE) and call your IW32 BDC. In most case the lock will be immediate, so not much delay.

- You could also try to use BAPI_ALM_ORDER_MAINTAIN and not a BDC on IW32. As the CALL TRANSACTION (using bdc) create a new internal session, it don't share the same LUW than the BAPIs.

Regards,

Raymond