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

how to fill empty parameter (selection-option)

Hi!

On selection screen I have two parameters (s_egrid and s_empid). If user enter something in first (but not in second) one, second one should be filled from database.

The problem is that I don't know how to fill the empty parameter.

Let's say that i have an internal table i_zemployee with list of all necessary employee Id's (stored in field empid)

if I Ioop like this

loop at i_zemployee into wa_zemployee.
    insert wa_zemployee-empid into s_empid.
  endloop.

... I did something stupid 😊 but i hope that you understand what i need:

s_emipd[1] = 'u1'.
s_emipd[2] = 'u7'.
s_emipd[3] = 'u9'.

... like array of user id's.

and this s_empid I need in my next SELECT statement like

SELECT * FROM ...
    ....
    WHERE empid in s_empid.

if someone knows the solution thanks in advance!

T.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 02, 2008 at 08:55 PM

    All the select-options, e.g. s_empid, are range tables so to fill any of them, I'd suggest something like (not syntax checked):

    start-of-selection.
      perform fill_gaps.
    
    form fill_gaps.
    *" Provide defaults if empty default
      if s_empid[] is initial. "not filled
        loop at i_zemployee into wa_zemployee.
          clear: s_empid.  "clear header line each loop
          s_empid-option = 'EQ'.  "equals
          s_empid-sign   = 'I'.   "include
          s_empid-low    = wa_zemployee-empid. "set a value
          s_empid-high   = space.  "only used for between-type options
          append s_empid.
        endloop.
      endif.
    
    endform.
    

    Jonathan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 02, 2008 at 12:25 PM

    Hello,

    To fill the second when the first one is selected you can use the event AT SELECTION-SCREEN ON <field>.

    See this, extracted from SAP BC-ABA material.

    REPORT EVENT_DEMO.
      NODES SPFLI.
      AT SELECTION-SCREEN ON CITY_FR.
      IF CARRID-LOW EQ 'AA' AND CITY_FR NE 'NEW YORK'. 
        MESSAGE E010(HB).
      ENDIF.
    

    There are some helpfull samples in transaction ABAPDOCU.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 02, 2008 at 09:21 PM

    HI try something like this...

    tables: mara, makt.

    data: begin of itab occurs 0,

    matnr like mara-matnr,

    end of itab.

    data : begin of btab occurs 0,

    maktx like makt-maktx,

    end of btab.

    ata mak like makt-maktx.

    DATA : return like ddshretval occurs 0 with header line.

    data: begin of dynpfields occurs 3.

    include structure dynpread.

    data: end of dynpfields.

    select-options: p_matnr for mara-matnr.

    select matnr from mara into table itab where matnr IN p_matnr.

    loop at itab.

    write: / itab-matnr.

    endloop.

    Initialization.

    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.

    REFRESH ITAB.

    SELECT matnr FROM mara INTO TABLE ITAB.

    call function 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

    retfield = 'MATNR '

    dynprofield = 'P_MATNR '

    dynpprog = sy-REPID

    dynpnr = sy-dynnr

    value_org = 'S'

    TABLES

    value_tab = ITAB

    return_tab = return.

    select single maktx from makt into mak where matnr = return-fieldval.

    p_matnr = return-fieldval.

    refresh return.

    clear return.

    move 'P_MAKTX' to dynpfields-fieldname.

    move mak to dynpfields-fieldvalue.

    append dynpfields.

    CALL FUNCTION 'DYNP_VALUES_UPDATE'

    EXPORTING

    dyname = 'SY-REPID'

    dynumb = '1000'

    tables

    dynpfields = dynpfields

    .

    IF sy-subrc <> 0.

      • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

      • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

      refresh return.

      clear return.

      validate according to ur requirement.

      Regards

      Syed A

      Add a comment
      10|10000 characters needed characters exceeded

    • author's profile photo Former Member
      Former Member
      Posted on Apr 03, 2008 at 02:50 AM

      Hi,

      First you have to observe here is, if you want to fill second parameter

      by entering first one it is not possible,because when you enter some value in first one some event has to trigger ,under that event we can write code.Simply enter the values,will not trigger.

      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.