on ‎2022 Aug 12 8:07 AM
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.

Request clarification before answering.
Hi suityan98
You may add the following code in the USER_COMMAND_0100 ( as per your requirement )CALL FUNCTION 'ISHMED_READ_USER_AUTH'
EXPORTING
i_user = sy-uname
i_object = 'F_BKPF_BUK'
TABLES
t_authorities = i_authorization
EXCEPTIONS
read_error = 1
OTHERS = 2.
READ TABLE i_authorization INTO wa_authorization WITH KEY objct = 'F_BKPF_BUK'
actvt = 'A'
field = 'ACTVT'
von = '*'.
IF sy-subrc NE 0.
MESSAGE 'You are not authorized' DISPLAY LIKE 'E'.
ENDIF.
NoteWhile testing as mentioned above, test with user who does not have this authorization.Regards,Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.