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

authorization code

Former Member
0 Likes
1,075

Should we have to declare/define the authorization check before changing any value of the field in the code?

10 REPLIES 10
Read only

Former Member
0 Likes
962

Can you elaborate please? If the authorization objects are already created (they are not declared within the program), then all you have to do is


AUTHORITY-CHECK OBJECT 'XXXXXXX' 
                                         ID 'YY'
                                   FIELD 'ZZZZ'.

Read only

Former Member
0 Likes
962

it depends upon the requirement that we do authority check of the object to check if the user has the rights.

You may also click on 'PATTERN' button in abap editor and select authority-object radio button and give object name.

Thanks,

Santosh

Thanks,

Santosh

Message was edited by:

SKJ

Read only

Former Member
0 Likes
962

I was given the authorization code. Now plz tell me how to use this code to change the value of the fields??

Read only

0 Likes
962

Hi,

Your question is quite confusing .

let me tell what authorization code is.

Security in charge createsa authorization object and assigns to few users.

you as a developer have to call that authorization object in your program and if the user passes that authorization then he can move forward otherwise it should through a mess saying not authorized

now when you say you have been athorization code that sounds interesting to me . either it should be authorization object or authorization to particular authorization object

let me know wats the issue so that we can help you

hope iam not confusing you

thanks

venki

Read only

Former Member
0 Likes
962

Actually I have the authorization key. I would like to know how to use the B_USERSTAT object to give authorization for this authorization key....

Read only

Former Member
0 Likes
962

Plz somebody let me know how to go about it...

Read only

0 Likes
962

Hi Kanki,

Just copy and paste to your code at Event Initialization.

dont change anything except the Tcode

it will work


  DATA: v_object LIKE UST12-OBJCT VALUE 'S_TCODE' ,
        v_field  LIKE UST12-FIELD VALUE 'TCD',
        v_tcode  LIKE UST12-VON   VALUE 'ZWFP1'.   "<--------- chage to your Tcode

*& FUNCTION TO GET THE AUTHORITY CHECK
  CALL FUNCTION 'AUTHORITY_CHECK'                       "#EC ARGCHECKED
    EXPORTING
      user                = sy-uname
      object              = v_object
      field1              = v_field
      value1              = v_tcode
    EXCEPTIONS
      user_dont_exist     = 1
      user_is_authorized  = 2
      user_not_authorized = 3
      user_is_locked      = 4
      OTHERS              = 5.
*    -- If the user does not have proper authorization then display message
  IF sy-subrc <> 2.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    STOP.
  ENDIF.

Read only

Former Member
0 Likes
962

But where to use the authorization key that i have???? Plz clarify..

Read only

0 Likes
962

Insert this code in your program.


AUTHORITY-CHECK OBJECT 'B_USERSTAT'
         ID 'STSMA' FIELD '__________'
         ID 'OBTYP' FIELD '__________'
         ID 'BERSL' FIELD <your authorization key>
         ID 'ACTVT' FIELD '__________'.

Your authorization key will go against BERSL ID.