‎2009 Apr 29 9:37 AM
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.
‎2009 Apr 29 9:42 AM
‎2009 Apr 29 9:47 AM
‎2009 Apr 29 9:48 AM
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.
‎2009 Apr 29 9:48 AM
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.
‎2009 Apr 29 9:49 AM
‎2009 Apr 29 9:49 AM
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
‎2009 Apr 29 9:50 AM
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 0it works
Thanks
‎2009 Apr 29 9:51 AM
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
‎2009 Apr 29 9:56 AM
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.
‎2009 Apr 29 10:03 AM
Refer this link,
http://help.sap.com/saphelp_bw21c/helpdata/en/52/6712ac439b11d1896f0000e8322d00/frameset.htm
Regards,
Joan
‎2009 Apr 29 11:02 AM
<<copy&paste_removed_by_moderator>>
Edited by: Vijay Babu Dudla on Apr 29, 2009 6:43 AM