08-20-2007 8:28 PM
Hi Experts,
Just curious to know( I know, some thing!), that, How the following works? or Wht is the behaviuor of the following stetemnts?
LOOP AT it_bukrs.
AUTHORITY-CHECK OBJECT 'Z_EX_BUK'
ID 'BUKRS' FIELD it_bukrs-bukrs
ID 'ACTVT' FIELD '01'.
IF sy-subrc <> 0.
MESSAGE i052(sv).
EXIT.
ELSE.
CALL FUNCTION 'VIEW_AUTHORITY_CHECK'
.............. so on.......
pls. clarify.
thanq.
08-20-2007 8:50 PM
Hi Srikar,
The Authority check checks if you have the authorization for the following company code depending upon the activity(01-may be create,02 may be change etc). It gives a message if the check fails..
I think that is a custom authority check for some specific purpose. Go to SU21 and search for 'Z_EX_BUK'. You will find the description and permitted activities for this Authority Object.
Thanks,
Vamshi.
08-20-2007 8:50 PM
Hi Srikar,
The Authority check checks if you have the authorization for the following company code depending upon the activity(01-may be create,02 may be change etc). It gives a message if the check fails..
I think that is a custom authority check for some specific purpose. Go to SU21 and search for 'Z_EX_BUK'. You will find the description and permitted activities for this Authority Object.
Thanks,
Vamshi.
11-28-2020 2:30 AM
Authority-check: Authority Check is the statement used in an ABAP program to perform an authorization check against an authorization object. This statement will return sy-subrc is 4 if user has not authorized.
create authorization object in SU21
Authorization Object Which contains Authorization field. You can create authorization field in SU20 or while creating authorization object also you can create.
TYPES: BEGIN OF TY_SPFLI,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
CITYFROM TYPE SPFLI-CITYFROM,
CITYTO TYPE SPFLI-CITYTO,
END OF TY_SPFLI.
PARAMETERS: P_CARRID TYPE SPFLI-CARRID.
DATA: LT TYPE TABLE OF TY_SPFLI.
AT SELECTION-SCREEN.
AUTHORITY-CHECK OBJECT 'ZSPF_CARRI'
ID 'ZCARRID' FIELD P_CARRID
ID 'ACTVT' FIELD '03'.
IF SY-SUBRC EQ 4.
MESSAGE 'GIVEN AIRLINE CODE IS NOT AUTHORIZED' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
SELECT CARRID CONNID CITYFROM CITYTO FROM SPFLI INTO TABLE LT WHERE CARRID = P_CARRID.
LOOP AT LT INTO DATA(LS).
WRITE:/ LS-CARRID, LS-CONNID, LS-CITYFROM, LS-CITYTO.
ENDLOOP.