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

Run Time Authorization

former_member375795
Participant
0 Likes
1,710

How to give Run time authorization

Scenarios Like that

Username  --- Alok1

            ( Not having a authorization to Change material details )

but

There is a  zprogram  Username - ALOK1  having authorization to use but in ZPROGRAM  contain MM02 to change the material how i give runtime Authorization to user ALOK1 to zprogram->MM01

9 REPLIES 9
Read only

Former Member
0 Likes
1,504


hi alok,

              you have to maintain the authrozation object for that in t-code su21.

later you have to provide this in to the user role of required user .

after that in coding part of your program.

you haver to do like that.

at selection-screen.

         AUTHORITY-CHECK OBJECT 'ZSSS'
           ID 'VKBUR' FIELD VKBUR-LOW
           ID 'ACTVT' FIELD '16'.
  IF SY-SUBRC NE '0'.

          MESSAGE I0001

ENDIF.

hope it helps.

vikas

Read only

Former Member
0 Likes
1,504

Please check T-CODE SE97.

BR,

Prakash

Read only

former_member187748
Active Contributor
0 Likes
1,504

Hi Alok,

talk to your basis person, and ask if any standard object exits for MM01 or MM02,

if the persists on it,  you can make a change in your zprogram to restrict user

for any transaction, if they are not able to configure any standard object, then please

talk to them to create a zobject in SU21 tcode.

Now you can use this zobject in your zprogram , to restrict or use particular user.

The basis guys generally provides authorization, so they will provide it in SU21

transaction.

The general for of authorization check is as shown below

  IF SY-TCODE = 'MM01' .

    AUTHORITY-CHECK OBJECT 'your zobject name'

                                 ID 'ACTVT' FIELD '01'

                               id 'ACTVT' field '02'

                               id 'ACTVT' field '03'

                                 ID 'WERKS' FIELD VBAP-WERKS.

   IF SY-SUBRC EQ 0.

    ELSE.

MESSAGE 'YOU ARE NOT AUTHORISED ' TYPE 'E'.

      MESSAGE E000(ZMSGCLASS) WITH VBAP-WERKS.

          ENDIF.

    ENDIF.

Here activities are like change, display, etc

Read only

former_member183073
Active Participant
0 Likes
1,504

Hi Alok,

You want to allow user to access MM02 even though the user doesnt have authorization to it.

you cannot do that even though you write code and allow only specific users through zprogram they still need to have access to MM02 because the SAP will again check the Authorization before starting the Transaction

Read only

0 Likes
1,504

Hi Ali,

if i am not wrong user does not have authorization for MM02, but can get authorization for MM01

through zobject, if he has not authorization for MM01 at all, then its not possible to assign authorization

through any code.

Read only

0 Likes
1,504

Didnt get you Sanjeev,

If user dont have authorization to a transaction, how can you allow it to be accessed by code. There will Standard Code for Authorization which executes each time you call a Transaction.

Read only

0 Likes
1,504

Hi Syed,

i means to say that, if user have no authorization at all, we can't provide it through our custom code.

But in this case user don't have authorization for MM02, but he can get authorization for MM01

and it can be (for MM01) controlled through our custom program

Read only

0 Likes
1,504

I stated your first point in my earlier reply..

Read only

ThangaPrakash
Active Contributor
0 Likes
1,504

Hello Alok,

You can try to do the coding as suggested by

It will work I guess. Please refer the below link for the list of authorization objects for Material master.

Maintain Authorizations and Authorization Profiles (SAP Library - Material Master)

Regards,

TP