ABAP: syntax for creating an internal table from an existing database table

I am new to ABAP. The study of internal tables has begun. I read about ways to create internal tables.

I applied the following syntax to create an internal table from an existing database table:

data: it_mara type table of mara. 

I am confused since mara is a table, and if both lhs and rhs are of the same type, then this should not be simple:

 data: it_mara type mara. 

What is the need to convert mara to a table when it is already a table?

+6
source share
3 answers

MARA is a transparent table, which means that it functions simultaneously with the type of MARA structure. This is how SAP works. :)

+4
source

Historical reasons (always a good guess ...).

The original and now obsolete way to declare a table (with the title line was DATA it_mara TYPE mara OCCURS 10 Without OCCURS you did not declare the table, so it became a structure. My assumption was that in order to maintain backward compatibility, which was not changed when entering TYPE TABLE OF .

+4
source

SAP DDIC table (transparent table, join table, cluster table) functions as a structure .

An internal table is a list of structure values ​​(= DDIC table ).

In your sample SAP DDIC MARA table (General Material Data), we can define it as an internal table as

 data: it_mara type STANDARD table of mara. 

which creates the internal table STANDARD

 data: it_mara type SORTED table of mara. 

which creates the internal table SORTED

+1
source

All Articles