Entering content frame

Object documentation GET Subroutines Locate the document in its SAP Library structure

Definition

With the exception of the document level, exactly one GET subroutine belongs to each form level. The name of the GET subroutine is composed of the prefix GET, the name of the next highest form level, and the name of the form level itself.
READ subroutines are at the start of a print program, and called up once only; the calls of the GET subroutines are dependent on the hierarchy in the application form.

Use

GET subroutines are used to procure the n data records for a form level dependent on the data of the next highest form level. The n data records determined are processed sequentially in the generated print program. You can follow two strategies.

·        All the data for a form level is obtained in the relevant READ subroutine and defined in the global table. During the call, the GET subroutine then extracts the data records from the table that belong to the current entry of the next highest form level.

·        The affiliated READ subroutine is empty. In the GET subroutine you procure the current data for the form level from the database directly or from other application-defined data buffers.

When you are developing a form class, you have to decide which strategy to use based on the data constellation and program design.

Structure

The interface of a GET subroutine contains the variables that are set as prerequisite or result for the call in by the Print Workbench in accordance with their hierarchical position. Within the READ subroutine however, you can use all global data areas (<T_*> or <WA_*>) of the same form level or all form levels higher in the hierarchy.
There is no GET subroutine for the document level as loop of the hierarchy.

Integration

The GET subroutines are then called in the generated print program of an application form if a form level is to be processed according to the hierarchy of an application form. The data records received are then processed sequentially.

The GET subprograms are copied to the print program when you activate an application form.

Example

The source text of the GET subroutine of the form level FLIGHT is as follows. Since the posting data is read from the database in the READ subroutine, you only have to extract data from the internal global table T_BOOKING.

*&---------------------------------------------------------------------*

*&    Form get_form GET_CUSTOMER_BOOKING

*&---------------------------------------------------------------------*

FORM get_customer_booking

      TABLES

        yt_booking      STRUCTURE sbook

      USING 

         x_customer      TYPE scustom.

  REFRESH yt_booking.

  LOOP AT t_booking WHERE customid = x_customer-id.

    APPEND t_booking TO yt_booking.

  ENDLOOP.

ENDFORM.       "GET_CUSTOMER_BOOKING

 

Leaving content frame