Application Development 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: 

Reg:Authorisation checking

Former Member
0 Kudos

Hi all,

How to perform authorisation checking on a particular field.

for ex: In my requirement,

If the field Plant is not entered on the selection-screen, the authorisation check on the field EKPO-WERKS should be performed after the PO-document was selected.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

U need to insert the Authorization-check statament in the selection-screen and in the select and then decide which control has to be arranged:

SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.

PARAMETERS: P_WERKS TYPE T001W-WERKS.

AT SELECTION-SCREEN.

  IF NOT P_WERKS IS INITIAL.
    AUTHORITY-CHECK OBJECT <AUTH OBJECT>
        ID WERKS FIELD P_WERKS.
    IF SY-SUBRC <> 0.
----> error message
    ENDIF.      
  ENDIF.

START-OF-SELECTION.

  SELECT * FROM EKPO WHERE ....
    AUTHORITY-CHECK OBJECT <AUTH OBJECT>
        ID WERKS FIELD EKPO-WERKS.
    IF SY-SUBRC = 0.
      APPEND EKPO TO ITAB.
    ENDIF. 
  ENDSELECT.

Max

2 REPLIES 2

Former Member
0 Kudos

Hi,

Following is the syntax for the Authority Check :

AUTHORITY-CHECK OBJECT 'Authority Object Name'

ID 'TCD' DUMMY

ID 'BUKRS' DUMMY

ID 'PRCTR' DUMMY

ID 'SPART' DUMMY

ID 'WERKS' FIELD GS_WERKS

ID 'VKORG' DUMMY

ID 'EKORG' DUMMY.

IF SY-SUBRC NE 0.

MESSAGE 'YOU ARE NOT AUTHORIZED FOR GIVEN PLANT' TYPE 'E'.

LEAVE TO CURRENT TRANSACTION.

ENDIF.

this example is for the plant and rest other fields should be dummy as we don't want the other authority checks only plant is needed.

I think this will help u

Regards,

Harsh

Former Member
0 Kudos

Hi

U need to insert the Authorization-check statament in the selection-screen and in the select and then decide which control has to be arranged:

SELECT-OPTIONS: S_EBELN FOR EKKO-EBELN.

PARAMETERS: P_WERKS TYPE T001W-WERKS.

AT SELECTION-SCREEN.

  IF NOT P_WERKS IS INITIAL.
    AUTHORITY-CHECK OBJECT <AUTH OBJECT>
        ID WERKS FIELD P_WERKS.
    IF SY-SUBRC <> 0.
----> error message
    ENDIF.      
  ENDIF.

START-OF-SELECTION.

  SELECT * FROM EKPO WHERE ....
    AUTHORITY-CHECK OBJECT <AUTH OBJECT>
        ID WERKS FIELD EKPO-WERKS.
    IF SY-SUBRC = 0.
      APPEND EKPO TO ITAB.
    ENDIF. 
  ENDSELECT.

Max