Skip to content

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

Logical Database, Call by Function Module

This example demonstrates calling a logical database using the function module LDB_PROCESS.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    DATA callback    TYPE TABLE OF ldbcb.

    DATA: seltab    TYPE TABLE OF rsparams,
          seltab_wa LIKE LINE OF seltab,
          scarr_wa  LIKE LINE OF s_carr.

    CALL SELECTION-SCREEN 1100 STARTING AT 10 10.
    IF sy-subrc <> 0.
      RETURN.
    ENDIF.

    callback = VALUE #( ( ldbnode     = 'SPFLI'
                          get         = 'X'
                          get_late    = 'X'
                          cb_prog     = sy-repid
                          cb_form     = 'CALLBACK_SPFLI' )
                        ( ldbnode     = 'SFLIGHT'
                          get         = 'X'
                          cb_prog     = sy-repid
                          cb_form     = 'CALLBACK_SFLIGHT' ) ).

    seltab_wa-kind = 'S'.
    seltab_wa-selname = 'CARRID'.
    LOOP AT s_carr INTO scarr_wa.
      MOVE-CORRESPONDING scarr_wa TO seltab_wa.
      APPEND seltab_wa TO seltab.
    ENDLOOP.

    CALL FUNCTION 'LDB_PROCESS'
      EXPORTING
        ldbname                     = 'F1S'
        variant                     = ' '
      TABLES
        callback                    = callback
        selections                  = seltab
      EXCEPTIONS
        OTHERS                      = 4.

    IF sy-subrc <> 0.
      WRITE: 'Exception with SY-SUBRC', sy-subrc.
    ENDIF.

Description

The program reads data using the logical database F1S. First a program-specific selection screen is defined. The data object wa_spfli is only required here. Next, suitable variables for the interface are declared.

The internal table callback is filled in such a way that, for the two nodes SPFLI and SFLIGHT, different callback routines in the calling program are called. For the node SPFLI, the corresponding routine for GET and GET LATE is only to be called for GET in the case of SFLIGHT.

The internal table seltab is filled with values from the selection table s_carr of the standalone selection screen 1100 for the selections of node SPFLI.

The function module LDB_PROCESS is called with these parameters.

The subroutines callback_spfli and callback_sflight are used as callback routines. Since the interface parameter wa is completely typed, the individual components of the work area can be accessed. In callback_spfli, the events GET and GET LATE are handled differently.