Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Authority Check of Customer Program

Former Member
0 Kudos
83

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.

2 REPLIES 2

Former Member
0 Kudos
46

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

Former Member
0 Kudos
46

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.