Skip to Content
avatar image
Former Member

How to print table in a loop for n times

Hi ,

I created an internal table and assigned that to loop element and within that i created a table element and hoping to print table for n times.but it is printing only one time and i did put another code statement along with table in the loop and it is getting executed for n times but i dont understand the problem with table elements.

are there any special conditions need to be met

Let me know the solution

Thanks

Bala Duvvuri

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 27, 2009 at 01:13 PM

    Try to create New program lines in the loop. There write break <your username> in it. See if the loop to write the table is getting executed n times.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 27, 2009 at 02:48 PM

    hi,

    may i know what data are u assigning to the table..

    i guess ur prob can be solved in this way..pls try this..

    if 1 internal table..

    maintain a global variable for the count..and increment it in the program lines and use it in the condition of loop.

    assign the internal table to the loop field in table->data tab.

    if 2 internal tables..

    assign 1 internal table to the loop element.

    assign second internal table to the loop field in table ->data tab.

    hope this will be helpful ..

    Thanks and Regards..

    KC

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 27, 2009 at 06:00 PM

    Hi Bala,

    Lets say that we have two tables..

    SFLIGHT and SBOOK

    First we need to populate both the tables, assume that we have both the tables in the Global data section. Also declare work area in the same global data section.

    Now, we can use a Loop and Table with in Loop.

    1) Loop

    IT_SFLIGHT INTO WA_SFLIGHT " Define like this in loop Data tab

    Now, here you can use a template and display the data of the WA_SFLIGHT

    2) TABLE

    You can create a table under the loop,

    IT_SBOOK INTO WA_SBOOK " Define this in TABLE DATA Tab

    Add conditions in where condition of data section..

    CARRID = WA_SFLIGHT-CARRID

    CONNID = WA_SFLIGHT-CONNID

    FLDATE = WA_SFLIGHT-FLDATE

    Create line type in table and add the same in main area of a table and display the WA_SBOOK data.

    I hope it helps.

    Thanks,

    Sreekanth

    Add comment
    10|10000 characters needed characters exceeded