Skip to Content
author's profile photo Former Member
Former Member

data in itab

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2006 at 11:53 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2006 at 11:50 AM

    hi Liat,

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

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

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2006 at 11:54 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2006 at 11:52 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2006 at 11:56 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 06, 2006 at 11:59 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.