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

select statement with where and in

SELECT * INTO IT_XYZ FROM XYZ WHERE ABC IN (AAA, BBB).

In the above select statement, does it consider only the values AAA and BBB or all the values in between them ?

Search before posting further

Edited by: Vijay Babu Dudla on Jan 16, 2009 4:34 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    Posted on Jan 16, 2009 at 08:12 AM

    Hi

    It will include only value AAA and BBB.

    To take value between them, use either select-option or ranges.

    ranges : r_range for ztable-field_name.
    
    r_range-sign = 'I'. "for inclusive
    r_range-option = 'BT'. "for between
    r_range-low = 'AAA'. "low value
    r_range-high = 'BBB'. "high value
    append r_range.
    

    now use this range in query.

    where ABC in r_range. "this will include all values between AAA and BBB
    

    Hope this solves your problem.

    Thanks & Regards,

    Tarun Gambhir

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 08:08 AM

    hi,

    if you are using select-option it will take all the values between two mentioned values. please search forum first then post.

    thanks,

    anupama.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 16, 2009 at 08:09 AM

    hi,

    you can go for ranges. to get values between AAA,BBB

    Thanks,

    Naveen Inuganti

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 08:14 AM

    hi,

    It will take values that are given in the value within the brackets..

    to get a range of values you can use

    Ranges or select-options ....

    thanks

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 08:16 AM

    Hi,

    Your query consider either AAA or BBB.

    If you want the values in the range from AAA to BBB then use BETWEEN

    SELECT * INTO IT_XYZ FROM XYZ WHERE ABC  BETWEEN 'AAA and 'BBB'.

    Regards,

    Manoj Kumar P

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 08:23 AM

    Hi

    Your query will consider only the values mentioned in brackets.

    If you want to support a range of values or a set of distinct values, use Select-Options.

    Then you can use the Select query with WHERE ABC IN seltab option.

    Here you are checking if ABC with the values mentioned in Select-Options (seltab) that you create.

    Check out this link for more details on usage:

    http://help.sap.com/abapdocu/en/ABENWHERE_LOGEXP.htm

    Hope this helps 😊

    Regards,

    Jayanthi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 08:09 AM

    It will consider only the values that are provided in the list within the brackets

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 08:14 AM

    Hi,

    It is only seach for those two what u give inside the bracket in your query. Not all entires between these.

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2009 at 08:15 AM

    Thank you for answering my query.

    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.