Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

select statement with where and in

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

I355602
Advisor
Advisor
0 Kudos

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

9 REPLIES 9

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

naveen_inuganti2
Active Contributor
0 Kudos

hi,

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

Thanks,

Naveen Inuganti

I355602
Advisor
Advisor
0 Kudos

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

Former Member
0 Kudos

Hi,

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

Thanks.

Former Member
0 Kudos

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

Former Member
0 Kudos

Thank you for answering my query.

Former Member
0 Kudos

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

Former Member
0 Kudos

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