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

Output using 2 Internal tables

Former Member
0 Likes
486

Hi friends,

I have 2 internal tables.

<b>ITAB1</b>(with 2 fields) containing 5 records.

<b>ITAB2</b>(with 3 fields) containing 10 records.

How can we print these fields side by side in an <b>SINGLE OUTPUT</b>.

What is the logic behind it.

Pl help me out.

3 REPLIES 3
Read only

athavanraja
Active Contributor
0 Likes
437

loop at itab1 .

write:/ itab1-field

read table itab2 with key field = itab1-field .

write itab2-field

endloop .

Raja

Read only

sourabhshah
Product and Topic Expert
Product and Topic Expert
0 Likes
437

hi,

if you want to use an ALV make a new internal table with all the 5 fields,populate the table and use the sort functionality of ALV on the desired columns.

Regards,

Sourabh

Read only

Former Member
0 Likes
437

Hi,

IF NOT itab1 IS INITIAL.
LOOP AT itab1.
 write:/ 1 itab1-f1,
           11 itab1-f2.
READ TABLE itab2 WITH KEY f3 = itab1-f1. 
(some key fields should be here)
IF sy-subrc  = 0.
 write:/ 16 itab2-f3,
           20 itab2-f4,
           28 itab2-f5.
ENDIF.             
ENDLOOP.
ENDIF.

Otherwise

IF NOT itab1 IS INITIAL.
LOOP AT itab1.
LOOP AT itab2.
 write:/  1 itab1-f1,
           11 itab1-f2.
           16 itab2-f3,
           20 itab2-f4,
           28 itab2-f5.
ENDLOOP.             
ENDLOOP.
ENDIF.

Hope this may help you.