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

Unlock material in BDC program

Former Member
0 Likes
1,620

Hi All,

I am writing a BDC program to process material masters. The program going to create same material for 2 plant. The material creation for 2nd plant referring to 1st plant.

The process for 2nd plant only initiated after the process in 1st plant is completed. The 2nd process failed because the material created in 1st process is locked. I need help on how to resolve this problem.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,000

You could use BAPI and WAIT option in the COMMIT.

With BDC you wont have many options if response time are not excellent, as there is a delay between the end of the transaction (COMMIT) and the end of the update tasks that actually update database and share the lock during the process.

If you are using CALL TRANSACTION and not sessions you could try to lock the material reference (FM ENQUEUE_EMMARAE) til successful then release it and CALL the second TRANSACTION.

Regards,

Raymond

4 REPLIES 4
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,001

You could use BAPI and WAIT option in the COMMIT.

With BDC you wont have many options if response time are not excellent, as there is a delay between the end of the transaction (COMMIT) and the end of the update tasks that actually update database and share the lock during the process.

If you are using CALL TRANSACTION and not sessions you could try to lock the material reference (FM ENQUEUE_EMMARAE) til successful then release it and CALL the second TRANSACTION.

Regards,

Raymond

Read only

Former Member
0 Likes
1,000

Hi,

you can create two different BDC sessions one for first and one for second plant. If session for first plant has completed for all materials without errors you can start the second session for the other plant.

Using CALL TRANSACTION you can try update modes 'S' and 'L'. Additional if needed you can use the lock loop mechanism Raymond suggested.

Regards,

Klaus

Read only

Flavio
Active Contributor
0 Likes
1,000

Hi Boon,

Instead of BDC, in the past I found myself quite confortable with MATERIAL_MAINTAIN_DARK function module, for a very similar requirement.

It's a well documented FM. You can pass almost all material fields in the available structures. It's easy to be used and efficient.

I hope this could be of any help. If you need further details, just let me know.

Bye,

Flavio

Read only

former_member235395
Contributor
0 Likes
1,000

Hi,

I think, do you need use the Lock Object Function Module after process first material.

ENQUEUE_*MAT*

DEQUEUE_*MAT*

by check is material is locked use the ENQUEUE Function Module, if you want unlock use DEQUEUE Function Module.

Regards,