This tutorial will help you use ABAP to connect to any web service and process the resulting output. ABAP has native support for XML so it will be easiest to get your information in XML format rather than JSON and others. For this example, I will use a CBC’s news feed but it can be Digg top stories, Twitter, anything. The XML should look something like the picture below where each news article is enclosed in <ITEM> tags. Read More…

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.

 Scroll to top