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: 

Selection screen and authorization check for plant from 2 diff tables?

Former Member
0 Kudos

Hi,

Could anyone help me out?

how to write code for this?

u2022 Fields for selection

Plant : WERKS (one selection) - check authorization access u2013 Mandatory .

Material code MATNR (one selection) - Mandatory

and while doing the authorization check how should i check it ? here iam taking the table as t001w for werks and for selection screen iam taking it from another Z table......i should take 2 different tables here.....for selection and for authorization.

my code is pasted below:

----


  • Data Declarations *

----


data: s_werks type t001w-werks.

----


  • Selection Screen *

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-h01.

PARAMETER : p_werks like Ztable-werks OBLIGATORY,

p_matnr like mara-matnr OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

----


  • Start-of-Selection *

----


START-OF-SELECTION.

**-Get Plants for Authorization check.

SELECT werks

FROM t001w

INTO TABLE it_werks

WHERE werks IN s_werks.

LOOP AT it_werks INTO x_werks.

v_werks = x_werks.

Regards,

Reddy

2 REPLIES 2

Former Member
0 Kudos

Plant : WERKS (one selection)

That means only 1 plant value to be given? Then you can use PARAMETERS instead of SELECT-OPTIONS. And additionally, you'll only have to check that plant value.

Using SELECT-OPTIONS you would indeed retrieve the plants and check each individual selected plant. Your code for that is good enough to start with.

I wouldn't do the check in the START-OF-SELECTION event, but rather in the AT SELECTION_SCREEN event.

To perform an authorisation check; try the ABAP help on AUTHORITY-CHECK. And you will need to know which authorisation object you need to use.

Just noticed you're using PARAMETERS

WHERE werks IN s_werks

should be

WHERE werks eq p_werks

But actually you don't need to select T001W. Just use the value in p_werks.

Edited by: Maen Anachronos on Oct 10, 2008 7:53 PM

former_member585060
Active Contributor
0 Kudos

Hi,

Check the folling link, it gives you clearly the AUTHORITY check for WERKS.

http://members.tripod.com/sap_abap/authorit.htm

Regards

Bala Krishna