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

where clause

Former Member
0 Likes
1,018

hi

in select query i am using where condition.

in my selection i would want to display data that start with Z and Y.

i have used like this.. where NAME IN (Z%,Y%).

but it's not working..

give me some other solution to overcome this...

plz reply me..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
996

Hi,

use select command like this :

SELECT ernam

FROM ekko

INTO corresponding fields of table it_test

WHERE ernam like 'Y%'

or ernam like 'Z%'.

Entry in Capital letters only.

Reward points, if helpful,

Sandeep Kaushik

hi

in select query i am using where condition.

in my selection i would want to display data that start with Z and Y.

i have used like this.. where NAME IN (Z%,Y%).

but it's not working..

give me some other solution to overcome this...

plz reply me..

8 REPLIES 8
Read only

Former Member
0 Likes
996

like this

NAME IN ('Z%','Y%').

regards

Peram

Read only

Former Member
0 Likes
996

Hi

Try with Z% and Y% in where clause

<b>select matnr into v_matnr from mara where matnr LIKE 'Z%' or matnr LIKE 'Y%'.</b>

Other wise fetch the data completely into itab then loop it

loop at itab.

if ( itab-field0(1) ne 'Z' or itab-field0(1) ne 'Y' )

delete Itab index sy-tabix.

endif.

Endloop.

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

Former Member
0 Likes
996

HI,

see this code

tables:mara.

select * from mara where matnr in ('z%','y%').

write:/ mara-matnr.

ENDSELECT.

rgds,

bharat.

Read only

Former Member
0 Likes
997

Hi,

use select command like this :

SELECT ernam

FROM ekko

INTO corresponding fields of table it_test

WHERE ernam like 'Y%'

or ernam like 'Z%'.

Entry in Capital letters only.

Reward points, if helpful,

Sandeep Kaushik

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
996

Hi,

Use LIKE instead of IN.

Regards,

Sesh

Read only

Former Member
0 Likes
996

hi,

give them in single quotations as

where NAME IN ('Z%','Y%')

or

name like 'Z%' or like 'Y%'.

if helpful reward some points.

with regards,

Suresh.A

Read only

Former Member
0 Likes
996

Hi Limat,

view this code and use like instead of IN.

DATA: T_SFLIGHT LIKE SFLIGHT OCCURS 0 WITH HEADER LINE.

SELECT * FROM SFLIGHT INTO TABLE T_SFLIGHT WHERE CARRID = 'AZ' AND

CONNID IN ('0555', '0790') AND FLDATE LIKE '2004%'.

LOOP AT T_SFLIGHT.

WRITE: /,T_SFLIGHT-CARRID,T_SFLIGHT-CONNID.

ENDLOOP.

If useful rewrad me with points.

Thanks.

Sanket.

Read only

Former Member
0 Likes
996

hi

thx for ur reply . the problem is solved.