DATA: BEGIN OF ps_struct.
INCLUDE STRUCTURE zss_db_table1. “ ==>Below syntax Error:
“ZSS_DB_TABLE! must be a flat structure.
“Internal tables, strings, references, and structures cannot be used as components.
DATA field4 TYPE i.
DATA: END of ps_struct.
DATA lt_internal_table TYPE TABLE OF ztt_db_Table1.
SELECT *FROM ztt_db_table1 INTO TABLE lt_internal_table.
LOOP AT lt_internal_table ASSIGNING FIELD-SYMBOL(<ls_struct>).
MOVE_CORRESPONDING <ls_struct> TO ps_struct.
ps_struct-field4 = ‘field4’.
WRITE:/ ps_struct-field1.
ENDLOOP.
The error is due to the field3 component in the Database table. The Datatype of FIELD3 component is String.
FIELD1 | Type | ZDEL_ID | NUMC |
FIELD2 | Type | ZDEL_NAME | CHAR |
FIELD3 | Type | ZDEL_DESC | STRING |
Flat structure consists of all elementary data types except string and xstring. The error is resolved by changing the datatype of the component ‘FIELD3’.