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: 

select statement with where condition

Former Member
0 Kudos
180

HI all ,

I want to extract data from data base table with where condition with Z*.

How can i do that?

select * from mara into table it_mara where matnr = '12*'.

but iam unable to get materials starts with 12 .

how can i get that one?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
147

WHERE matnr LIKE '12%'.

6 REPLIES 6

Former Member
0 Kudos
148

WHERE matnr LIKE '12%'.

0 Kudos
147

But you should remember that material numbers are stored with leading zeros internally (if your material numbers are all numeric). So this still may not give you what you wanted to achieve.

0 Kudos
147

Thanks guys .

Message was edited by:

priya katragadda

Former Member
0 Kudos
147

select * from mara into table it_mara where matnr like '12%'.

null

Former Member
0 Kudos
147

do this way

select * from mara into table it_mara where matnr like'12%'.

Regards,

Santosh

ferry_lianto
Active Contributor
0 Kudos
147

Hi,

You can also use ranges.


tables: mara.

ranges: r_matnr for mara-matnr.

r_matnr-sign = 'I'.
r_matnr-option = 'CP'.
r_matnr-low = '12*'.
append r_matnr.

select * from mara into table it_mara where matnr in r_matnr.

Regards,

Ferry Lianto