01-09-2007 12:04 PM
hi,
i have a small problem in select statement.
i need to select some data based on some inputs and the condition is i need all the records where one field say field1(string type) conatins anything which starts with POL .
select aufnr into it_data from aufk where ktext STARTS WITH 'POL'.
but this is not working can anyone suggest me the right method.
urgent plz.
01-09-2007 12:06 PM
Hi,
use
select aufnr into it_data from aufk where ktext like 'POL%'.
Regards,
Sonika
Message was edited by: Sonika Ahuja
sorry use like instead of =
Sonika Ahuja
01-09-2007 12:06 PM
Hi,
use
select aufnr into it_data from aufk where ktext like 'POL%'.
Regards,
Sonika
Message was edited by: Sonika Ahuja
sorry use like instead of =
Sonika Ahuja
01-09-2007 12:08 PM
use -
Select field1 from dbtab into corresponding fields of itab
where field2 like 'POL%'.
AMIT
Amit Tyagi
01-09-2007 12:09 PM
HI,
Refer sample code:
data: ws_ZSUBSEG type ZSEG,
wa_KONTOKLASSET type KONTOKLASSET,
ws_KTOKL type KTOKLASSE.
data: iZSEG type table of KONTOKLASSET with header line.
ranges: r_ZSEG for iZSEG-KTOTX.
r_ZSEG-sign = 'I'.
r_ZSEG-option = 'CP'.
concatenate '' <b>POL</b> '' into r_ZSEG-low.
condense r_ZSEG-low.
append r_ZSEG.
clear ws_KTOKL.
select single KTOKL
into ws_KTOKL
from KONTOKLASSET
where KTOTX in r_ZSEG
and spras = sy-langu.
if sy-subrc eq 0.
$S$ = ws_KTOKL.
endif.
endif.
Reward points if this Helps.
Manish
01-09-2007 12:10 PM
HI,
You need to write the select statment like this way
select aufnr into it_data from aufk where ktext EQ 'POL%'
Regards
Sudheer
01-09-2007 12:12 PM
Hi Ravi ,
Try doing this
Data : v_string type string.
v_string = 'POL%'.
select aufnr into it_data from aufk where ktext LIKE V_STRING.
Regards
Arun