ABAP Get Columns of a Table with Includes in Structure

There are multiple ways of making use of the subclasses of cl_abap_typedescr to get info on runtime instance data objects in ABAP. This is just one of the ways to get the columns of an internal table where its line structure has includes.

Suppose you start with an internal table named “table

DATA table_descr TYPE REF TO cl_abap_tabledescr.
DATA struct_descr TYPE REF TO cl_abap_structdescr.
DATA columns TYPE abap_compdescr_tab.
<column> LIKE LINE OF columns.
table_descr ?= cl_abap_typedescr=>describe_by_data( table ).
struct_descr ?= table_descr->get_table_line_type( ).
columns = struct_descr->components.
LOOP AT columns ASSIGNING <column>.
    [do something with] <column>-name.

cl_abap_structdescr also has a GET_COMPONENTS( ) method but it doesn’t return a flat structure (doesn’t unpack includes). Of course, this doesn’t do any error checks and would crash if “table” isn’t a table.

.NET Compare 2 Datarows by Value Using LINQ

There are too many top Google search results giving the impression that it is impossible to compare 2 DataRows for its value contents and the programmer needs to iterate through everything himself.

Such is no longer true in .NET 3.5 but the blogosphere doesn’t seem to have caught on yet.

It is possible, given 2 DataTables or any other enumerable object types, to compare its contents using LINQ in just one line of code.

I will give an example in VB where I’d want to compare all column properties (description, data type, field length, etc) of all tables in 2 supposedly identical SQL databases. Read More…

 Scroll to top