I want to share AUTHORITY-CHECK OBJECT for selection opting.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:p_bukrs type bkpf-bukrs OBLIGATORY.
SELECT-OPTIONS : so_audat FOR vbak-audat OBLIGATORY,
so_auart FOR vbak-auart OBLIGATORY,
so_kunnr FOR vbak-kunnr,
so_matnr FOR vbap-matnr,
so_vrkme FOR vbap-vrkme OBLIGATORY,
so_lgort FOR vbap-lgort,
so_werks FOR vbap-werks,
so_vkorg FOR vbak-vkorg,
so_vtweg FOR vbak-vtweg,
so_spart FOR vbak-spart.
SELECTION-SCREEN END OF BLOCK b1.
Want to check Authorization for so_vkorg, so_vtweg, so_spart.
Go to AT SELECTION-SCREEN OUTPUT.
Now AT SELECTION-SCREEN.
Call V_VBAK_VKO.
Check the code.
SELECT *
FROM vbak
INTO TABLE tmp_vbak
WHERE audat IN so_audat
AND auart IN so_auart
AND vkorg IN so_vkorg
AND vtweg IN so_vtweg
AND spart IN so_spart
AND bukrs_vf = p_bukrs.
LOOP AT tmp_vbak INTO wa_tmp_vbak.
AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
ID 'VKORG' FIELD wa_tmp_vbak-vkorg
ID 'VTWEG' FIELD wa_tmp_vbak-vtweg
ID 'SPART' FIELD wa_tmp_vbak-spart
ID 'ACTVT' FIELD '03'.
ENDLOOP.
IF sy-subrc <> 0.
MESSAGE 'No authorization' TYPE 'E'.
ENDIF.
Hope it will work
Rizvi
PARAMETERS:p_bukrs type bkpf-bukrs OBLIGATORY.
SELECT-OPTIONS : so_audat FOR vbak-audat OBLIGATORY,
so_auart FOR vbak-auart OBLIGATORY,
so_kunnr FOR vbak-kunnr,
so_matnr FOR vbap-matnr,
so_vrkme FOR vbap-vrkme OBLIGATORY,
so_lgort FOR vbap-lgort,
so_werks FOR vbap-werks,
so_vkorg FOR vbak-vkorg,
so_vtweg FOR vbak-vtweg,
so_spart FOR vbak-spart.
SELECTION-SCREEN END OF BLOCK b1.
Now AT SELECTION-SCREEN.
Call V_VBAK_VKO.
SELECT *
FROM vbak
INTO TABLE tmp_vbak
WHERE audat IN so_audat
AND auart IN so_auart
AND vkorg IN so_vkorg
AND vtweg IN so_vtweg
AND spart IN so_spart
AND bukrs_vf = p_bukrs.
LOOP AT tmp_vbak INTO wa_tmp_vbak.
AUTHORITY-CHECK OBJECT 'V_VBAK_VKO'
ID 'VKORG' FIELD wa_tmp_vbak-vkorg
ID 'VTWEG' FIELD wa_tmp_vbak-vtweg
ID 'SPART' FIELD wa_tmp_vbak-spart
ID 'ACTVT' FIELD '03'.
ENDLOOP.
IF sy-subrc <> 0.
MESSAGE 'No authorization' TYPE 'E'.
ENDIF.
Rizvi
No comments:
Post a Comment