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

Article lock issue in bdc

Former Member
0 Likes
1,909

Dear all,

I have written one bdc which will internally call another bdc for transaction : mb1a.

When i post 2 document having same article, then 1st document is successfully posted , but when 2nd document is posting , "Article is lock" this error is coming.

Bdc mode is 'S'.

I have use Wait statement , but it is not feasible bcoz it takes too much time , when i have lots of document for posting.

So , Is there any other solution?

Thanx.

As you get the lock error you should be able to identify the lock required. So instead of a single WAIT statement, use a call of the related ENQUEUE FM with _WAIT option set, and once every required material for the next execution are locked, DEQUEUE those and call your next BDC. The ENQUEUE will wait til the update tasks triggered by the BDC have released their locks.

  • loop
    • read input data
    • build the bdc and  list of material number
    • loop at material list
      • lock the material number with wait (but not in an infinite loop)
    • endloop
    • You could create an error log if not able to lock (e.g.. a user is sleeping before a MM02 screen)
    • loop at material list
      • release the lock on the material number
    • endloop
    • skip next step if lock unsuccessful too long
    • execute the bdc
    • create an error log if call transaction raise an error
  • endloop

(If you called a BAPI and not executed a BDC (so executed in another LUW) you could have removed the dequeue step)

Regards,

Raymond

6 REPLIES 6
Read only

vinoth_aruldass
Contributor
0 Likes
1,337

hi,

there is a bapi available for mb1a. its BAPI_GOODSMVT_CREATE.

Please try to post document by this. use bapi_transaction_commit

and wait .

hope it helps,

vinoth

Read only

0 Likes
1,337

Thanx Vinoth..

Yes , You are right, but i am calling ztcode via bdc.

And In this ztcode , lots of another activity is perform and one of the activity is posting.

In that ztcode , one bdc is written for posting.

So , I am passing Document to this ztcode and this ztcode is posting document.

When I passed 2nd document , it gives me error.

If i use Wait statement then it working fine. But i don't want to use wait.

Thanx

Satyen.

Read only

0 Likes
1,337

hi,

to post the document system is taking some time that is why article is block error is coming when you are processing your second time meanwhile. So as per my concern wait is the only concern.

if you confirm about ENQUEUE/DEQUEUE process try that too.

hope it helps,

Vinoth

Read only

Former Member
0 Likes
1,337

Use this lock object ur BDC Program.

"ENQUEUE_EMMBWL"   / "DEQUEUE_EMMBWL"

Blocked key MB_CREATE_GOODS_MOVEMENT / MB_POST_GOODS_MOVE

Note : I think you know how to use ENQUEUE/DEQUEUE .

Regard's

Smruti

Read only

Former Member
0 Likes
1,337

Reference Purpose

Sample Code "DEMO_TRANSACTION_ENQUEUE"

using Call Transaction .

Regard's

Smruti

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,337

As you get the lock error you should be able to identify the lock required. So instead of a single WAIT statement, use a call of the related ENQUEUE FM with _WAIT option set, and once every required material for the next execution are locked, DEQUEUE those and call your next BDC. The ENQUEUE will wait til the update tasks triggered by the BDC have released their locks.

  • loop
    • read input data
    • build the bdc and  list of material number
    • loop at material list
      • lock the material number with wait (but not in an infinite loop)
    • endloop
    • You could create an error log if not able to lock (e.g.. a user is sleeping before a MM02 screen)
    • loop at material list
      • release the lock on the material number
    • endloop
    • skip next step if lock unsuccessful too long
    • execute the bdc
    • create an error log if call transaction raise an error
  • endloop

(If you called a BAPI and not executed a BDC (so executed in another LUW) you could have removed the dequeue step)

Regards,

Raymond