02-18-2009 6:40 AM
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
02-18-2009 6:44 AM
Hi Kumar,
it will check only for the plants which you give to it as input,but not the range.
Regards,
Sravan
02-18-2009 6:44 AM
Hi Kumar,
it will check only for the plants which you give to it as input,but not the range.
Regards,
Sravan
02-18-2009 7:38 AM
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
02-18-2009 6:47 AM
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 ...
02-18-2009 6:49 AM
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
02-18-2009 7:02 AM
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