cancel
Showing results for 
Search instead for 
Did you mean: 

Ristricting user for enter into a perticular SNP planning area during job run

Former Member
0 Kudos

Hi All,

SNP Background jobs are cancelling due to user locking issues, we planned for ristricting users for logging into planning books during jobs run.

But we want to ristrict users for 1 pertucilar planning area only, We have 2 SNP planning areas from that we want to ristrict users to enter for 1 perticular planning area only during jobs run.

Here how to lock to a perticular planning area, we can ristrict to enter into t.code /SAPAPO/SDP94, but it will lock users who are using other (second )planning area, that we do not want.

Can you please tell a technical idea on how to achive this.

BR / Kishore

Accepted Solutions (1)

Accepted Solutions (1)

satish_waghmare3
Active Contributor
0 Kudos

Hello Kishore,

In the past I have handled similar requirement by developing the custom program to Lock and then to Unlock users.

Program used to be scheduled twice, once before start of the background job to inform users about BG job, kick off users from Planning Group out of APO and lock Planning Group. Later second scheduled run after BG Job to unlock the Planning Group.

You can check if Planning users logged in SAP system using FM TH_LONG_USR_INFO, if logged in send a Message using FM TH_POPUP, about BG job which would start in 'X' mins.

Delete Planning group users from SAP through FM TH_DELETE_USER

To Unlock Planning areas using FM '/SAPAPO/TS_DM_UNLOCK'

Below link will provide some helpful information on above three Function Modules .

Delete SAP session using ABAP code and function modules TH_USER_LIST and TH_DELETE_USER


Following tables will be useful while developing the code.

Table : /SAPAPO/TSAREAKO : Planning Area and Lock field details
Table : USGRP_USER             : Assignment of Users to User Groups

Besides you can refer this thread :    Function module to lock a DP Planning Area | SCN

Hope this will help.

Thank you,

Satish Waghmare

Former Member
0 Kudos

Thanks very much Satish for your inputs and Happy new year.

I was on vacation so could not able to reply immideately.

I have given the inputs to our ABAPer, I am waiting for his actions, mean while I just want to ask you is can we able to block only one perticular planning area from a set of planning areas, based on the inputs you have given.

BR / Kishore

.

Former Member
0 Kudos

Hi Again,

My reqorement is I have 2 Planning area A & B, I want to lock only one planning area A and my jobs also will run on the same Planning area (A).

Means Planning area should be open for background user and should be locked for other users during job run.

BR / Kishore

babu_kilari4
Active Contributor
0 Kudos

Hi Kishore,

You can lock one planning area using /SAPAPO/TS_DM_LOCK while the other planning area can be still be open for users. Locks are usually set at the whole planning area level. It means if your background user is able to acquire the lock, he will be able to do all the background operations whereas no other user can lock the planning area during this instance. Hope this helps.

Babu Kilari

satish_waghmare3
Active Contributor
0 Kudos

Hi Kishore,

Yes, the details which I had shared with you can help you lock specific planning area. In fact you can design a selection screen having Planning Area as one of the criteria for Locking and Unlocking.

So screen can have -

Two Radio Buttons  For Lock and Unlock Option

And

Selection with Multiple Entry Option for Planning Area

Selection with Multiple Entry Option for User Group

This kind of screen should help you take care of the scenarios. You can make use of the FM and table mentioned above to develop this Z program.

Sample code for these FM can be easily available for looking at Where Used List using SE37. As lot of standard SAP programs use these FMs in their code to lock and Unlock the planning area.

Exmaple :  /SAPAPO/TS_LCM_CONS_CHECK  Planning Area Consistency Check

Hope this will help.

Thank you

Satish Waghmare

Former Member
0 Kudos

Hi Satish,

Thanks again.

I am able to send popup to the users who are locked into the planning book.

and I am able to lock the planning area but after locking it is not allowing background job also for executing the job.

Job is cancelling and log is saying that planning area is locked.

planning area should lock but it should be open for the background user.

can you please help here.

Thanks in adavnce.

BR / Kishore

Former Member
0 Kudos

Hi Again,

Initially when I worked with FM , it was not locked planning book but it was locked me to enter into TLB view in change mode then I have activated "Activate liveCache Lock" in the plannig area, then it locked the planning book also after locking through FM but it locked for the background jobs also.Then Jobs are cancelling

BR / Kishore

satish_waghmare3
Active Contributor
0 Kudos

Hi Kishore,

If you refer my 1st answer to your question, I have mentioned about Table : USGRP_USER             : Assignment of Users to User Groups. You need to lock only the end users who will be part of some user group(please check), and not the IT support and Background Users.

Please lock only necessary user group.  Please consult person from Security Team in your project.

Also Program Selection Screen which I had proposed, I have mentioned option to select the particular user group and planning area.

---->

"Selection with Multiple Entry Option for User Group"

<----

Please try and avoid any hardcoding in the program code, instead use the selection screen for the program.

This should help you develop complete program and kind of reusable asset.

Hope this will help.

Thank you

Satish Waghmare

Former Member
0 Kudos


Hi Satish,

Thanks very much for your advice so far.

We have done the coding and which is working but we find one bug.

we are giving a pop up message to user if he is locking the planning book, and program is killing if he not comming out of the planning book.

But if he is comming out of planning book after the pop up message, program is still killing the session.

and program is killing all the sessions. Any idea to kill only one perticular session which is in planning book with change mode.

Thanks in Advance

BR / Kishore.

Former Member
0 Kudos

and how to stop killing sessions if user is comming out of planning book after the popup.

BR / Kishore

satish_waghmare3
Active Contributor
0 Kudos

Hello Kishore

Program should be looking for only these kind of locks -->  /SAPAPO/DM_PAREA_LOCK. Please refer below SM12 screenshot.  Lock argument shows the Planning Area and other selection details in this screen. You should not end the session for all other users.  This should be limited to locks for your planning area having table name /SAPAPO/DM_PAREA_LOCK.

Hope this will help.

Thank you

Satish Waghmare

Former Member
0 Kudos

Hi Satish,

One last question.

When our ABAPer is using the locking functional module it locking but locking is releasing when we come out of the FM.

FM: /SAPAPO/TS_DM_LOCK

      /SAPAPO/TS_LC_LOCK

Do you have faced same issue in your system while developing.

BR / Kishore

Former Member
0 Kudos

Hi Again,

It will great if you send the entire code you have used to lock the Planning area.

Thanks in advance.

BR / Kishore

Former Member
0 Kudos

Hi Again,

We are stugling to pass user group in the coding, could you please send me the code on how to pass user group the program coding.

Thanks in advance.

Kishore

satish_waghmare3
Active Contributor
0 Kudos

Hello Kishore,

I wish I could provide you the code. I had worked on this requirement in Oct-2011, whatever I remember I am sharing with you.  I do not have any ABAP code or specifications, but kind of have the understanding of overall design and technicalities.

Regarding your question,

Assumption, you have maintained the User Group in the selection screen of program

To get a list of Users for Planner Group you need to query this table USGRP_USER with a value from Selection Screen of the program.

I believe this FM was used -  TH_LONG_USR_INFO as well.

Hope this will help.

Thank you

Satish Waghmare

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Kishore,

Usually  the background jobs run outside business hours. If this is your case you can check with basis team to change through transaction RZ10 parameters rdisp/gui_auto_logout (number of seconds of inactivity that must elapse before a user is automatically logged off) and rdisp/max_wprun_time, which restricts the maximum runtime of a dialog work process.

Best regards,

Leonardo