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

include an authorization check in program

Former Member
0 Likes
5,729

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

24 REPLIES 24
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
3,558

Please search in SCN.

Read only

0 Likes
3,558

i have already searched in sdn , but cannot find answer fulfilling my specific requirement .

plzzzzzz help if you know

Read only

Former Member
0 Likes
3,558

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

Read only

0 Likes
3,558

Hi,

when i go to se80 and write my program it says it does not exist .

what do i do .

Read only

0 Likes
3,558

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)

Read only

0 Likes
3,558

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

Read only

Former Member
0 Likes
3,558

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

Read only

0 Likes
3,558

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

Read only

0 Likes
3,558

Hello Sumit,

Ask the basis Guys...They can get you rid of this.

Read only

Former Member
0 Likes
3,558

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

Read only

Former Member
0 Likes
3,558

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

Read only

0 Likes
3,558

object type is TRAN

Read only

Former Member
0 Likes
3,558

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

Read only

0 Likes
3,558

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

Read only

0 Likes
3,558

Below AT SELECTION SCREEN EVENT....

Read only

0 Likes
3,558

hi kumar,

i am in SE93 and i cannot see any selection screen event

plz help

Read only

0 Likes
3,558

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

Read only

0 Likes
3,558

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

Read only

0 Likes
3,558

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

Read only

0 Likes
3,558

May be you are inserting your code at some incorrect places.

Place it below AT SELECTION SCREEN EVENT.

Read only

0 Likes
3,558

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

Read only

0 Likes
3,558

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.

Read only

0 Likes
3,558

Hi Micky,

What you said is exactly right.

But spoon feeding happens here a lot.

Read only

0 Likes
3,558

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