‎2008 Apr 17 6:20 AM
Hi All,
I have a small problem while fetching data from the data base using a select statement. the where clause is matching with the data from an internal table which is inturn filled using GUI_upload. here is the code,
select single * from marc into t_marc
where matnr = itab-matnr
and werks = itab-werks.
i am able to fetch the same matnr directly from MARC table, but not through this statement.
Thank You.
‎2008 Apr 17 6:27 AM
You can try like this,
loop at itab.
select single * from marc into t_marc
where matnr = itab-matnr
and werks = itab-werks.
endloop.
or
data:
it_marc TYPE TABLE OF marc.
SELECT * FROM marc INTO table it_marc
FOR ALL ENTRIES IN itab
WHERE matnr = itab-matnr
AND werks = itab-werks.
Edited by: Rengith Skariah on Apr 17, 2008 7:27 AM
‎2008 Apr 17 6:28 AM
hi,
set a parameter for matnr field and werks
select single * from marc into t_marc
where matnr = p_matnr
and werks = p_werks.
u will get the corresponding data
Regards,
priya
‎2008 Apr 17 6:49 AM
‎2008 Apr 17 7:06 AM
Hi you cant move the data in Structure.
Write an internal table with same structure fiormat.
Like first you declare an internal table
it_marc type standard table of t_marc.
then in select statement you write :
select single * from marc into it_marc.......
Reward if useful.
Thanks.
Swati.
‎2008 Apr 17 7:16 AM
Hi
There's no problem with ur statement.
just debug it and see whether there is a value in itab-matnr
and itab-werks field....
U may do this in loop so that data can come in header line
or if ur internal table is without header line then firstly transfer data from internal table to work area.
like
loop at int_tab into wa_tab..
then use wa_tab-werks etc..
Please reward points
‎2008 Apr 17 7:30 AM
HI,
U can do like this
t_marc should be the same as MARC table.
select *
from marc into t_marc
for all entries IN itab
where matnr = itab-matnr
and werks = itab-werks.Then u can use
LOOP AT ...
READ TABLE itab WITH KEY.....
if sy-subrc = 0.
endif.
ENDLOOP.This is a better approach.
‎2008 Apr 17 11:31 AM
HI,
User conversion exist for material number field before select statement
Check Dataelement->domain of MATNR for conversion exit.
Best regards
‎2008 Apr 17 10:22 PM
Hi Salma,
Try this, it might solve your problem.
Data:i_marc TYPE TABLE OF MARC.
Select * from MARC
into table i_marc
FOR ALL ENTRIES IN itab
where matnr = itab-matnr AND
werks = itab-werks.
Reward if useful.
Thanks & Regards,
Ahmed Khan.
‎2008 Apr 18 8:41 AM
Hi
First Define Parameters for the fields matnr and werks.
than Write Select Statement as
select single * from marc into t_marc
where matnr = p_matnr
and werks = p_matnr.
This will solve your problem
Thank You
Nikunj Shah
‎2008 Apr 21 1:23 PM
hello,
use conversion exit for the matnr feild, u wil get correct value.
tirumal
‎2008 Apr 22 1:34 PM
so you want to validate the data in the internal table.
you can write like this. but it is a perormance issue.
i,e once you obtain the data from file to itab using GUI_UPLOAD,
loop at itab.
select *
from MARC
into table I_MARC
where matnr = itab-matnr
and werks = itab-werks.
if sys-subrc ne o.
error msg.
endif.
endloop.
-
loop at itab.
read table itab with key matnr = itab-matnr
werks = itab-werks.
if sys-subrc ne o.
error msg.
endif.
endloop.
Reward if helpful
Rgds
Umakanth