10-20-2008 10:12 AM
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.
10-20-2008 10:22 AM
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
10-20-2008 10:20 AM
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
10-20-2008 10:22 AM
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