sapdev logo background
sapdev logo sapdev logo
Comments

ABAP CREATE DATA IMPLICIT Statement syntax, information and example SAP source code



Return to Statement index



CREATE DATA dref

Short Reference

ABAP Syntax_1 CREATE DATA dref [
area_handle ].

What does it do? If neither of the additions TYPE or LIKE is specified, the data reference variable dref must be fully typed. The data object is then created with the static data type of the data reference variable.

Example ABAP Coding Creates an internal table and a data object of type
i . The data objects are created directly before they are used and are then initialized by the reference variables and passed to the garbage collector . The data objects are accessed by dereferencing the data references.
TYPES t_itab TYPE TABLE OF i WITH NON-UNIQUE KEY table_line.

DATA: tab_ref TYPE REF TO t_itab,
i_ref TYPE REF TO i.

DO 10 TIMES.
IF tab_ref IS INITIAL.
CREATE DATA tab_ref.
ENDIF.
APPEND sy-index TO tab_ref->*.
ENDDO.

IF tab_ref IS NOT INITIAL.
IF i_ref IS INITIAL.
CREATE DATA i_ref.
ENDIF.
LOOP AT tab_ref->* INTO i_ref->*.
cl_demo_output=>write( |{ i_ref->* }| ).
ENDLOOP.
ENDIF.
cl_demo_output=>display( ).

CLEAR: tab_ref, i_ref.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




CREATE_DATA_HANDLE
CREATE_DATA_ITAB




comments powered by Disqus