Application Development and Automation 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: 
Read only

select statement with where and in

Former Member
0 Likes
1,073

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
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,001

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
Read only

Former Member
0 Likes
1,001

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.

Read only

Former Member
0 Likes
1,001

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

Read only

naveen_inuganti2
Active Contributor
0 Likes
1,001

hi,

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

Thanks,

Naveen Inuganti

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,002

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

Read only

Former Member
0 Likes
1,001

Hi,

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

Thanks.

Read only

Former Member
0 Likes
1,001

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

Read only

Former Member
0 Likes
1,001

Thank you for answering my query.

Read only

Former Member
0 Likes
1,001

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

Read only

Former Member
0 Likes
1,001

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