Application Development 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: 

SAP Scripts

madan_ullasa
Contributor
0 Kudos

I need to loop through 2 itabs in the main window.

I'm using 2 write_forms. But the contents of the 2nd itab is output below the 1st. Is there any method to make the contents of the 2nd itab to come next to the 1st entry of the first itab?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

loop at itab1

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'P1'

WINDOW = 'MAIN'

loop at itab2

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'P2'

WINDOW = 'MAIN'

endloop

endloop

is it helpful

cheers,

sasi

10 REPLIES 10

Former Member
0 Kudos

hi,

loop at itab1

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'P1'

WINDOW = 'MAIN'

loop at itab2

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'P2'

WINDOW = 'MAIN'

endloop

endloop

is it helpful

cheers,

sasi

0 Kudos

Dear sasi,

thats wot im doing. But the contents of the 2nd itab comes below the first. I Want it 2 come in the same row as the contents of the first itab in the main window.

any solutions???

regards,

Madan, Bangalore.

0 Kudos

Create a big new itab in the printprogram which has the combination of the 2 itabs on 1 line. Then put the output of this to the script.

0 Kudos

Dear Bas,

my 1st itab itself has 4 other itabs in it.

more ever my requirement is that i have to loop through the 2nd itab seperately.

regards madan.

0 Kudos

I think this is the only way unfortunally. The only other solution I can think of is creating a second MAIN window which is located next to the original one. The second itab can put it's output there.

0 Kudos

Bas,

A 2nd main window wud be like a 2nd column. also the contenets of the first will flow into the 2nd .

i tried it. but tell me , is here a way to call the 2nd main window explicitly thru write_form.

i tries window = 'MAIN 01'... but got an error. more ever the 2nd main window will take the same width of the 1st. only the height is variable.

regards,

Madan

0 Kudos

Dear Madan,

I have no on-hands experience with this. There should be possibilities to do this somehow. There are several topics about it on the forum. Good luck!

Former Member
0 Kudos

SAP has provided since long the Smart Forms Tool. In most cases this can replace SAP Script requirements. Smart Forms provide loser integration between your extraction/processing logic and display logic. You can pass complete internal tables to the Smart Form and then display them as you like. It provides far greater control on formatting and positioning. One of the greatest advantage over SAP Script is the provision of a grid like table layout, and cells that can wrap data.

I will very strongly recommend that you move on to Smart Forms.

Regards.

0 Kudos

dear Ahsan,

My friend is working on a different object with a similar requirement as mine. and he is using smart forms.

unfortunately even he is having the same problem.

regards,

madan...

Former Member
0 Kudos

Hi

I think the best solution would be to create a 3rd Internal Table. Let th first loop the first few columns of the internal table and the second loop fill the other remaining columns of the Internal table. Finally u can display the Internal table in just one Main Window.

Murli