‎2006 Jun 06 12:47 PM
i have itab .
in the itab i have field P.order for all order i have number of material.
i made
loop at itab.
select matnr
from mara
where ebeln = itab-ebeln (for example only)
endloop.
i have 1 row and now i will get more rows how i do it?
how i select the matirel for all p.order
and show it in alv.
example:
<b>order material</b>
1 222222
33333
55555
2 33333
4444
‎2006 Jun 06 12:53 PM
hi,
just use
select matnr
from mara
into table lit_mara
for all entries in itab
where ebeln = itab-ebeln.
then u can merge both the table data in to 3rd table .
loop itab.
loop lit_mara where itab-ebeln.
itab3-field1 = itab-field1.
itab3-field1 = itab-field2.
itab3-field1 = lit_mara-field1.
itab3-field1 = lit_mara-field2.
...................
append itab3.
endloop.
endloop.
pass it to the alv.
this is what u want.
Message was edited by: Manoj Gupta
‎2006 Jun 06 12:50 PM
hi Liat,
Use <b>for all entries statement</b> in select statement..
i.e, select .... for all entries in ITAB1..
Regards,
Santosh
‎2006 Jun 06 12:52 PM
If I understand correctly, you need to use
select statement with for all entries.
Regds
Manohar
‎2006 Jun 06 12:52 PM
Hi,
You can use
select matnr from mara
for all entries in itab
into corresponding fields of table itab2
where ebeln = itab-ebeln.
instead of
loop at itab.
select matnr from mara
into table itab2
where ebeln = itab-ebeln.
endloop.
then use FM reuse_alv_list_display to display itab2 in alv.
‎2006 Jun 06 12:53 PM
hi,
just use
select matnr
from mara
into table lit_mara
for all entries in itab
where ebeln = itab-ebeln.
then u can merge both the table data in to 3rd table .
loop itab.
loop lit_mara where itab-ebeln.
itab3-field1 = itab-field1.
itab3-field1 = itab-field2.
itab3-field1 = lit_mara-field1.
itab3-field1 = lit_mara-field2.
...................
append itab3.
endloop.
endloop.
pass it to the alv.
this is what u want.
Message was edited by: Manoj Gupta
‎2006 Jun 06 12:57 PM
if i understand
you say i ned to make 2 itabs
and how i merge between them
‎2006 Jun 06 12:54 PM
hi
use select f1 f2 f3 ..
from mara
into <b>corresponding fields of itab_new</b>
<b>for all entries in itab</b>
where field = itab-field.
‎2006 Jun 06 12:56 PM
Hi Liat,
Using select statement within a Loop statement may cause Performance issues..Better avoid using it.
If you are not using a small database, go for FOR ALL ENTRIES...
For eg:
select CARRID FROM SPFLI INTO TABLE ITAB.
select FLDATE PRICE FROM SFLIGHT INTO OTAB FOR ALL ENTRIES IN ITAB WHERE CARRID = ITAB-CARRID.
Regards,
SP.
‎2006 Jun 06 12:59 PM
hi liat,
YES U NEED 2 ITABS
u can give
select matnr from mara
<b>for all entries </b>in itab into table itab1
where ebeln = itab-ebeln.
and itab1 is
data:begin of itab occurs with header line,
matnr like mara-matnr,
end of itab.
in ur code u didnot give into itab... so u r fetching only one record.
OR GIVE
loop at itab.
select matnr
from mara
INTO TABLE ITAB1
FOR ALL ENTRIES IN ITAB
where ebeln = itab-ebeln (for example only)
endloop.
HOPE THIS HELPS,
PRIYA.
Message was edited by: Priya