Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Introduction

Dynamic Internal tables concept comes into existence when the developer is not sure of the structure of the internal table. This concept creates the structure and internal table during run time.

This document will explain the process of creating and processing dynamic internal tables.

Steps to be followed

Ø Create a reference variable.

DATA : wa_dref TYPE REF TO DATA.

Ø Create two field symbols; one for the internal table and other for the work area.

FIELD-SYMBOLS : <t_itab> TYPE ANY TABLE,
                <wa_itab>.

Ø Create a reference to the Structure for which you need to create a Dynamic Internal Table.

CREATE DATA wa_dref TYPE TABLE OF (s_tables-low).

Ø Assign this reference to the field symbol created for the Dynamic Internal Table.

ASSIGN wa_dref->* TO <t_itab>.

Now, <t_itab> will take the structure of the contents of the field s_tables-low.

Ø Create a reference to the internal table for which you need to create a Dynamic Work Area.

CREATE DATA wa_dref LIKE LINE OF <t_itab>.

Ø Assign this reference to the field symbol created for the Work Area.

ASSIGN wa_dref->* TO <wa_itab>.

Now, <wa_itab> will take the structure of the internal Table <t_itab>.

Ø Selecting data from the table whose name is held by s_tables-low is as follows.

    SELECT * FROM (s_tables-low)
     
INTO TABLE <t_itab>.

Note: The variable which holds the name of the table from which data has to be fetched should be mentioned within brackets.

Ø Processing Dynamic Internal Tables and Work Areas is the same as normal Internal Tables and Work Areas.

LOOP AT <t_itab> INTO <wa_itab>.

ENDLOOP.

2 Comments