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

How to build my own SELECT-OPTIONS?

Hi experts,

I hv 4 values like for a field, (say VBAK-BNAME),

NAME_A

NAME_D

NAME_M

NAME_Z

My selection- screen is like,

SELECT-OPTIONS: MANAGER FOR VBAK-BNAME.

So,

1) How to build the SELECT-OPTIONS table in my ABAP code?

I mean, if the user enters the NAME_A TO NAME_Z in select-options, the system shuld take in-between NAMEs also!

(Actually, I thiught that, the SAP will take care of building the select-options table based on Alphabetical Order, but, When I observed in debug mode, its not like that!)

2) And Where I hv to write the code for building select-options? I mean, Is it DATA DECLARATION part, AT SELECTION SCREEN or AT SELECTION SCREEN OUTPUT or START OF SELECTION?

thanq.

Message was edited by:

Sridhar

Message was edited by:

Sridhar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jun 01, 2007 at 07:11 PM

    Hi,

    Pls. suggest me other than RANGES?

    Well, if you don't want to use RANGE then you can do it at SELECT statement.

    SELECT BNAME
    INTO TABLE ITAB
    FROM VBAK
    WHERE BNAME IN ( NAME_A, NAME_D, NAME_M, NAME_Z )
    
    OR
    
    SELECT BNAME
    INTO TABLE ITAB
    FROM VBAK
    WHERE BNAME BETWEEN 'NAME_A' AND 'NAME_Z'.
    

    2) under which event i hv to write it?

    If you are using in SELECT statement, then you use at START-OF-SELECTION.

    If you are buiding RANGE, then you can use at any events such as INITIALIZATION, AT SELECTION-SCREEN OUTPUT, START-OF-SELECTION, etc.

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 01, 2007 at 06:55 PM

    Hi,

    You can build RANGE and use in SELECT statement.

    RANGES: R_BNAME FOR VBAK-BNAME.
    
    R_BNAME-SIGN = 'I'.
    R_BNAME-OPTION = 'EQ'.
    R_BNAME-LOW = 'NAME_A'
    APPEND R_BNAME.
    
    R_BNAME-SIGN = 'I'.
    R_BNAME-OPTION = 'EQ'.
    R_BNAME-LOW = 'NAME_D'
    APPEND R_BNAME.
    
    ...
    
    SELECT BNAME
    INTO TABLE ITAB
    FROM VBAK
    WHERE BNAME IN R_BNAME.
    
    

    Regards,

    Ferry Lianto

    Add a comment
    10|10000 characters needed characters exceeded

    • instead of that try using wildcard on your sel scr to get all the values in that range..

      ie

      on your sel scr you will enter 'A' to 'Z'.

      SELECT-OPTIONS: MANAGER FOR VBAK-BNAME

      Select bname into itab

      from vbak

      where bname in manager.

      you itab will now have all the values & saves you from hardcoding them in the program..

      ~Suresh

  • Posted on Jun 01, 2007 at 07:21 PM

    Hi,

    Yes ... It is same as specify single values in select option parameter.

    Regards,

    Ferry Lianto

    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.