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: 

Authorization object for plant on selection-screen

Former Member
0 Kudos

Hi All,

I need to cehck the authorization object for plant on sleection screen..the palnt is select-options.

I have written the code

Declaration of local constants.

CONSTANTS : lc_i(1) TYPE c VALUE 'I',

lc_eq(2) TYPE c VALUE 'EQ'.

REFRESH : r_werks.

LOOP AT s_werks.

IF s_werks-low IS NOT INITIAL.

AUTHORITY-CHECK OBJECT 'M_MATE_WRK' "Check if the user has autorization for the plant.

ID 'ACTVT' FIELD '03'

ID 'WERKS' FIELD s_werks-low.

IF sy-subrc NE 0.

r_werks-sign = lc_i.

r_werks-option = lc_eq.

r_werks-low = s_werks-low.

APPEND r_werks.

ENDIF.

ENDIF.

ENDLOOP.

LOOP AT s_werks.

IF s_werks-high IS NOT INITIAL.

AUTHORITY-CHECK OBJECT 'M_MATE_WRK' "Check if the user has autorization for the plant.

ID 'ACTVT' FIELD '03'

ID 'WERKS' FIELD s_werks-high.

IF sy-subrc NE 0.

r_werks-sign = lc_i.

r_werks-option = lc_eq.

r_werks-low = s_werks-high.

APPEND r_werks.

ENDIF.

ENDIF.

ENDLOOP.

My doubt is will the authorization will check the plants in between 1001 and 2001..suppose i have pplants 1001,1002,1003,1004,2001..Now will the above code will check for all the plants or only 1001 and 2001 if i specify in the select-options.

Regards,

raj

1 ACCEPTED SOLUTION

former_member242255
Active Contributor
0 Kudos

Hi Kumar,

it will check only for the plants which you give to it as input,but not the range.

Regards,

Sravan

5 REPLIES 5

former_member242255
Active Contributor
0 Kudos

Hi Kumar,

it will check only for the plants which you give to it as input,but not the range.

Regards,

Sravan

0 Kudos

Hi,

Sravan is right it won't check the values in between it will check only low and high....so we need to check once aging after getting the data form db table for each and every plant....

Regards,

raj

Former Member
0 Kudos

better check if the WERKS entered in the selection screen exists in the table T001W.

select WERKS into itab

from T001W

where WERKS in s_werks.

Now loop at ITAB and write your code ...

Former Member
0 Kudos

Hi Raj

First no need to LOOP AT s_werks and check s_werks-high as it will always be present only once in the table s_werks.

Do this


SELECT werks FROM t001w INTO li_werks
WHERE werks IN s_werks.

LOOP AT li_werks.
*check your authority thing here and fill the range
ENDLOOP.

Pushpraj

Former Member
0 Kudos

Hi,

Suppose if u mention any values in the field then it will check in between the values...if not..it will look for all the values..

Regards

Kiran