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

Sap Script - looping through internal table

Former Member
0 Likes
2,018

Hello Everyone,

I am having one internal table with multiple entries.

I want to display all entries of my internal table in one window.

I created one text element in my window and one variable.

The problem arises is - When my form gets displayed, only the last entry of my internal table is coming into the form.

Any pointers how to display all values in the form of my internal table.

Thanks in advance.

Regards,

Tarun

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,230

Hi Tarun,

As Sravanthi said use FM WRITE_FORM_LINES.

Thanks & Regards,

YJR.

7 REPLIES 7
Read only

Former Member
0 Likes
1,230

ru append into iternal table in driver programm.

in sap script it show only last data it's mean that u used write window inside loop of internal table but there is only one value in header (append internal table....)

Read only

0 Likes
1,230

Hi,

I am passing the value of my internal table one by one to the variable in window.

The last line item of my internal table gets printed in the window.

I want all line items of my internal table to be displayed.

Any clue about that.

Read only

former_member480923
Active Contributor
0 Likes
1,230

U should be calling the SAPScript using the FM <b>Write_Form</b> inside the Loop Endloop of your internal table.

At this point of time i think what u are doing is that u are passing the value of the Internal table into the variable one by one and then printing the variable with write_form.

Hope this helps

Thanks

Anirban

Read only

0 Likes
1,230

Yes Anirban,

You are right.

Attached is the source code:

LOOP AT gt_tline INTO wa_tline.

PERFORM trigger_write_form USING 'SUM_TE' 'W26'.

ENDLOOP.

In Script, the code is:

/E SUM_TE

/: BOX FRAME 10 TW

P1 &wa_tline-TDLINE&

This is happening in my script program.

If i have 4 entries in my internal table, i am able to see only 4th entry in my form.

Any idea how to see all the four entries in my form.

Regards,

Tarun

Read only

0 Likes
1,230

If you are using WRITE_FORM, use the MAIN window..

If you are using WRITE_FORM_LINES, you can directly use it in a normal window...

ex: wa_tline is your internal table.

In window MAIN

/E SUM_TE

/: BOX FRAME 10 TW

P1 &wa_tline-TDLINE&

Read only

0 Likes
1,230

Hi Tarun,

Were you able to solve the problem? If yes how? I'm using a normal window and not the main window.

Regards

Nidhi

Read only

Former Member
0 Likes
1,231

Hi Tarun,

As Sravanthi said use FM WRITE_FORM_LINES.

Thanks & Regards,

YJR.