2006 Sep 18 12:57 PM
Hi,
i want to restrict the user for the zprogram for particular plant i had tried with following code bur its not taking efeect can any one help me in this regard.
select-options : WERKS for t001w-werks,
fkart for vbrk-fkart,
fkdat for vbrk-fkdat,
vkorg for vbrk-vkorg,
vtweg for vbrk-vtweg,
rfbsk for vbrk-rfbsk.
selection-screen : end of block b1.
DATA:
allowed_werks TYPE RANGE OF t001w-werks,
wa_allowed_werks LIKE LINE OF allowed_werks.
SELECT single werks
FROM t001w
INTO wa_allowed_werks-low
WHERE werks IN werks.
authority-check object 'Z_PLANT'
id 'WERKS' field wa_allowed_werks-low
id 'ACTVT' field '03'.
IF SY-SUBRC <> 0.
MESSAGE E208(VA).
ENDIF.
2006 Sep 18 1:02 PM
Hi
DATA: T_T001W LIKE STANDARD TABLE OF T001W WITH HEADER LINE..
SELECT single werks
FROM t001w
INTO TABLE T_T001W WHERE werks IN werks.
LOOP AT T_TOO1W.
authority-check object 'Z_PLANT'
id 'WERKS' field T_T001W-WERKS
id 'ACTVT' field '03'.
IF SY-SUBRC <> 0.
DELETE T_T001W.
ENDLOOP.
DESCRIBE T_T001W LINES SY-TABIX.
IF SY-TABIX = 0.
MESSAGE E208(VA).
ENDIF.
Max
2006 Sep 18 1:03 PM
Hi,
Try like this.......
IF ( Sy-tcode CP 'Z*' ).
AUTHORITY-CHECK OBJECT ''Z_PLANT' :
ID 'WERKS' FIELD v_werks
ID 'TCD' FIELD sy-tcode.
IF sy-subrc NE 0.
MESSAGE e000(vz) WITH 'No Authorization for Plant'
v_werks ' for Transaction ' sy-tcode .
ENDIF.
ENDIF.