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

sql between

Former Member
0 Likes
835

hi,

in my sql statement i need a field value in between '1A' - '1Z'

for example kstar char10, i need to extract field value in between the first 2 value starts with '1A' to '1Z'.

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
801

eI,

DATA : v_char value '1'.

Select all the records into internal table.

Loop at itab.

if itab-filed+0(1) eq v_char.

if itab-filed+0(2) CA sy-abcde.

endif.

endif.

endloop.

reward if useful....

6 REPLIES 6
Read only

Former Member
0 Likes
801
data : v_char(3)
ranges : s_char for v_char.

s_char-sign = 'I'.
s_char-option = 'CP'.
s_char-low = '1A'.
s_char-high = '1Z'.
append s_char.

select ..... where field in s_char.
Read only

Former Member
0 Likes
801

Hi,

One way to do is:

declare a ranges object for that field: v_kostl for cost-kostl.

then populate it with the values:

v_kostl-low = '1A'.

v_kostl-high = '1Z'.

v_kostl-sign = 'I'.

v_kostl-option= 'BT'.

append v_kostl.

then in ehere clause use KOSTL in v_KOSTL.

regards,

Anji

Message was edited by:

Anji Reddy Vangala

Read only

Former Member
0 Likes
801

Hi,

You can write the select statment by using the BETWEEN statment.

WHERE NAME LIKE '1A%' " It will pick the values

" which starts from 1A...

Regards

Sudheer

Message was edited by:

Sudheer Junnuthula

Read only

Former Member
0 Likes
802

eI,

DATA : v_char value '1'.

Select all the records into internal table.

Loop at itab.

if itab-filed+0(1) eq v_char.

if itab-filed+0(2) CA sy-abcde.

endif.

endif.

endloop.

reward if useful....

Read only

Former Member
0 Likes
801

Hi el,

Try this.........

SELECT *

FROM table_name

INTO TABLE t_table

WHERE field_name BETWEEN '1A' AND '1Z'.

Reward,if helps.

Hope,your problem is solved.

Message was edited by:

Raghavender Vadakattu

Read only

Former Member
0 Likes
801

hi

use code like this

SELECT *

FROM table

INTO TABLE it_table

WHERE field BETWEEN '1A%' AND '1Z%'.

it worked for me.

pls reply if it is useful