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

AUTHORITY-CHECK before Selection-screen?

Former Member
0 Likes
3,166

Hi,

i want to check the authority before the selection-screen. I do it in this way:


AT SELECTION-SCREEN OUTPUT.
*
  AUTHORITY-CHECK OBJECT 'Z_REPORT'
           ID 'PROGRAM' FIELD SY-REPID
           ID 'ACTVT'   FIELD '16'. "Ausführen
*
  IF SY-SUBRC <> 0.
    MESSAGE E010 WITH 'Keine Berechtigung für Programm: '
    SY-REPID.
  ENDIF.
*

But the selection appears without any parameters.

Is there a way to check without the selection-screen?

thanks.

regards, Dieter

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
1,786

Probably not, processing is already in PBO stage at this point, same with INITIALIZATION.

There is an authorization group in the program attributes that is checked before any selection screen appears, but this works with standard authorization objects S_PROGRAM and S_DEVELOP. Maybe look into using these instead of your own Z_REPORT.

Thomas

Hi,

i want to check the authority before the selection-screen. I do it in this way:


AT SELECTION-SCREEN OUTPUT.
*
  AUTHORITY-CHECK OBJECT 'Z_REPORT'
           ID 'PROGRAM' FIELD SY-REPID
           ID 'ACTVT'   FIELD '16'. "Ausführen
*
  IF SY-SUBRC <> 0.
    MESSAGE E010 WITH 'Keine Berechtigung für Programm: '
    SY-REPID.
  ENDIF.
*

But the selection appears without any parameters.

Is there a way to check without the selection-screen?

thanks.

regards, Dieter

5 REPLIES 5
Read only

Former Member
0 Likes
1,786

Hi Dieter,

Please check the below code for at selection screen authorization check.

  • Handling selection screen events

AT SELECTION-SCREEN ON p_carrid.

IF p_carrid IS INITIAL.

MESSAGE 'Please enter a value' TYPE 'E'.

ENDIF.

AUTHORITY-CHECK OBJECT 'S_CARRID'

ID 'CARRID' FIELD p_carrid

ID 'ACTVT' FIELD '03'.

IF sy-subrc = 4.

MESSAGE 'No authorization for carrier' TYPE 'E'.

ELSEIF sy-subrc <> 0.

MESSAGE 'Error in authority check' TYPE 'A'.

ELSE.

IF sy-ucomm = 'ONLI'.

CALL SELECTION-SCREEN '0500'.

ENDIF.

ENDIF.

Regards,

Md Ziauddin

Read only

Former Member
0 Likes
1,786

hi

did you try event LOAD-OF-PROGRAM ?

regards,darek

Read only

ThomasZloch
Active Contributor
0 Likes
1,787

Probably not, processing is already in PBO stage at this point, same with INITIALIZATION.

There is an authorization group in the program attributes that is checked before any selection screen appears, but this works with standard authorization objects S_PROGRAM and S_DEVELOP. Maybe look into using these instead of your own Z_REPORT.

Thomas

Read only

0 Likes
1,786

Hi Thomas,

thanks for your answer, i will do it in this way.

Regards, Dieter

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,786

Hi,

If you give Error message in AT SELECTION-SCREEN OUTPUT, control directly exits from the screen. Give your authorization group in program attributes or give it in the transaction code created for that program. This will make sure that the check happens before the program is started for execution.

Thanks,

Vinod.