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

parallel processing of prg - avoid duplication.

Former Member
0 Likes
1,705

Basically my program submits the file path into another program and file get executed there. The program basically creates the Sales order for the corresponding PO in the file.

Parallel processing :

I opened my program in two parallel sessions .

I used the same file path/test file which creates sales order for the corresponding PO number in the file.

And ran two parallel sessions for the same program with this same file path/test file yet a time. And two sales orders were created for the same PO number.

But we donu2019t need this. We should make sure that duplicate sales orders for one corresponding should not get created. For that reason, we are checking in the middle of the program vbak entry and if there is no entry in vbak table then we are collecting SO data using bapi to create SO and at the end we are writing commit which creates SO. But this is not fulfilling the purpose of duplicate SO creation.

Because incase of parallel processing the program in each sessions checking the vbak entry where there is no entry u2026then creating sales order info and finally both sessions are u201Ccommitu201D executed and so that two Sales orders are getting creatred.

In this case, can I put file lock

Is there any way by which we can set up a lock at the file so that it cannot be used by another session if it is already in use by one session?

Thanks in ADVANCE.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,185

Hi Jai,

the links you have given are table locks.

By looking that I did not get idea of how to lock the program.

Can I get the code to lock and unlock the program so that the when ever the program runs in parallel session will abort or wait. ?

THANKS IN ADVANCE.

7 REPLIES 7
Read only

former_member156446
Active Contributor
0 Likes
1,185

rather than providing a lock to file, how about locking the program not to execute in parallel sessions?

[this link should help u|http://help.sap.com/saphelp_nw04/helpdata/EN/7b/f9813712f7434be10000009b38f8cf/content.htm]

Edited by: Jay Sadaram on Oct 29, 2008 11:50 AM

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,185

Just perform an exclusive lock on whatever unique object on your system (freedom) so only one instance will get the lock, and others will be waiting or abort.

In your case put on an exclusive lock on the purchase order, (lock object EMEKKOE)

Regards

Read only

Former Member
0 Likes
1,185

Could you please explain/guide me with the code like how can I lock the whole program or part of the program.

Thanks for your replies.

THANKS AGAIN,

Read only

0 Likes
1,185

hi sam refer to this[ link its neatly explained|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21eebf446011d189700000e8322d00/frameset.htm]

Read only

Former Member
0 Likes
1,186

Hi Jai,

the links you have given are table locks.

By looking that I did not get idea of how to lock the program.

Can I get the code to lock and unlock the program so that the when ever the program runs in parallel session will abort or wait. ?

THANKS IN ADVANCE.

Read only

0 Likes
1,185

To lock

- the program (one job processed at a time) - use FM [ENQUEUE_ESRDIRE|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=enqueue_esrdire&adv=false&sortby=cm_rnd_rankvalue],

- the purchase order (one job per purchase order at a time) - use FM [ENQUEUE_EMEKKOE|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=enqueue_emekkoe&adv=false&sortby=cm_rnd_rankvalue]

For lock concept look at [The SAP Lock Concept (BC-CST-EQ)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCSTEQ/BCCSTEQ_PT.pdf] or [Function Modules for Lock Requests|http://help.sap.com/saphelp_nwpi71/helpdata/en/cf/21eebf446011d189700000e8322d00/frameset.htm], both locks will be released by COMMIT/ROLLBACK WORK or explicit call of DEQUEUE FM,

Regards

Read only

Former Member
0 Likes
1,185

understand.

means if we lock ....on some thing , it unlock automatically after commit or rollback statement.

One question is

in my scenario the where/on what can I put the lock. I totally don't understand this.

Could you please help me with the required code also because i am not good in lock and unlock ..FMs

THANK YOU Sir