06-11-2007 7:01 AM
Hi,
i am using material code ( declared as parameter statement ) in where clause of select statemant . i want to run the select for input like DC* in parameter so that all materials starting from DC are included in the select.
thanks and regards
abaper.
06-11-2007 7:56 AM
Hi,
If you are using select-options, you can achieve the result without extra effect.
If you want to use only parameter, you need to use ranges in your logic and equate option = 'CP'.Here is the code.It is working fine.Kindly reward points by clicking the star on the left of reply,if it helps.
parameters p_matnr type matnr.
tables mara.
data itab type standard table of mara.
data wa type mara.
ranges r_matnr for mara-matnr.
r_matnr-low = p_matnr.
r_matnr-sign = 'I'.
r_matnr-option = '<b>CP</b>'.
append r_matnr.
select * from mara into table itab where matnr <b>in r_matnr</b>.
loop at itab into wa.
write wa-matnr.
endloop.
06-11-2007 7:05 AM
Hi,
use like
select -
from ---
where
matnr<b> like</b> p_matnr.
--Patil
06-11-2007 7:22 AM
Hi King,
This is dynamic selection and * is not used in this clause. You can use % instead of * to achieve at the solution.
This sholud solve your query.
Reward Points if useful.
Thanks,
Tej..
06-11-2007 7:31 AM
Hi Tez,
can you write the full select statement. where to write %
thanks and regards
abaper
06-11-2007 7:34 AM
HI,
select * from mara into i_mara where matnr = 'dc%'.
this select statement will select all the record which is having material number starts with "dc"
rgds,
bharat.
06-11-2007 7:23 AM
06-11-2007 7:42 AM
Hi again King,
Use this way.
Select field1 field 2
from table
into int_table
where sel_field = 'DC%'.
Note: <b>Always remember that the code within single cotes should be in CAPS</b>.
This should solve your query.
Reward Points if useful.
Thanks,
Tej..
Message was edited by:
Shree Tejus
06-11-2007 7:53 AM
Hi ,
thanks for your reply , but i dont want to hard code it .
rgds
abaper.
06-11-2007 7:54 AM
Hi,
The above select statements are not working.
select maktx from makt into table imakt where makt = 'T%'.
is not working.
K.Kiran.
06-11-2007 7:56 AM
Hi,
use LIKE
select maktx from makt into table imakt where makt<b> like</b> 'T%'.
--Patil
06-11-2007 7:56 AM
Hi,
If you are using select-options, you can achieve the result without extra effect.
If you want to use only parameter, you need to use ranges in your logic and equate option = 'CP'.Here is the code.It is working fine.Kindly reward points by clicking the star on the left of reply,if it helps.
parameters p_matnr type matnr.
tables mara.
data itab type standard table of mara.
data wa type mara.
ranges r_matnr for mara-matnr.
r_matnr-low = p_matnr.
r_matnr-sign = 'I'.
r_matnr-option = '<b>CP</b>'.
append r_matnr.
select * from mara into table itab where matnr <b>in r_matnr</b>.
loop at itab into wa.
write wa-matnr.
endloop.