Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

data in itab

Former Member
0 Likes
910

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
859

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

8 REPLIES 8
Read only

Former Member
0 Likes
859

hi Liat,

Use <b>for all entries statement</b> in select statement..

i.e, select .... for all entries in ITAB1..

Regards,

Santosh

Read only

0 Likes
859

If I understand correctly, you need to use

select statement with for all entries.

Regds

Manohar

Read only

Former Member
0 Likes
859

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.

Read only

Former Member
0 Likes
860

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

Read only

0 Likes
859

if i understand

you say i ned to make 2 itabs

and how i merge between them

Read only

Former Member
0 Likes
859

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.

Read only

Former Member
0 Likes
859

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.

Read only

Former Member
0 Likes
859

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