Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9052

Re: Not Understanding this code: (field-symbol) to create dynamic ALV table

$
0
0

Hi sami,

 

this is ABAP syntax.

 

ptr is defined as REF TO DATA, this means ptr does not store actual data but contains the memory address of those data. This is called a pointer to the data. ptr->* is the ABAP representation of these data.

 

METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE creates a data object, namely an internal table with the column structure given with the field catalog. As we have to named type for this table, the method returns the pointer ptr which gives the memory address of this internal table.

 

A field-symbol is a representative of the data object it is assigned to. In this case <FS_TAB> is defined as TYPESTANDARDTABLE.


The statement ASSIGN ptr->* TO<FS_TAB> will make the field-symbol <FS_TAB> a representative of the data object referenced by ptr->*.


Now we can use it in INTO CORRESPONDING FIELDSOFTABLE<FS_TAB> and we do not get a syntax error because a internal table is expected and the field-symbol is defined to represent a STANDARD (internal) TABLE. INTO CORRESPONDING FIELDSOFTABLE ptr->* does not compile because the compiler can't know that ptr references an internal table.


The parenthesis used for (P_TABLE) is also ABAP syntax and just means that the system should not use the variable P_TABLE here but it's actual content. SELECT * FROMneeds a table name. The parenthesis mean that the actual content of the character or string variable shall be used here.


Hope that sheds a little light on it.


BTW: I don't like C++ either. Probably because I never got used to it.


Regards


Clemens




Viewing all articles
Browse latest Browse all 9052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>