GET

Basic form 1

GET node.

Extras:

1. ... LATE

2. ... FIELDS f1 ... fn

Effect

Event Keyword:

Triggers the associated events when data is read in an executable (type 1) program using a logical database.

node is a node in the logical database that is assigned to the report (type 1 program) in the program attributes. You must declare the node in the report using the NODES statement (or the TABLES statement, if the node is of the type "table").
The node node corresponds to a data object of the same name.
node is available for processing during the flow of the logical database. Moreover, you can also make reference to the fields from the node that lie on the access path for node in the logical database associated with the report - unless the node is of the dynamic dictionary type.

Notes

  1. You can use the event "GET dbtab." only once in the report.


The GET events are implemented internally as FORM routines. This makes all data objects declared with DATA local, that is, they are only recognized and addressable within the event. This also applies to AT SELECTION-SCREEN ....

  1. The logic is somewhat different for nodes of the dynamic dictionary type. You must declare these nodes in the report using the NODES node TYPE type statement. In this case, type a dictionary type from the logical database for the node node - that is, the type of the data object node assigned to the node node can differ in different reports. In this case, the data object node is local to the -GET event and has the structure type. Outside the -GET event, a (global) data object node also exists and has the static type assigned to the node. The actual data is, however, returned in the local field node and is available only within the -GET event.


Example

The program uses the logical database F1S which has a structure where the table BOOKING appears below the table FLIGHT.

NODES: SFLIGHT, SBOOK.

GET SFLIGHT.
  WRITE: SFLIGHT-CARRID,
         SFLIGHT-CONNID,
         SLFIGHT-FLDATE,
         SFLIGHT-PLANETYPE.

GET SBOOK.
  WRITE: SBOOK-BOOKID,
         SBOOK-CUSTOMID,
         SBOOK-ORDER_DATE.

Addition 1

... LATE.

Effect

Executes the code following "GET dbtab LATE." only when all the subordinate tables have been read and processed.

Example

Count the smokers among the bookings already made:

NODES: SFLIGHT, SBOOK.
DATA SMOKERS TYPE I.

GET SFLIGHT.
  ULINE.
  WRITE: / SFLIGHT-SEATSMAX,
           SFLIGHT-SEATSOCC.
  SMOKERS = 0.

GET SBOOK.
  CHECK SBOOK-SMOKER <> SPACE.
  ADD 1 TO SMOKERS.

GET FLIGHT LATE.
  WRITE SMOKERS.

Addition 2

... FIELDS f1 ... fn

Effect

Performance option. Addresses only the fields f1, ..., fn of the data object node (also possible with a dynamic ASSIGN). Since only these fields have to be assigned values by the logical database, this can improve performance considerably.

Notes

  1. The addition (for GET dbtab or GET dbtab LATE ) is allowed only for tables intended for field selection by the logical database ( SELECTION-SCREEN FIELD SELECTION FOR TABLE dbtab).

  2. When processing the events GET node, GET node LATE or GET node_2 for a subordinate table dbtab_2 in the database hierarchy, the contents of all fields of node apart from f1, ..., fn are undefined.

  3. If both GET node FIELDS f1 ...fn and GET node LATE FIELDS g1 ...gm occur in the program, values are assigned to all the fields f1, ..., fn, g1, ..., gm.

  4. In addition to the specified fields, values are also assigned to the key fields of node.

  5. If you use the FIELDS addition, you access only the specified fields. Any external PERFORM calls should be taken into account here.

  6. A special rule applies for tables which are intended for field selection by the logical database, for which neither a GET dbtab nor a GET dbtab LATE event exists in the program, yet for which there is a subordinate table dbtab_2 with GET dbtab_2 or GET dbtab_2 LATE in the program.

    If the table is declared with NODES dbtab in the program, the work area of dbtab exists for GET dbtab_2 or GET dbtab_2 LATE and can therefore receive values. Also, if a restricted field selection is sufficient for dbtab, you can achieve this with a GET dbtab FIELDS f1 ... fn statement (without subsequent processing).

    If the program contains no NODES dbtab statement, it is assumed that there is no access to the work area of dbtab. In this case, therefore, only the key fields of dbatab are assigned values. If, however, you want to fill the work area of dbtab completely (e.g. for an external PERFORM call), you must include the NODES dbtab statement in the program.

  7. The field lists are made available to the report and the logical database in an internal table SELECT_FIELDS.


  8. The exact definition of the object SELECT_FIELDS is stored in the TYPE-POOL RSFS and reads:

    TYPES: BEGIN OF RSFS_TAB_FIELDS,
    TABLENAME LIKE RSDSTABS-PRIM_TAB,
    FIELDS LIKE RSFS_STRUC OCCURS 10,
    END OF RSFS_TAB_FIELDS.

    ...

    TYPES: RSFS_FIELDS TYPE RSFS_TAB_FIELDS OCCURS 10.

    DATA SELECT_FIELDS TYPE RSFS_FIELDS.


    SELECT_FIELDS is thus an internal table where each line contains a table name (TABLENAME), while another internal table (FIELDS) contains the desired table fields ( TABLENAME ).

    Neither the TYPE-POOL RSFS nor the declaration of SELECT_FIELDS have to be in the report. Both are automatically included by the system, if required. If, for some reason, you need to assign values to more fields, you can manipulate this table under INITIALIZATION or START-OF-SELECTION.


Examples

  1. Specify the necessary fields under GET. Both SFLIGHT and SBOOK must be defined for field selection.


NODES: SFLIGHT, SBOOK.

GET SFLIGHT FIELDS CARRID CONNID FLDATE PLANETYPE.
  WRITE: SFLIGHT-CARRID,
         SFLIGHT-CONNID,
         SFLIGHT-FLDATE,
         SFLIGHT-PLANETYPE.

GET SBOOK FIELDS BOOKID CUSTOMID ORDER_DATE.
  WRITE: SBOOK-BOOKID,
         SBOOK-CUSTOMID,
         SBOOK-ORDER_DATE.



  1. In the above 'smoker' example, you can also specify the required SFLIGHT fields under 'GET SFLIGHT LATE':


NODES: SFLIGHT, SBOOK.
DATA SMOKERS TYPE I.

GET SFLIGHT.
  ULINE.
  WRITE: / SFLIGHT-SEATSMAX,
           SFLIGHT-SEATSOCC.
  SMOKERS = 0.

GET SBOOK FIELDS SMOKER.
  CHECK SBOOK-SMOKER <> SPACE.
  ADD 1 TO SMOKERS.

GET SFLIGHT LATE FIELDS SEATSMAX SEATSOCC.
  WRITE SMOKERS.



  1. Only fields from SBOOK are output. No NODES SFLIGHT statement exists. Then, for the table SFLIGHT, only the key fields are read (regardless of whether the FIELDS addition is used with GET SBOOK or not).


NODES: SBOOK.

GET SBOOK FIELDS BOOKID CUSTOMID ORDER_DATE.
  WRITE: SBOOK-BOOKID,
         SBOOK-CUSTOMID,
         SBOOK-ORDER_DATE.



  1. Only fields from SBOOK are output, but SFLIGHT is declared by NODES SFLIGHT. In this case, all the fields of table SFLIGHT are read (regardless of whether the FIELDS addition is used with GET SBOOK or not).


NODES: SFLIGHT, SBOOK.

GET SBOOK FIELDS BOOKID CUSTOMID ORDER_DATE.
  WRITE: SBOOK-BOOKID,
         SBOOK-CUSTOMID,
         SBOOK-ORDER_DATE.

Related

PUT

Additional help

Describing Reporting Events