2007 Apr 12 12:42 PM
hi,
I want to select following feilds from KNA1 KUNNR
NAME1
NAME2
LAND1
ORT01
PSTLZ
REGIO
STRAS
TELF1
ADRNR
ERNAM
ERDAT
based on the following condition below:
Wildcard on customer name:
a. Starts with
b. Contains
Please send me a sample code of how to select the customer name based on the above conditions
rewards guaranteed.
neha
hi,
I want to select following feilds from KNA1 KUNNR
NAME1
NAME2
LAND1
ORT01
PSTLZ
REGIO
STRAS
TELF1
ADRNR
ERNAM
ERDAT
based on the following condition below:
Wildcard on customer name:
a. Starts with
b. Contains
Please send me a sample code of how to select the customer name based on the above conditions
rewards guaranteed.
neha
2007 Apr 12 12:43 PM
Hi..
select
KUNNR
NAME1
NAME2
LAND1
ORT01
PSTLZ
REGIO
STRAS
TELF1
ADRNR
ERNAM
ERDAT
from KNA1
INTO TABLE ITAB
<b>WHERE NAME1 LIKE 'SAI%' . "<-- Starts with SAI
-
WHERE NAME1 LIKE '%SAI%' . "<--Contains SAI</b>
Here SAI is case sensitive .. if u give in Capital letters then it will search for capital letters onli.
reward if it helps u..
sai ramesh
2007 Apr 12 12:46 PM
HI
Select
NAME1
NAME2
LAND1
ORT01
PSTLZ
REGIO
STRAS
TELF1
ADRNR
ERNAM
ERDAT
from KNA1
INTO TABLE ITAB
WHERE NAME1 LIKE 'A%' .
Hope this helps
Regds
Seema
2007 Apr 12 12:53 PM
Hi..
<b>1.% for a sequence of any characters (including spaces).
2._ for a single character.</b>
select
KUNNR
NAME1
NAME2
LAND1
ORT01
PSTLZ
REGIO
STRAS
TELF1
ADRNR
ERNAM
ERDAT
from KNA1
into itab
where NAME1 like 'R%' . "or
<u>for second one,</u>
lets say ur string is 'ram'.
<b>concatenate '%' 'ram' '%' into w_string.</b>
<b>select ....
from kna1
into itab
where name1 like w_string.</b>
2007 Apr 12 1:57 PM
Hai,
Here is the sample code:
SELECT
KUNNR
NAME1
NAME2
LAND1
ORT01
PSTLZ
REGIO
STRAS
TELF1
ADRNR
ERNAM
ERDAT
FROM KNA1
WHERE CUSTOMER NO LIKE 'ABC%XYZ%'.
It means:
Customer no Starts with
ABC and Contains the string XYZ
% wildcard means zero or nore any characters.
Possible Customer numbers are:
ABCppppXYZqqq
ABCXYZqqq
ABCXYZ
Hope you got idea.
<b>Reward points if it helps you.</b>
Regds,
Rama chary.Pammi
2007 Apr 12 2:05 PM
Hi neha,
Now we shall look at another way.
All the above ways will work.
ranges: s_name1 for kna1-name1.
<b>* For starts with</b>
s_NAME1-sign = 'I'.
s_name1-option = 'CP'.
concatenate s_name1-low '*' into s_name1-low.
append s_name1.
select * from kane1 into table
where name1 in s_name1.
<b>* For Contains</b>
s_NAME1-sign = 'I'.
s_name1-option = 'CP'.
concatenate '" s_name1-low '' into s_name1-low.
append s_name1.
select * from kane1 into table
where name1 in s_name1.
Regards,
Ravi
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |