Skip to Content
0
Former Member
Aug 31, 2007 at 02:27 AM

Authority check in ABAP program

315 Views

Hello All

I am having some trouble with authority object in ABAP programming

This is the situation.

I have a field "plant" which is a select options in the selection screen.

I have to write an authority-check for this "plant" field in the program and display the report for only the plants for which the user is authorised. There is a select statement in the program which selects all the plants entered. If it is single plant entry and the user is not authorised or the user is not authorised to none of the plants entered for multiple plant entries, an error message should be displayed saying "no authority to display plants x, y, z"

How can I incorporate this logic in the report.

This the current coding

AT SELECTION-SCREEN.

AUTHORITY-CHECK OBJECT 'C_ROUT'

ID 'ACTVT' FIELD '03'

ID 'PLNTY' FIELD 'DUMMY'

ID 'WERKS' FIELD s_werks

ID 'STATU' FIELD 'DUMMY'

ID 'VERWE' FIELD 'DUMMY'.

START-OF-SELECTION.

SELECT amatnr aplnnr aplnal awerks aplnty bstlnr b~stlal INTO TABLE t_mapl FROM mapl AS a INNER JOIN mast AS b

ON amatnr = bmatnr

AND awerks = bwerks

WHERE a~matnr IN s_matnr

AND a~plnnr IN s_plnnr

AND a~plnal IN s_plnal

AND a~werks IN s_werks

AND a~plnty IN s_plnty

AND b~stlnr IN s_stlnr

AND b~stlal IN s_stlal. "(ALT BOM)

Thanks

Ricky