SAP NODES ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for NODES

NODES

Short Reference
• NODES ABAP Statement
• TYPE NODES (obsolete)

ABAP Syntax(Obsolete)NODES node [TYPE type].

What does it do? 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 statements NODES and TABLES have the same meaning. In the executable program, either the statement NODES or the statement TABLES can be used for every node of type T, where node is the name of the node or of the structure. Addition TYPE is not allowed. The database program contains one TABLES 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, a NODES statement can be specified for each node of type S. Addition TYPE is not allowed. The database program contains one NODES 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, a NODES statement can be specified for each node of type C. Addition TYPE is not allowed. The database program contains one NODES 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 the TYPE addition of the NODES statement.

In the executable program, the statement NODES can be specified for every node of type A. Here, the addition TYPE must be used to specify one of the assigned data types from the list. The addition TYPE defines the data type of the table work area in the executable program and in the database program. The database program contains a NODES statement without the TYPE 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, event blocks can be created 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.

Latest notes:Table areas declared with NODES behave like common data declared with the addition COMMON PART . They are shared by the programs of a program group. Always use NODES and not TABLES for interface work areas for logical databases. In this way, it is made clear that they are nodes of logical databases. If logical databases are no longer used, the statement NODES is no longer needed either.



Example ABAP Coding
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.

Return to menu