cancel
Showing results for 
Search instead for 
Did you mean: 

Function module to lock a DP Planning Area

Former Member
0 Kudos

Hi gurus,

We have a macros in DP that will be executed in background. While these macros will be runnning we want to lock another Planning Area, to avoid that somebody changes the values. Our idea is to have a backgournd job with the following steps:

- Lock planning area A

- Run macros in planning area B

- Unlock planning area A

I was trying to do so using the FM ENQUEUE_/SAPAPO/E_PAREA and DEQUEUE_/SAPAPO/E_PAREA, but until now it only works for SNP Planning areas, and not for DP PA. Does anybody know what FM can I use to lock a DP planning area?

Thanks a lot in advance!!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Gyongyi,

The fucntion module which i gave you is working perfectly for me.

Which version are u working? If possible cut and paste me the code, I can have a look at it and let you know.

Thanks,

Siva.

Reward points if helpful.

Former Member
0 Kudos

Hi Siva,

Right now I am just testing the FM using SE37.

Find below the steps that I did:

- Execute FM /SAPAPO/TS_DM_LOCK with:

- name of the Planning Area in IV_PAREAID

- Planning version (9AVERSION) in IT_SELECTION

This creates three entries in SM12 with the following table names:

/SAPAPO/DM_PAREA_LOCK2_001

/SAPAPO/DM_PAREA_LOCK2_002

/SAPAPO/DM_PAREA_LOCK2_003

- Execute FM /SAPAPO/TS_DM_UNLOCK with:

- name of the Planning Area in IV_PAREAID

- Planning version (9AVERSION) in IT_SELECTION

But unfortunately it does not unlock anything... the same entries remain in SM12...

Thanks again!

Former Member
0 Kudos

Hi again,

Finally I am using the FM /SAPAPO/TS_DM_LOCK_UNLOCK and it works.

Thanks for your help.

Former Member
0 Kudos

Hi Gyongyi & Siva,

I am also using same function module in my program to Lock Unlock Planning Area, however what if a User is already in Change mode while this program runs to Lock planning area, program fails in my case.

How is its behaviour in your case.

Will appreciate your response to it.

Thanks

~Prashant

Former Member
0 Kudos

Hello Gyongyi,

I am trying to use /SAPAPO/TS_DM_LOCK_UNLOCK in the process chain such that no user should lock the data until the process chain completes.Otherwise, the PC fails.

I am really excited to know how it is successful in your case.

Following is the steps.

1. At the beginning of the PC, I am logging off all users.

2. Right after that the PA area is locked by batchuser ID.

3 At the end of the PC, I am calling another program (same FM with unlock parameters) to unlock the PA along with the batchuser ID.

But, things are not working as explained above.

Below is my observation.

1. In case PC fails due any other issue like data, then lock will be released. I accept this as it is the nature of FM.

2. Once the locking is done, other activities are executing and to test, I am checking whether I am allowed to edit data in planning book. I realize that I am able to. But sometimes I also got message like Data Locked by BatchUser ID.

I am totally confused. Can I get some help as it is an urgent for me?

Former Member
0 Kudos

can any one comment on this please?

Former Member
0 Kudos

Hi,

Try out this function module.

/SAPAPO/TS_DM_LOCK

/SAPAPO/TS_DM_UNLOCK

Regards,

Siva.

Former Member
0 Kudos

Hi Siva,

Thanks for your reply!

I have tested FM /SAPAPO/TS_DM_LOCK and it works perfect. In my case I have locked a planning version of the planning Area A. The only thing is that when I have excuted the FM /SAPAPO/TS_DM_UNLOCK it does not delete the previous lock entries generated by FM /SAPAPO/TS_DM_LOCK.

So at the end the Planning Area remains locked. I have seen that there is another FM (/SAPAPO/TS_DM_LOCK_NEW) but the corresponding UNLOCK FM (/SAPAPO/TS_DM_UNLOCK_NEW) unlocks everything that was locked for an specific user, you can not select the corresponding version.

Any ideas will be very much appreciated.

Thanks again for your help!