Skip to Content
author's profile photo Former Member
Former Member

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

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 10, 2008 at 05:52 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 10, 2008 at 06:25 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.