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

Flow

Hi

Say i am retrieving data from VBAK

select * from vbak

retrieving data from vbap

select * from vbap

retreiving from likp

select * from likp

retrieving from lips

select * from lips

retrieving from kna1

select * from kna1...

i want to pass all data to final internal table..

which table we loop first ....why is that so..

How read works on these tables??

Thanks in advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 04:21 PM

    First u have to loop at VBAK because it is the header table.Then within that loop u need to read the other internal tables.

    READ can hold only one record at any point of time.

    Like

    loop at it_vbak.

    .........

    read table it_vbap with key vbeln = it_vbak-vbeln.

    move corresponding fields to ur final internal table

    ...........

    append it_final.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 08, 2007 at 04:22 PM

    hi RK,

    u can use inner join for vbak, vbap, lips, likp with vbeln key.

    select vbakfield vbapfields lipsfields likpfields into corresponding fields of itab from vbak inner join vbap on vbakvbeln = vbapvbeln inner join lips on vbakvbeln = lipsvbeln inner join likp on vbakvbeln = likpvbeln where ( ur conditions).

    try to relate ur fields with KNA1 table fields and populate the final itab.

    Regards

    CNu

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      1) Yes. READ with binary search (sort the internal table before) will improve the performance. Select single - it has to read the database each loop so slows down the performance.

      2) You can loop through KNA1 but disadvantage is, it is not key and one customer will have multiple VBAK records so again you have to loop for VBAK. Inner loops should be avoided and again reason is performance.

      3) Probably, you may need inner loops as same sales document, may have multiple deliveries and line items (LIPS). DO... READ....Enddo statements may be useful to avoid inner loops.

      4) Though you don't want to use inner joins, it will reduce the development effort and improve the performance. Instead of joining all tables, you can atleast joins VBAK and VBAP, LIKP and LIPS.

      Thanks

      Viswa

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.