cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to create authorization checking with Tcode

suityan98
Explorer
0 Likes
2,162

How to create authorization checking with tcode? I have tried many ways like creating transaction ZSDI_DRIVER_INFO and ZSDR_DRIVER_INFO during in tcode se80 and assigned the authorization object (F_BKPF_BUK) to the respective tcode.

But nothing change, even when testing I try to insert data not in authorization, It still allows the user to save. I am new in SAP ABAP. Hopefully can get some advice on this...

MODULE USER_COMMAND_0100 INPUT.

CASE ok_code.
WHEN 'CONFIRM' .


IF gv_bukrs IS INITIAL
OR gv_icno IS INITIAL
OR gv_status IS INITIAL.

MESSAGE 'Please fill in field required.' type 'E'.
CALL SCREEN '0100'.

ENDIF.
PERFORM check_data.
WHEN 'QUERY'.
CALL SCREEN '0200'.
WHEN 'UPDATE'.
IF gv_bukrs IS INITIAL
OR gv_icno IS INITIAL
OR gv_status IS INITIAL.

MESSAGE 'Please fill in field required.' type 'E'.
CALL SCREEN '0100'.
ENDIF.
PERFORM check_data2.

WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.

View Entire Topic
RaymondGiuseppi
Active Contributor
0 Likes

From your requirement I understand that you have to code some AUTHORITY-CHECK statements in your code such as

  AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
           ID 'BUKRS' FIELD gv_bukrs
           ID 'ACTVT' FIELD '03'. " display/query
* For activity value, double-click on authorization object for list of values
* examples:
* 02  Update
* 03  Query
* 10  Confirm, etc.
  IF sy-subrc <> 0.
* Implement a suitable exception handling here
  ENDIF.

Adding the authorization object to the transaction definition will only trigger a check at start of transaction with the values you also provided to this transaction (click on 'values' from SE93 screen)