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 LIKE statement help

Former Member
0 Likes
2,826

Hi all,

I want to select all values from prps-usr00 where the field contains XXX-XXXX...where X is any letter or number. How in the world do I do that?

Thanks,

Mat

5 REPLIES 5
Read only

Former Member
0 Likes
727

SELECT SOMETHING
INTO VARIABLE
FROM TABLE
WHERE PARAM1 LIKE '%-%'.

Greetings,

Blag.

Read only

Former Member
0 Likes
727

Hi Mathew,

Select *
into itab1
from prps-usr00 
where <field> eq XXX-XXXX.

Itab1 is an internal table.

Hope this would help you

Regards

Narin Nandivada.

Read only

Former Member
0 Likes
727


SELECT * mara
INTO TABLE i_mara
WHERE matnr like '%XXX-XXXX%'.
IF sy-subrc eq 0.

ENDIF.

Read only

rainer_hbenthal
Active Contributor
0 Likes
727

Open SQL does not offer regular expressions, so the only thing you can do is look for the hyphen:%-%

Can xxx-xxxx occur at any position or is it always at a certain position?

Read only

Former Member
0 Likes
727

Hi,

SELECT SOMETHING INTO VARIABLE FROM TABLE

WHERE PARAM1 LIKE '%-%'.

Or

If you know that there will be exactly 2 char in front of '-' and 2 char after. then use.

SELECT SOMETHING INTO VARIABLE FROM TABLE

WHERE PARAM1 LIKE '__-__'.

Regards

madhu

Edited by: madhu tatikonda on Jun 27, 2008 9:08 PM