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: 

Record Locking when using BAPI

Former Member
0 Kudos

Hi All,

Just wondering if any of you have come across this before.

We have a bespoke program that runs in the background as a scheduled job and it reads data from a flat file on the network, it then proceeds to call the BAPI (BAPI_PLANNEDORDER_CHANGE) and directly after that I use BAPI_TRANSACTION_COMMIT (with no WAIT time) but the record is locked, we presume its because the current PO in the ITAB is the same as the previous row, but maybe it because of some other reason. Any suggestions??

Kind Regards.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi conor,

1. I don't know whether i understood ur question properly !

2. U are reading from flat file, into internal table.

3. Loop at itab.

Call BAPI_PLANNEDORDER_CHANGE

call BAPI_TRANSACTION_COMMIT

endloop.

4. Use the above logic,

(ie , with each loop pass, use commit)

regards,

amit m.

7 REPLIES 7

Former Member
0 Kudos

Hi conor,

1. I don't know whether i understood ur question properly !

2. U are reading from flat file, into internal table.

3. Loop at itab.

Call BAPI_PLANNEDORDER_CHANGE

call BAPI_TRANSACTION_COMMIT

endloop.

4. Use the above logic,

(ie , with each loop pass, use commit)

regards,

amit m.

former_member188685
Active Contributor
0 Kudos

Hi,

May be some one else is editing the order at the same time.

are you sure that same order is there is next record.

is it the same case with rest of the orders

i mean for the repeated orders.

regards

vijay

0 Kudos

Hi There,

1. Vijay, Because of the time that this job runs (schedule time) there are no users on the system and it highly unlikly that another job is processing that PO. There are other occurances where the PO is repeated and thease rows process through fine.

2. Amit, this is what I am doing only I dont specify a COMMIT-WORK because the BAPI_TRANSACTION_COMMIT takes care of that.

It look like maybe the system was a bit to fast for my program, will have to get some more processing going on.

Thanks for you help, points on the way

0 Kudos

hi ,

Before calling the BAPI just try to lock that purchase order using EKKOE lockobject if you can able to lock sucessfully then release the lock and call the bapi.

if you are unable to lock then keep it in loop till that po is unlocked and then call the bapi.

0 Kudos

Hi Rajkumar,

This is very useful never thought of that I will investigate this further in the mean time how do you use the EKKOE lockobject ?

Best Regards

0 Kudos

hi conor,

You can use EKKOE lock object by calling function module ENQUEUE_EKKOE. For this you pass the PO number which you want to lock. For releasing the lock same DEQUEUE_EKKOE function module.

0 Kudos

Hi Rajkumar,

This really helpful thanks for this.

Best regards,

Conor.