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

selecting using pattern

Former Member
0 Likes
497

Hi all,

I want to use pattern while selecting data from the table .

Example.

p_matnr = abc12*

p_werks = *

select * from mara where matnr = p_matnr and werks = p_werks

how should be the coding while using the search pattern as given above p_matnr = abc12*

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
460

Hi

Use LIKE in the where condition to select the pattern related data like

select * from mara where matnr like 'ABC12%'.

see the correct syntax by pressing F1

Regards

Anji

3 REPLIES 3
Read only

Former Member
0 Likes
461

Hi

Use LIKE in the where condition to select the pattern related data like

select * from mara where matnr like 'ABC12%'.

see the correct syntax by pressing F1

Regards

Anji

Read only

gopi_narendra
Active Contributor
0 Likes
460
select * from MARA into table IT_MARA where MATNR like 'ABC12%'.

This can be used for ur purpose. Use of % gets all the Materials starting with ABC12%

Regards

Gopi

Read only

Former Member
0 Likes
460

better you declare like this

tables : marc.

select-options : p_matnr for marc-matnr no-extension no intervals,

p_matnr for marc-werks no-extension no intervals.

select * from marc where matnr in p_matnr and werks in p_werks.

It will be easier other wise you have to write lot of codes to change the * in parameter to %. And then you have to use in like.

Regards

shiba dutta