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

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

Similar Messages

  • Question on Search Help and Authorization Check for Sales Order Type

    Question 1:
    When I go to VA01 and click the search help, it shows only order type that are not blocked.
    However, when I have sales order type in select-options of a Z program,
    S_AUART FOR VBAK-AUART
    I click on the search help, it gives all the sales order types. How can I have a list with unblocked sales order type only?
    Question 2:
    I want to check whether a use can extract data from a sales order type (e.g. OR and RE)that he/she authorized to use.
    I have include the following in my program:
    AUTHORITY-CHECK OBJECT 'AUART'
    ID 'AUART' FIELD 'OR'.
    It always returns SY-SUBRC = 12.
    But order type 'OR' is granted to the user (he/she can create order with type OR in VA01)
    Please kindly give me some ideas, thanks.

    hi,
    ad1
    use following code:
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR auart.
      PERFORM auartGet.
    FORM auartGet.
        CALL FUNCTION 'RV_HELP'
             EXPORTING
                  KEY            = VKORG
                  KEY2           = VTWEG
                  KEY3           = SPART
                  KEY4           = '0'
                  NUMBER         = '008'
                  FIELD_IN       = AUART
             IMPORTING
                  FIELD          = AUART.
    ENDFORM.
    ad2.
    example:
       AUTHORITY-CHECK OBJECT 'V_VBAK_AAT'
             ID 'AUART' FIELD 'OR'
             ID 'ACTVT' FIELD '01'. "01-create order, 02-change, 03 display
    check sy-subrc eq 0.
    regards,darek

  • Authorization check for plant

    Guys,
    I need to creat an authorization object with field Plant
    In my user exit I need to check for that particular plant , if authorized proceed else exit.
    how can achive this.
    Please provide me the Step by step procedure.
    Appropriate answers willb e rewarded.
    Thanks in advance

    created one field in su20(ZWERKS)
    Not ZWERKS it should be WERKS .here save your efforts.
    in aurthorization tab>change aurthorization data>selected sap_all
    saved generated
    selected sap_all
    saved generated this is wrong also from change aurthorization data here you must select all plant values except 3AA0.
    and make sure in aurthorization tab green light should be there after generate.cause in this process this screen bit buggy.
    Update:from SU21 you must create both Authorization object and class from create button(drop down).and make sure in Authorization object you assing the both class and field(werks which you already created in su20)

  • Selection screen: no sequence check for select option

    Hello everyone,
    I am an SAP starter and this will is my first question:
    I am making a program that approves a stock demand over several levels. When a level approves, the demand goes to the next level.
    for example:
    level 1 = planning
    level 2 = management
    level 3 = buyer
    In an overview report i want to choose for which levels i want to see stock demands. But when I make a select option for the level, I cannot choose the range between management and buyer or planning and buyer for example, because it is alphabetically not in the right order. In this case the alfabet is not important but the order of the levels is, so can I prevent this check from happening?
    Thank you very much

    Hi vandersteen,
    1. There should be some CODE
       for each level.
    2. Each code will have some description.
      eg. planning, management, buyer
    3. So, make select-option
       for the FIELD of CODE
       (and not the description)
    regards,
    amit m.

  • TO display pop_up on selection screen And chosse that field in 'SELECT' sta

    Hello,
    I want a pop up on selection screen when user clicks the push button on selection screen pop up should come on selection screen and display the all field of YTLEA table. when user checks few or all field from pop up then data for that field is selected from the YTLEA table.

    DDIF_TABL_GET

  • How to find out Authorization Object for Plant

    Hi,
    I have to implement an Authorization check for Plant in My Report Program.
    Is there any transaction which can help me to find out Authorization Object for any field like Material and plant?
    Thanks,
    Mamta

    Using SU21 u can create Authorisation Object.
    The ABAP command AUTHORITY-CHECK is used for performing authorizaton checks in programs.
    check f1 help on AUTHORITY-CHECK for the syntax.
    check these links
    link:[http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a92195a9-0b01-0010-909c-f330ea4a585c;jsessionid=(J2EE3417500)ID1605942050DB11298929682009193279End]

  • Authorization check for CO88

    Dear all,
    I found  there is no authorization check for plant in CO88, this means if user do not enter the plant, then all the orders will be settled, would anyone tell me how to control this?
    thanks,
    Ben

    Ben,
    You can control this by creating seperate roles and giving plantwise authorization in these roles..  Please check Tcode PFCG for further details...
    Thanks

  • Authorization object for plant on selection-screen

    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

    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

  • Authorization check for select-options field - Company code.

    Hi experts,
    i have company code field on the report selection screen and i have to validate the authorization check for BUKRS.
    How to do authorization check for a select-options field?
    Any function modules used to write the authorization check for a SELECT-OPTIONS FIELD?
    Thanks.

    >
    RNB wrote:
    > Any function modules used to write the authorization check for a SELECT-OPTIONS FIELD?
    Does it hurt to type a few lines of code? Why do you need an FM for this my friend?
    Anyways can you please tell which SAP application area (viz. FI, SD etc.) do you want to run the report?
    Suhas

  • Disabling authorizations checks for transactions SU53 and/or SU56.

    Greetings.
    I seem to remember reading that there was either a system profile parameter or a table entry that can be used to disable all authorizations checks for transactions SU53 and/or SU56.
    Any truth in this or is my mind playing tricks on me?

    Hi,
    I guess theres is profile param auth/tcodes_not_checked(I guess thats right), this will exclude SU53/SU56 from checks on transaction code.
    This can be done using RZ10 and need to restart the system.
    Rakesh

  • Reading Text File from selection Screen and populating table (Urgent)

    Hi All,
    I have some requirment like i in my report i have to initial my Input feild from text file is it good to populate a internal table or range.
    I have three feild in a excel file that entry can more then 500
    data example
    Matnr Date             Day
    A1     10.07.2007    12
    B1     10.07.2007    10
    A1     19.07.2007    15
    C1     20.08.2007    30
    E1     11.09.2007    12
    This report for Price Protection claim.
    even u can help me out with proper table plz this is urgent.

    Hi..
    <b>parameters:</b>
      p_file(50) type c.
    <b>data:</b>
      begin of itab occurs 0,
         matnr type vbak-matnr,
         date type sy-datum,
         day(2) type n,
      end of itab.
    <b>at selection-screen on value-request for p_fname.</b>
      perform get_path.
    <b>start-of-selection.</b>
    <b>CALL FUNCTION 'GUI_UPLOAD'</b>
      <b>EXPORTING
        FILENAME                      =  p_fname
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'</b>
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
    <b>  TABLES
        DATA_TAB                      = itab</b>
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    This Sub routine is used to get the file name
    *There are no interface parameters passed to this subroutine.
    FORM get_path .
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME            =  P_FNAME
      DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
       FILENAME                =  P_FNAME
      RC                     =
    EXCEPTIONS
       INV_WINSYS             = 1
       NO_BATCH               = 2
       SELECTION_CANCEL       = 3
       SELECTION_ERROR        = 4
       OTHERS                 = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " get_path
    data:

  • Selection screen change with check box and radio buttons

    hi frieds
    i have an requirement that
    there is a check box in the selection screen and bydefault it has been check if it check the selection box shuld be disable
    if it uncheck the check box then selection block should enabled and in that againg two radion buttons are there. Bydefualt one radio button is enabled so that correspondng parameter is allow to enter input data. if i select the othere radio button the immeditely it allow the correpnding field entry and other radio button should be disabled with that field.
    please send the piece of code...
    regards
    vijay

    Hi,
    Use the event AT SELECTION-SCREEN OUTPUT.
    Here is an example:
    at selection-screen output.
      if gv_ucomm = 'RG1'.
        loop at screen.
          if pa_rgor = 'X'.
            if screen-name+7(1) = '2' or
               screen-name+7(1) = '1'.
              screen-input = 0.
            endif.
          endif.
          if pa_rgof = 'X'.
            if screen-name+7(1) = '1' or
               screen-name+7(1) = '3'.
              screen-input = 0.
            endif.
          endif.
          if pa_rgaa = 'X'.
            if screen-name+7(1) = '2' or
               screen-name+7(1) = '3'.
              screen-input = 0.
            endif.
          endif.
          modify screen.
        endloop.
      endif.

  • Authorization check for cost centre

    Hi ,
    Im creating a zprogram ,in which i give bukrs,kostl,kokrs,lednr,...etc in the select options..Can somebody tell , how to create restricted access for individuals who are able to view other cost centres that they are not normally responsible for..
    Thanks...

    Hi,
    You can handle this by AUTHORITY CHECK functionality. Get all the cost centers from selection screen and do the Authority check. If user does not have authorization, you can display error message. To get Cost center Authorization objects, check transaction SU20 and SU21.
    for more details see this thread -
    Authority check
    Hope this helps.
    ashish

  • Need to have pop up window in selection screen and capture the user action.

    Hello Friends,
                         I have a requirement, that need to show a pop up window after execution, and to get the action from user using a Push button.
    I create a selection screen and a sub screen as window.
    After user execute from the selection screen, I am popping up this window.
    Window contains some input values to be entered and push button to identify the user action.
    I try to capture the user action using sy-ucomm, but it does not hold any value when user press the button.
    How to overcome this issue.
    Here is the definition of the window.
    Pop Up Window for getting values
    SELECTION-SCREEN BEGIN OF SCREEN 500 AS WINDOW TITLE title .
    PARAMETER : p_vdate LIKE t9aa01-validfrom,
                p_dcggt LIKE t9aa01-hkont,
                p_dcgst1 LIKE t9aa01-hkont,
                p_dcgst2 LIKE t9aa01-hkont,
                p_na LIKE t9aa01-hkont.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 20.
    SELECTION-SCREEN PUSHBUTTON 2(10) text-001 USER-COMMAND SVE.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF SCREEN 500.
    Cheers,
    Senthil
    Edited by: Senthil on Jan 7, 2008 11:03 AM

    Hi,
    Try using the below code.
           data : w_var type string.
           CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
             EXPORTING
              DEFAULTOPTION        = 'Y'
               textline1            = 'test '
             TEXTLINE2            = ' '
               titel                = 'check'
             START_COLUMN         = 25
             START_ROW            = 6
             CANCEL_DISPLAY       = 'X'
            IMPORTING
              ANSWER               = w_var.
                     if w_var = 'J'.
                     else.
                     endif.
    Comments : J indicates Yes and N indicates No
    Regards,
    Jeswanth

  • Difference b/w At-selection-screen and onfield

    Hi,
         What is the difference between at-selection-screen and at-selction-onfield?

    Different Types of Selection Screens
    What is:
    1. at selection-screen on field
    2. at selection-screen output
    3. at selection-screen block
    4. at selection-screen on value-request
    5. at selection-screen on help-request and their difference?
    For knowing Selection-screens:
    First you must have right understanding of Events.
    - Events are introduced by Event Keyword.  They end when again next processs begins.
    Selection-screens are special screen defined in ABAP.  
    - This ABAP at run time only controls the flow logic of Selection-screens.  The PBO and PAI triggers the num of. selection-screens.
    The basic form of the selection screen events is the AT SELECTION-SCREEN event. This event occurs after the runtime environment has passed all input data from the selection screen to the ABAP program. The other selection screen events allow programmers to modify the selection screen before it is sent and specifically check user input. 
    At Selection-screen OUTPUT is trigerred in PBO of selection-screen.  
    - This allows you to modify the Selection-screen, before it is displayed.
    At Selection-screen On Field is triggered in PAI of selection-screens.
    - The input fields can b checked,in the corresponding event block. If an error message occurs within this event block, the corresponding field is made ready for input again on the selection screen.
    At Selection-screen On Block is trigerred in PAI event.
    - You define a block  by enclosing the declarations of the elements in the block between the statements SELECTION-SCREEN BEGIN OF BLOCK block - END OF BLOCK block. You can use this event block to check the consistency of the input fields in the block.
    At Selection-screen On value request.
    - This event is trigerred for F4 help.
    At Selection-screen On help request .
    - This event is triggered when the user clicks F1 for help on fileds.

Maybe you are looking for

  • Change GL account

    Hi, I have posted transactions to a GL account (say 11111111) which is open item based. i want to transfer the postings to another GL account (Say 22222222).Can some one suggest how to carry out the same? i know the simple way would be to reverse the

  • Disp+work.exe dispatcher is not running

    disp+work.exe dispatcher is not running while message server and igswd.exe is running properly. SAP is installed on Windows 64bit and on oracle. this errror message occures when i restore data from cold backup

  • Can I copy playlists from ipod to iphone

    I have an ipod with playlists in it. I just bought an iphone 4 from Verizon.  Is there any way to move or copy my playlists from the ipod to the iphone?

  • Where is the forum for Xbox one media apps

    Our company is developing a xbox one media app. We want to get support for app packaging, but we are unable to find the forum for xbox one media apps, or xbox one itself. Where is the forum for xbox one apps ? Thanks.

  • Disable All Notifications

    How can I temporarily disable all notifications on iPhone iOS 7? Is like to do this to conserve the battery or while in a netting and the Do Not Disturb still displays notifications.  Thanks in advance!