ABAP Keyword Documentation → ABAP - Reference → Declarative statemnts → Data Types and Data Objects → Declaring Data Objects
NODES
Other versions: 7.31 | 7.40 | 7.54
Syntax
NODES node [TYPE type].
Effect
The sole effect of the NODES
statement is to pass data from
logical databases to
executable programs. It defines an
interface
work area and is allowed only in the global declaration section of executable programs that are associated with a logical database, and in the
database program of
logical databases. node
must be the name of a node of the logical database. NODES
declares a
table work area
node for the respective node. The data type of the table work area is either predefined in the node of the logical database or can be chosen from a list using the addition TYPE
.
The nodes of the structure of a logical database are entered in transaction SE36 and can have the following node types:
-
Node Type T
The data type of the table work area can be a flat structure from ABAP Dictionary, in particular a database table or a view. The name of the node must be identical to the name of the structure.
In this case, the statementsNODES
and TABLES have the same meaning. In the executable program, you can use either theNODES
or theTABLES
statement for every node of type T, wherenode
is the name of the node or of the structure. AdditionTYPE
is not allowed. The database program contains oneTABLES
statement for every node of type T. -
Node Type S
The data type of the table work area can be any data type from ABAP Dictionary. The name of the node can differ from the name of the type.
In executable programs, aNODES
statement can be specified for each node of type S. AdditionTYPE
is not allowed. The database program contains oneNODES
statement for every node of type S. -
Node Type C
The data type of the table work area can be any data type from a type group. The name of the node can differ from the name of the type.
In executable programs, aNODES
statement can be specified for each node of type C. AdditionTYPE
is not allowed. The database program contains oneNODES
statement for every node of type C. -
Node Type A
A list of any data types from ABAP Dictionary is assigned to this node. The actual type is determined in the executable program by theTYPE
addition of theNODES
statement.
In the executable program, you can specify aNODES
statement for every node of type A, where you must use additionTYPE
to specify one of the assigned data types from the list. The additionTYPE
defines the data type of the table work area in the executable program and in the database program. The database program contains aNODES
statement without theTYPE
addition for every node of type A.
The NODES
(or TABLES
) statement of the
executable program
controls the structure of the standard selection screen of the logical database. Only those input fields
are displayed, for whose nodes (or a node lying directly below in the hierarchy) a corresponding NODES
(or TABLES
) statement appears in the executable program.
The database program is responsible for assigning data to the table work area. For every node of the
logical database, there is a subroutine put_node
in the database program,
which uses the PUT
statement to signal to the executable program that data is available in the table work area node
.
For all table work areas node
specified after NODES
(or TABLES
) in the executable program, you can create event blocks for the
reporting events
GET node [LATE]
. The events are triggered by the PUT
node or PUT <node>
statements in the database program. After an
event of this type, the table work area filled in the database program can be evaluated in the executable
program. For nodes of type A, the data is available only within the event blocks. For all other types, the data is available throughout the executable program.
Notes
-
Table areas declared with
NODES
behave like common data declared with the additionCOMMON PART
. They are shared by the programs of a program group. -
Always use
NODES
and notTABLES
for interface work areas for logical databases. In this way, you make clear that they are nodes of logical databases. -
If logical databases are no longer used, then you no longer need to use the statement
NODES
either.
Example
A logical database contains a root node root_node
of node type S, to which the data type INT4 is assigned. The top include of the database program then contains the statement:
NODES root_node.
In addition, the database program contains the following subroutine:
FORM put_root_node.
DO 10 TIMES.
root_node = sy-index.
PUT root_node.
ENDDO.
ENDFORM.
If the executable program
below is associated with the logical database, it receives the numbers 1 through 10 in the table work
area root_node
when the program is executed and writes them to a list when the event event GET
occurs:
REPORT demo_nodes.
NODES root_node.
GET root_node.
WRITE root_node.