08-05-2008 4:40 AM
Hi all,
I have query on wildcard selection. Can we do it for parameter?
If can, kindly provide me the sample coding of it.
Thanks in advance.
Regards.
08-05-2008 4:43 AM
We can use '%' ex: that means %A ends with A, A% starts with A like this..
for comaparing we will use LIKE in where clause.
select * from sflight
into table it_flight
where carrid like '%A'.
08-05-2008 4:44 AM
Hi Kyra,
DATA: it_mara TYPE mara OCCURS 0.
SELECT * FROM mara
INTO TABLE it_mara
WHERE matnr LIKE '%23'.
Best regards,
raam
08-05-2008 5:33 AM
Hi,
Yes, definately we can have parameters in wild card selection query.
for any character string *
for any single character +.
To find out whether the value of a column matches a pattern, use:
SELECT ...
WHERE s
LIKE f
......
The condition is true if the value of the column s matches [does not match] the pattern in the data object f.You can only use this test for text fields. The data type of the column must be alphanumeric. f must have data type C.
You can use the following wildcard characters in f:
1. % for a sequence of any characters (including spaces).
2. _ for a single character.
For example, ABC_EFG% matches the strings ABCxEFGxyz and ABCxEFG, but not ABCEFGxyz. The use of
_ and % corresponds to Standard SQL usage. Logical expressions elsewhere in ABAP use other
wildcard characters (+ and *).
Example :
tables: makt.
types: begin of ty_itab,
matnr type makt-matnr,
maktx type makt-maktx,
end of ty_itab.
data: itab type standard table of ty_itab,
wa_itab like line of itab,
np_matnr type makt-matnr.
parameters: p_matnr type makt-matnr.
Concatenate p_matnr '%' into np_matnr.
select matnr
maktx
from makt
into table itab
where matnr LIKE np_matnr.
loop at itab into wa_itab.
write: wa_itab-matnr.
endloop.
this will surely help you.
thanx,
dhanashri.
Edited by: Dhanashri Pawar on Aug 5, 2008 6:34 AM
Edited by: Dhanashri Pawar on Aug 5, 2008 6:43 AM
Edited by: Dhanashri Pawar on Aug 5, 2008 6:51 AM
08-05-2008 5:47 AM
hi.
wild card characters are used check whether the string start with particular char or ends with particuat char or field valur contains set of charsss wch are enclose between '%' symobles..
LIKE also works..
it is used in where clasuese of open sql statements.... only...
we cant use in processing of internal tables
Regards .
Raju Mummidi