‎2007 Mar 06 9:22 PM
Should we have to declare/define the authorization check before changing any value of the field in the code?
‎2007 Mar 06 9:29 PM
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'.
‎2007 Mar 06 9:30 PM
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
‎2007 Mar 06 10:01 PM
I was given the authorization code. Now plz tell me how to use this code to change the value of the fields??
‎2007 Mar 06 10:06 PM
Check this program:
http://www.guidancetech.com/people/holland/sap/abap/zzbgs101.htm
And these links:
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbaccb35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_46c/helpdata/en/52/6712ac439b11d1896f0000e8322d00/content.htm
http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/authorit.htm
http://www.sap-img.com/abap/checking-user-authorizations-in-your-abap-program.htm
Thanks,
Santosh
‎2007 Mar 06 10:07 PM
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
‎2007 Mar 07 4:34 PM
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....
‎2007 Mar 07 6:11 PM
‎2007 Mar 07 6:20 PM
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.
‎2007 Mar 07 6:26 PM
But where to use the authorization key that i have???? Plz clarify..
‎2007 Mar 07 7:35 PM
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.