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

Lock a program

Former Member
0 Likes
1,070

Dear all,

For my case, i've a main program(Prog AAA) and subprogram(Prog BBB). Where user will execute prog AAA, in turn it will schedule prog BBB to run in background by using FM BP_EVENT_RAISE.

Now the prob is happen on prog BBB, where it does perform BDC transaction update. And i want to place a lock on prog AAA to block someone to execute prog AAA at the same time. And i will release the lock in prog BBB to reach a consistence stage.

This is what i plan to do:

Prog AAA:

...Place lock by passing in program name AAA as lock argument.

Prog BBB:

...BDC code for transaction update

...

...Release lock with argument program name AAA.

Basically i did tried to place the lock in prog AAA by using FM ENQUEUE_E_TABLE, 'AAA' as lock argument. But too bad because the lock will be released by system once prog AAA finish.

So i would like to check with you if there any FM or tools that can be used to retain the lock till i explicitly dequeue it?

Please comment.

8 REPLIES 8
Read only

Former Member
0 Likes
1,025

Hi,

If I understand correctly, you are scheduling and running program BBB as a backgroud job.

You could read at the beginning of program AAA whether the job is still active and in that case block further processing of program AAA.

Have a look at Function group BTCH for FM's on batch jobs.

For example FM 'BP_JOB_CHECKSTATE'

Kind Regards

Read only

Former Member
0 Likes
1,025

Hi abc efc,

you can use ENQUEUE_ESFUNCTION function module to lock program and DEQUEUE_ESFUNCTION function module to unlock it.

Regards

Anup.

Read only

0 Likes
1,025

Dear all,

I did tried on both FM ENQUEUE_E_TABLE and ENQUEUE_ESFUNCTION, it doesn't work. I have tried to used locking scope 1/2/3/, no luck.

I want to place a lock at the begining execution of prog AAA by using lock argument "AAA", where the unlock will be placed at last stage of prog BBB. Purpose is to ensure a consistent stage of update at prog BBB, because prog AAA can be executed more than 1 time within the single minute.

Prog AAA is to call the event(as i mentioned in my first post) to schedule prog BBB run in background, then prog AAA will finish its own part and then transaction end. Since the dialog step end, regardless of what scope value i used (either 1/2/3) system will release the lock automatically.

For my case, i want the lock retain and it will be release by prog BBB.

Could you please comment..

Thanks in advance.

Read only

0 Likes
1,025

Hi,

Plase try the T-Code SU21 for creating authorisation object and class.

-


Shiny S Krishna

Read only

0 Likes
1,025

Hi Shiny,

May i know how does authorization object relate to my case here?

Read only

0 Likes
1,025

Hi,

1. Create an authorisation class eg: ZCLAS

2. Create an authorisation object for class eg: ZOBJ. In the

authorisation object creation give the transaction code

for which the lock is required and give the activity code.

3. During the role assignment of the user in SPRO, give the

authorisation object.

-


Regards,

Shiny S Krishna

Read only

0 Likes
1,025

Hi Shiny,

Thanks fot your reply, however i think you misunderstood my problems and questions.

Gentleman, do you have any idea? Please comment.

Read only

Former Member
0 Likes
1,025

Hi,

Maybe I was not clear in my first answer.

When running Prog AAA check whether Prog BBB (or the job where BBB is triggered) is already running.

If BBB is active then just give a message to the user that prog BBB is active and prevent further processing of prog AAA.

Kind Regards