Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax for creating internal table from existing database table?

I'm new to ABAP. Started learning about internal tables. I was reading on the ways to create internal tables.

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

data: it_mara type table of mara.

I'm confused since mara is a table and if both l.h.s and r.h.s are of the same type then shouldn't it be just:

data: it_mara type mara.

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

like image 413
The-Droidster Avatar asked Jun 08 '16 18:06

The-Droidster


2 Answers

MARA is a transparent table which means that it functions at the same time as the structure type MARA. This is the way SAP works. :)

like image 161
Jagger Avatar answered Oct 05 '22 05:10

Jagger


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

The original and nowadays obsolete way to declare a table (with a header line was DATA it_mara TYPE mara OCCURS 10. Without OCCURS, you didn't declare a table, so it became a structure. My guess would be that in order to maintain backwards compatibility, that wasn't changed when TYPE TABLE OF was introduced.

like image 33
vwegert Avatar answered Oct 05 '22 03:10

vwegert