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

Select-Options

Hi All,

Can anyone please explain the concept of using SELECT-OPTIONS in data fetching (In, Select statement, where clause).

For Ex.

SELECTION-SCREEN BEGIN OF BLOCK selsrn WITH FRAME TITLE

text-001.

SELECT-OPTIONS: s_vbeln FOR vbak-vbeln NO-EXTENSION,

s_erdat FOR vbak-erdat NO-EXTENSION

NO INTERVALS,

s_vbtyp FOR vbak-vbtyp,

s_auart FOR vbak-auart,

s_vkbur FOR vbak-vkbur.

PARAMETER: p_kunnr TYPE vbak-kunnr.

SELECTION-SCREEN END OF BLOCK selsrn.

START-OF-SELECTION.

SELECT vbeln

vbtyp

kunnr

FROM vbak INTO TABLE it_vbak1

  • WHERE vbeln = s_vbeln AND

  • erdat = s_erdat AND

  • vbtyp = s_vbtyp AND

  • auart = s_auart AND

  • vkbur = p_vkbur.

WHERE vbeln IN s_vbeln AND

erdat IN s_erdat AND

vbtyp IN s_vbtyp AND

auart IN s_auart AND

vkbur IN s_vkbur AND

kunnr EQ p_kunnr.

Here, I need to know what is the diffrence in the commented "WHERE" and the other. Iam also aware of the select-option structure (Option, Sign, Low and High).

Regards,

Sumanth.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2005 at 08:13 AM

    Sumanth,

    The way SELECT-OPTIONS have been used in the commented code is not right. Usually you use SELECT-OPTIONS to cover a range or multiple single values or mulitple range of values or range plus some additional single values. For this to work properly you have to use the IN operator.

    If you use '=', it tries to take the header line of the SELECT OPTIONS tables and might not return the values that you are expecting.

    Hope this clarifies your questions.

    Regards,

    Ravi

    Note : Please reward points if this solves your problem.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 08, 2005 at 09:08 AM

    Hi,

    One more remark about SELECT-OPTIONS, be aware that if it is empty, then it as if the condition does not exist.

    In your example, if S_VBELN is empty then there won't be any filter on this criterion.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 08, 2005 at 10:27 AM

    Hi Sumanth,

    Yes, and despite all these simplicity, the select-options can also be used to indicate single values, ranges, multiple single values, and also <> , <,> etc.

    And you can also say Exclude and give a range/single value/multiple values.

    Thats just how complex it cud get.

    Rgds,

    Prash.

    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.