Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Processing of External Data →  Logical Databases (Obsolete) →  Logical Databases - Components →  Logical Databases - Further Elements 

Logical Databases - Field Selections

The statement SELECTION-SCREEN FIELD SELECTION FOR NODE|TABLE node specifies a node node of a logical database in the selection include for field selections. This means that individual columns can be named in the SELECT clause in the SELECT statements of the corresponding subroutine put_node, instead of just all columns with an asterisk *. This option is used to keep the amount of data passed from the database low and gives better performance than always reading the data from all columns in a database table.

The columns read for each node specified for field selections can be specified using the FIELD addition of the statement GET in the associated executable program or in the parameter FIELD_SELECTION of the function module LDB_PROCESS. The database program of the logical database has access to the names of the columns in the data object select_fields. This data object is generated automatically in the logical database program with reference to the type rsfs_fields of the type group RSFS. The data object can also be used in every application program associated with the logical database program.

select_fields is a deep internal table with the components tablename and fields. In each row, the column tablename contains the name of a node reserved for field selections. For each of these nodes, the table-like component fields contains the columns specified in the GET statements of the application program. The table fields is defined so that it can be used directly to specify columns dynamically in a SELECT statement.

Other versions: 7.31 | 7.40 | 7.54


Example

The database table SCARR is the root node of the logical database DEMO and the table SPFLI is the only successor. The selection include DBDEMOSEL contains the following lines:

SELECT-OPTIONS s_carrid FOR scarr-carrid.
SELECT-OPTIONS s_connid FOR spfli-connid.
SELECTION-SCREEN FIELD SELECTION FOR TABLE spfli.

The subroutine put_spfli of the database program SAPDBDEMO uses the field selections as follows:

FORM put_spfli.
  STATICS: fieldlists TYPE rsfs_tab_fields,
           flag_read TYPE abap_bool.
  IF flag_read = abap_false.
    fieldlists-tablename = 'SPFLI'.
    READ TABLE select_fields WITH KEY fieldlists-tablename
                             INTO fieldlists.
    flag_read = abap_true.
  ENDIF.
  SELECT (fieldlists-fields)
         FROM spfli
         INTO CORRESPONDING FIELDS OF spfli
         WHERE carrid = scarr-carrid
           AND connid IN s_connid.
    PUT spfli.
  ENDSELECT.
ENDFORM.

The row of the internal table select_fields for which the column tablename contains the value "SCARR" is read to the local helper structure fieldlists. The STATICS statements and the field flag_read make sure that the table select_fields only needs to be read once each time the program is executed. The table fieldlists-fields is used in the dynamic SELECT clause. An executable program associated with the logical database can now contain the following lines:

NODES spfli.
...
GET spfli FIELDS cityfrom cityto.
...

The FIELDS addition of the statement GET defines which fields of the database table (except the primary key) are to be read by the logical database. Internally, the runtime environment fills select_fields with the appropriate values. These values can be checked in ABAP Debugger.