‎2010 Jan 20 8:38 AM
Hello,
I am new to SDN .
I got a requirement where i have to include an authorization check in programs this is required for all custom programs before they are added to roles . I am not sure what i have to do it .
These programs if i try to open in se38 , i cannot view them .
How do i include authorisation checks .
Please let me know step by step .
i will be grateful.
thanks
sumit
Edited by: sumit123 on Jan 20, 2010 9:52 AM
‎2010 Jan 20 8:57 AM
‎2010 Jan 20 8:59 AM
i have already searched in sdn , but cannot find answer fulfilling my specific requirement .
plzzzzzz help if you know
‎2010 Jan 20 8:59 AM
Hi Sumit,
It's quiet strange that you don't see custom reports through SE38, I am not sure what this issue is, But you can go to T-CODE SE80, Then select program from the drilldown button and enter your report name, Then see what it says.
Regarding Authorization object in ABAP reports, Please follw the below sample code for help.
REPORT demo_authorithy_check.
PARAMETERS pa_carr LIKE sflight-carrid.
DATA wa_flights LIKE demo_focc.
AT SELECTION-SCREEN.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'CARRID' FIELD pa_carr
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 4.
MESSAGE e045(sabapdocu) WITH pa_carr.
ELSEIF sy-subrc <> 0.
MESSAGE e184(sabapdocu) WITH text-010.
ENDIF.
Thanks
Saurabh
‎2010 Jan 20 9:01 AM
Hi,
when i go to se80 and write my program it says it does not exist .
what do i do .
‎2010 Jan 20 9:02 AM
Hi Sumit,
http://help.sap.com/saphelp_nw04s/helpdata/en/52/67129f439b11d1896f0000e8322d00/content.htm
Check this link.
The following actions are authorization checks that are performed before the start of a program or table maintenance and which the SAP applications cannot avoid: .
1.Starting SAP transactions (authorization object S_TCODE)
2.Starting reports (authorization object S_PROGRAM)
3.Calling RFC function modules (authorization object S_RFC)
4.Table maintenance with generic tools (S_TABU_DIS)
Authority check is done to restrict the execution of a report to certain users.
Basis creates a authorisation group , includes certain roles in it, to which authorisation should be given.
If one's id has that role then he is authorised to execute the report..
IN the report the below code is written to do auth. check
Authority check on plant
AUTHORITY-CHECK OBJECT 'ZMMD_PROD'
ID 'WERKS' FIELD wf_werks.
Here authorisation is done on plant. and the authorisation object is ZMMD_PROD(to be created by BASIS)
‎2010 Jan 20 9:06 AM
thanks kumar,
so do i have to perform the 1st four steps that u have said .
how do i do them , can u explain step by step like what t-code to use etc,
sumit
‎2010 Jan 20 9:07 AM
Hi Sumit,
It clearly states that reports that you are looking in SAP system doesnot exsist, First create those reports then do Authorization object coding in those reports.
When ever you create any report in SAP system it's entry gets updated in table "TADIR", JUst go to SE11 and enter"TADIR" table name there go to the contents and enter your report name in field "OBJ_NAME", IF it doen't shows any thing then your report doesn't exsist in SAP system,
Thanks
Saurabh
‎2010 Jan 20 9:09 AM
hi saurab,
i checked in TADIR and the program exists , now how do i include the authorisation checks .
thanks for helping me out so far
‎2010 Jan 20 9:11 AM
Hello Sumit,
Ask the basis Guys...They can get you rid of this.
‎2010 Jan 20 9:09 AM
Hi Sumit,
Those 4 steps are required afterwards, Your issue at this stage is to find your custom reports which you are not been able to find.
Thanks
Saurabh
‎2010 Jan 20 9:13 AM
Hi Sumit,
If it exsist in "TADIR" then check for what value is there in the databse for "OBJECT" field corresponding to your report, this will help you to find out that what kind of report is this. then we can work upon authorization object.
Thanks
Saurabh
‎2010 Jan 20 9:16 AM
‎2010 Jan 20 9:22 AM
Hi Sumit,
Then It's a Transaction code not a report, If you want to find the Custom report attached to this T-CODE then go to TCODE se93 and enter your "TCODE" then press display it will give your report name attached to that transaction,
Then follow the code that i mentioned previously to add authorization code.
Thanks
saurabh
‎2010 Jan 20 9:27 AM
thanks a lot saurabh,
now do i follow the
REPORT demo_authorithy_check.
PARAMETERS pa_carr LIKE sflight-carrid.
DATA wa_flights LIKE demo_focc.
AT SELECTION-SCREEN.
AUTHORITY-CHECK OBJECT 'S_CARRID'
ID 'CARRID' FIELD pa_carr
ID 'ACTVT' FIELD '03'.
IF sy-subrc = 4.
MESSAGE e045(sabapdocu) WITH pa_carr.
ELSEIF sy-subrc 0.
MESSAGE e184(sabapdocu) WITH text-010.
ENDIF.i do not need to make any chnages in the sample code.
i am the beginner , where do i need to add these codes
sorry if i ask basic questions
‎2010 Jan 20 9:33 AM
‎2010 Jan 20 9:36 AM
hi kumar,
i am in SE93 and i cannot see any selection screen event
plz help
‎2010 Jan 20 9:41 AM
Sumit,
Go to SE93. Enter the T-Code.
Press enter.
You can get the program name.
Double click on that name or else copy paste it and go to SE38.
display
Search the event and work accordingly.
Thanks,
Manas
‎2010 Jan 20 9:47 AM
Hi Kumar,
i really aprreciate your help..i managed to get the name of the program and now starting to add those codes .
let me see how it works
thanks once again .
i will come back once it is done
sumit
‎2010 Jan 20 10:03 AM
hi kumar,
when i write those lines of codes i get error saying " statment not allowed between form routine and selection screen "
what do i do .
plz help
Edited by: sumit123 on Jan 20, 2010 11:22 AM
‎2010 Jan 20 10:28 AM
May be you are inserting your code at some incorrect places.
Place it below AT SELECTION SCREEN EVENT.
‎2010 Jan 20 10:33 AM
just to double check i am writing the below code:-
AUTHORITY-CHECK OBJECT 'S_TCODE'
ID 'TCD'
FIELD 'here i write my y-transaction code'
IF SY-SUBRC NE 0 .
ENDIF.
Please let me know if i am right
thanks a lot so far.
sumit
‎2010 Jan 20 10:36 AM
Dear Sumit123,
Kumar Manas Mishra has been very patient with you. All credits to him. But, it sounds to me that you don't know the first thing about ABAP (sorry if I put it this way). This is an expert forum, in which certain questions can be posted in case you get stuck somewhere along the line. The forum is not intended for getting someone (like Kumar) to write you a whole report.
These kind of questions will get your account locked by moderators.
All the best,
Micky.
‎2010 Jan 20 10:39 AM
Hi Micky,
What you said is exactly right.
But spoon feeding happens here a lot.
‎2010 Jan 20 10:40 AM
Sample code snippet:-
FORM AUTHORITY_CHECK.
AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
ID 'VKORG' FIELD P_VKORG
ID 'VTWEG' DUMMY
ID 'SPART' DUMMY
ID 'ACTVT' FIELD '03'.
IF SY-SUBRC NE 0.
MESSAGE E016 WITH P_VKORG 'Try another Sales Organization'.
EXIT.
ENDIF.
ENDFORM.
Go through the below Link
help.sap.com/saphelp_nw70/helpdata/EN/52/.../content.htm