2013 Dec 17 5:39 AM
Hello Everybody
Greetings
I am new with authorization object. I know what are the steps to create it and use it. Currently i m working in a project in which there is a z transaction in which there are different option like Create, Change, 1st level approval and 2nd level approval. I want to give authorization of 'create and change' to one user and approval(1st and 2nd) to two different user. how can I achieve it?. what should be the approach?
Quick response will be highly appreciated.
Thanks and Regards
Virendra Singh Somwanshi
2013 Dec 17 6:29 AM
Hello Virendra,
Ex.
AUTHORITY-CHECK OBJECT 'Zxxxxx'
ID 'VKBUR' DUMMY
ID 'SPART' FIELD WA_FINAL-SPART
ID 'ACTVT' FIELD '03'.
IF SY-SUBRC NE 0.
MESSAGE 'NO AUTHORIZATION ' TYPE 'S'.
ENDIF.
Regards,
Philip.
Hello Virendra,
Ex.
AUTHORITY-CHECK OBJECT 'Zxxxxx'
ID 'VKBUR' DUMMY
ID 'SPART' FIELD WA_FINAL-SPART
ID 'ACTVT' FIELD '03'.
IF SY-SUBRC NE 0.
MESSAGE 'NO AUTHORIZATION ' TYPE 'S'.
ENDIF.
Regards,
Philip.
2013 Dec 17 6:09 AM
2013 Dec 17 6:41 AM
Thank for your quick response. Already checked this document. How should i use this document in my case?. In my case as soon as user double clicks on any botton(Create, change, Approval's) then there should be a check whether user is authorized or not?
Regards
Virendra Singh Somwanshi
2013 Dec 17 6:44 AM
Hi Virendra
Just for your understanding if each user is assigned with corresponding authorization object. Then in the PAI of your screen for various create/change/approval stuff you can implement authority check object mentioning the same object and activity value to check if use has authorization or not. Based on it you can display the messages
Nabheet
2013 Dec 17 6:13 AM
2013 Dec 17 6:48 AM
Thanks for the reply. My requirement is not based on tcode. In my case as soon as user double clicks on any botton(Create, change, Approval's) then there should be a check whether user is authorized or not?
2013 Dec 17 6:49 AM
2013 Dec 17 6:29 AM
Hello Virendra,
Ex.
AUTHORITY-CHECK OBJECT 'Zxxxxx'
ID 'VKBUR' DUMMY
ID 'SPART' FIELD WA_FINAL-SPART
ID 'ACTVT' FIELD '03'.
IF SY-SUBRC NE 0.
MESSAGE 'NO AUTHORIZATION ' TYPE 'S'.
ENDIF.
Regards,
Philip.
2013 Dec 17 6:57 AM
For understanding and clarification : In my case i have to create 3 authorization object?.
1st for create and change which i need to assign to 'SD' user.
2nd 1st level approval: this i will assign to 'Logistics' and 'CFO' user
and 3rd 2nd level approval : this i ll assign to 'CFO' user. Correct me If my understanding is wrong. or this can be achieve by one authorization object also.
2013 Dec 17 7:14 AM
You can create one auhtoization object no need to create three.
Create a data element with domain. Maintain individual value in domains as
01--> Create/Change
02--> First level
03--> Seconld level.
No need to create 3.
Nabheet
2013 Dec 17 8:19 AM
Hello Virendra,
Pay close attention to the Authority check statement syntax.
AUTHORITY-CHECK OBJECT auth_obj [FOR USER user]
ID id1 {FIELD val1}|DUMMY
[ID id2 {FIELD val2}|DUMMY]
...
[ID id10 {FIELD val10}|DUMMY].
The above statement checks whether an authorization exists for the user master record of current user or the user specified. (user in this case) If FOR USER is mentioned the user is checked whose username is mentioned in user.
NB: If no FOR USER specified the current user name is checked.
Regards,
Philip.
2013 Dec 17 7:51 AM
Hi Virendra,
take help from Basis team,
and write your code as shown below, they will set activity create = 1, display = 2, change = 3.
and in PAI write your code as below, in place of SY-TCODE = VA01, you have to write your Z txn code
for which you wants authorization, recently i did it.
Your basis team will also create object, that is to bo put in place of 'ZPALNT'.
This will surely solve your issue.
IF SY-TCODE = 'VA01' .
AUTHORITY-CHECK OBJECT 'Z_PLANT'
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 FOR .......' TYPE 'E'.
* ENDIF.
ENDIF.
ENDIF.
2013 Dec 17 11:00 AM
Thanks everybody for your help, authorization object created. Closing this thread.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |