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 object

Former Member
0 Likes
1,295

Hi,

I have to add authorization to a z transaction in the dialog program.The user should be able to open the transaction only if the value is 'Y' in the database table for the user.Please suggest how should I do it.

11 REPLIES 11
Read only

Former Member
0 Likes
1,242

Hi,

You can use the FM ' AUTHORITY_CHECK'

.

Read only

Former Member
0 Likes
1,242

Check this thread :

Regards,

Deepthi

Read only

Former Member
0 Likes
1,242

Hi,

You can try something like this.

IN your PBO section.

module check.

In main program

module check.

select single <fieldname> from <your table> into v_y where <user name> = sy-uname.

if not v_y = 'Y'

message e000(zz) with "NO authorization'. "Message class zz and message 000 should be created

endif.

endmodule.

Read only

Former Member
0 Likes
1,242

Hi,

May be for the mentioned user the authorization for the authorization object S_TCODE is given with Y*.

If so, then we need to add the newly created in the above authorization object.

If it does not resolve the issue, then once the user is able to see the error message, No authorization.

Ask the user to send the screen shot of SU53, it will have the details like for which authorization is failed etc..

Regards,

Santhosh.

Read only

Former Member
0 Likes
1,242

This message was moderated.

Read only

Former Member
0 Likes
1,242

Hi,

I think in ur dialog prg z transaction is called. If u have added that tcode in authorisation code then before calling that tcode

See the below example.

First u check with ur database table if value is 'Y'.

then give

AUTHORITY-CHECK OBJECT 'S_TCODE'

ID 'TCD' FIELD 'ZRES'.

IF sy-subrc EQ 0.

CALL TRANSACTION 'ZRES' .

ELSE.

MESSAGE 'You are not authorised for ZRES' TYPE 'E'.

ENDIF.

Regards,

Yog

Read only

Former Member
0 Likes
1,242

HI Sunil,

Do below

* Variable declaration
  DATA l_tcode TYPE sy-tcode.          " Transaction code variable

  CLEAR l_tcode.
* Authorization Check For T Code
  SELECT tcode                         " Transaction code
           INTO l_tcode
           FROM tstc
           UP TO 1 ROWS
          WHERE pgmna = sy-repid.    "Here your z-trascaton will come...
  ENDSELECT.
  IF sy-subrc EQ 0.
    AUTHORITY-CHECK OBJECT 'S_TCODE'    "This object is need to created by BASIS
                        ID 'TCD' FIELD l_tcode.
    IF sy-subrc NE 0.
      MESSAGE e172(00) WITH l_tcode.   "display of the errro message.
    ENDIF.                             " IF sy-subrc NE 0
  ENDIF.                               " IF sy-subrc EQ 0

it works

Thanks

Read only

Former Member
0 Likes
1,242

Hi Sunil Kumar20 ,

Welcome to SDN, to do so first go to PFCG T-code and create a new role,

Once you have created, click Menu tab and You can see click Transaction button to add your Ztcode..

And in Authorization tab click on Change Authorization Data it will create a Profile name automatically, then generate Profile by Shift + F5.

Then in User Tab give the user who has to access that T-code thats it, he only can acess it.

Regards,

Suneel G

Read only

Former Member
0 Likes
1,242

Hi Sunil,

You can create Authorization Class in SU03 and assign it to new ztcode.

Then ask Basis / Security team to create a new role and assign to the required users by providing them the authorization class and newly created tcode.

Thanks & Regards,

Ramya.

Read only

Former Member
Read only

Former Member
0 Likes
1,242

<<copy&paste_removed_by_moderator>>

Edited by: Vijay Babu Dudla on Apr 29, 2009 6:43 AM