This is an interesting example to show the differences between an internal table with a table header and an internal table without a table header assignment.
In this example, we first define a structured field line, which contains the col1 and col2 fields. Pass
Append Line ToEtab. After the value is assigned to etab, the result of DEBUG is:
In this case, you can use the move etab [] to ftab1. statement to assign the value to itab1. The result of the ftab1 table is as follows:
You can clearly see that etab and ftab1 tables with and without headers have different results, so the assignment and output methods are also different. For a table without a table header, You need to define Another workspace object with the same structure as the table in the tableProgramWhen writing data to an inner table, you must first assign a value to the workspace, and then add or insert an inner table in the workspace. When taking values from an inner table, you need to overwrite the content of the workspace with the content of the defined inner table row, and then use the content of the workspace from the program.
*&---------------------------------------------------------------------*
* & Report ztest_sd1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
ReportZtest_sd1.
* Move
data : begin of line ,
col1 ( 1 ) type C ,
col2 ( 1 ) type C ,
end of line .
Data: EtabLike Table Of Line With Header Line,
Ftab1Like Table Of Line.
Line-Col1 ='A'.Line-Col2 ='B'.
Append Line ToEtab.
Loop AtEtab.
Write:/ETAB-COL1, ETAB-COL2.
Endloop.
MoveEtab []ToFtab1.
DataWaLike Line OfFtab1.
Loop AtFtab1IntoWa.
Write:/WA-COL1, WA-COL2.
Endloop.
Loop AtFtab1Into Line.
Write:/Line-Col1,Line-Col2.
Endloop.
Skip.
Uline.