‎2007 Nov 01 10:52 AM
hoe could i use like statement in select query?
plz reply............
Thanks in advance.
‎2007 Nov 01 10:54 AM
yes
select * from mara where matnr like '100%'.
it will fetch the matnr which starts with 100.
if you want dynamic
data : mat(4).
concatenate '100' '%' into mat
select * from mara where matnr like mat.
regards
shiba dutta
‎2007 Nov 01 10:58 AM
‎2007 Nov 01 11:00 AM
you can use compareOperation = LIKE
<key1>
<col4 compareOperation=LIKE>val%</col4>
</key1>
for more have a look at:
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Just go thru this thread- may take sometime to read
http://help.sap.com/saphelp_nw2004s/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
‎2007 Nov 01 11:00 AM
Hi,
Like 'Char%' in where condition.
select maktx from makt where maktx like 'MAT%'.It will select all the records with MAT as starting letter.
Thanks,
Sriram Ponna.
‎2007 Nov 01 11:00 AM
Hi,
In the select statement the use of LIKE is possible to get the values based on a pattern.
Code:
where matnr LIKE 'M1%' means all Matnr starts with M1
where matnr LIKE '%M1%' means all Matnr that contains M1
You have to use % for any combination of characters
and _ for single character in the LIKE operator.
Check the code.
SELECT DISTINCT MAT_SALES
FROM /BI0/PMAT_SALES
INTO TABLE i_mat_sales
WHERE /BIC/ZACCASGRP IS INITIAL
OR /BIC/ZACCASGRP LIKE '%'
OR /BIC/ZACCASGRP LIKE 'A1%' "Starts with A1
OR /BIC/ZACCASGRP LIKE 'C3%'.
LOOP AT SOURCE_PACKAGE into source_wa.
T_INDEX = SY-TABIX.
READ TABLE I_MAT_SALES WITH KEY MSALE =
source_wa-MAT_SALES TRANSPORTING NO FIELDS.
IF SY-SUBRC NE 0.
DELETE SOURCE_PACKAGE INDEX T_INDEX.
ENDIF.
Reward if Helpful.
Regards,
Harini.S