Adding rows in an internal table with header line in SAP ABAP


Note that you shouldn’t use headers with internal tables. As you are using it, and header of in_table2 is empty. Use the loop to print it as below −

LOOP AT in_table2.   "here in_table2 means table (an internal table)
  WRITE / in_table2. "here in_table2 means the header of the table (a structure)
ENDLOOP.

When you have headers with internal tables, you shouldn’t use it in the same way. You should use field symbols for looping and append like this −

FIELD-SYMBOLS: <fs_for_loop> LIKE LINE OF in_table2[].
LOOP AT in_table2[] ASSIGNING <fs_for_loop>.
  WRITE / <fs_for_loop>.
ENDLOOP.

Updated on: 13-Mar-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements