03-06-2009 12:02 PM
Hi ,
How can i use select qurey using where clause with 9*....
Example :
SELECT matnr FROM mara into it_mara
WHERE matnr = p_material number.
ie , This is parameter in selection screen -here defaultly giving as below
p_material number = '9*'.
i have used the above select but it failed .can any one help me sort out this ?
Regards
Maha
03-06-2009 12:03 PM
SELECT matnr FROM mara into it_mara
WHERE matnr like '9%'
Kiran
Edited by: kiran vempati on Mar 6, 2009 1:14 PM
03-06-2009 12:04 PM
Hi,
Use it this way:-
SELECT matnr FROM mara
into table it_mara "internal table
WHERE matnr like '9*'.
Regards,
Tarun
03-06-2009 12:09 PM
03-06-2009 12:10 PM
Hi,
Are you getting any error or no data is being displayed...??
Also make sure the data exists for mantr as 9....
Hope this helps you.
Regards,
Tarun
03-06-2009 12:13 PM
Tarun,
No error , sy-subrc = 4 and the data's are in DB.Not sure why .
Regards,
MAHA
03-06-2009 12:16 PM
Hi,
If there is no data in database table, then the query wont fetch the data and will give sy-subrc as 4.
So make sure that there is some data in table for matnr = 9*...
Regards,
Tarun
03-06-2009 12:18 PM
Hi ,
9* values are there in data base table . i had confirmed .
Regards,
Maha
03-06-2009 12:21 PM
Hi
it wont work with 9*...u need to give it as 9% and 'LIKE' in the where clause as
where matnr like '9%'.
I have tried this and its working.
Keerthi
03-06-2009 12:26 PM
Hi,
Try this its working, i have checked:-
DATA : BEGIN OF itab OCCURS 0,
matnr TYPE mara-matnr,
END OF itab.
DATA : v_matnr TYPE mara-matnr.
v_matnr = '9%'.
SELECT matnr FROM mara INTO TABLE itab WHERE matnr LIKE v_matnr.
WRITE : sy-subrc.
LOOP AT itab.
WRITE: / itab-matnr.
ENDLOOP.
Hope this solves your issue.
Regards,
Tarun
03-06-2009 12:07 PM
Hi,
You can use like statement with you select query,
i.e like '9*' after your select query.
Regrds
Mansi
03-06-2009 12:08 PM
hi,
you have written the write query.just change where clause
insterad of wiritng p_matnr = P-matnr material number.
WRITE
WHERE matnr like '9*'.
Hope it will solve your problem
Thanks
Arun
03-06-2009 12:10 PM
Hi,
Try like this...
Use percentage symbol
SELECT matnr FROM mara into table it_mara
WHERE matnr like '9%'.
Hope its helps
03-06-2009 12:11 PM
SELECT matnr FROM mara into it_mara
WHERE matnr LIKE p_material number*.
03-06-2009 12:11 PM
Hi,
Try as below:
select * from sflight into table itab
where carrid like 'A%'.
loop at itab into wa.
write:/ wa-carrid.
endloop.
u cant use *...just use % instead of that and in where condition use LIKE.
Keerthi
03-06-2009 12:31 PM
Yah where matnr like '9%'. is working with me also
Just check other things in your select qurey.
03-06-2009 5:40 PM
try this way it will work...
select - options :p_material number for mara-matnr with no-intervals no-extensions.
SELECT matnr FROM mara into it_mara
WHERE matnr in p_material number.
Regards,
Prabhudas