Application Development 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 wildcard charecters

Former Member
0 Kudos

Hi,

I have to pass to select statement like TW% and TI%. means only need to fetch Company code related to TW% and TI%. Can anycody advise me how to get.

7 REPLIES 7

Former Member
0 Kudos

hi,

use it in this fashion,


data t_scarr type table of scarr.

select * from scarr
into table t_scarr
where carrid like 'A%'.

data wa type scarr.

loop at t_scarr into wa.
write / wa-carrid.
endloop.

Regards,

Siddarth

former_member222860
Active Contributor
0 Kudos

Try this Query

select * from dbtable into table itab where bukrs like 'TW%' and bukrs like 'TI%'.

0 Kudos

>

> Try this Query

>

>

select * from dbtable into table itab where bukrs like 'TW%' and bukrs like 'TI%'.

Won't work with AND - the same BUKRS value cannot satisfy both conditions. Will work with OR.

Former Member
0 Kudos

Hi Christin,

U r right it will not work, is there any way to get the records by passing both the company codes with wildcard characters.

0 Kudos

>

> Hi Christin,

>

> U r right it will not work, is there any way to get the records by passing both the company codes with wildcard characters.

Yes. Replace the AND with an OR (as I said).

0 Kudos

But do you really want to 'hardcode' these Company codes? It would be better to use select options (if you are writing a report, or use 'ranges' (not the oldfashioned ones created with keyword RANGES, but rather selfdefined select options).

Former Member
0 Kudos

satisfied