Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Processing of External Data →  Logical Databases 

Logical Database, Call

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,
          callback_wa LIKE LINE OF callback.

    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_wa-ldbnode     = 'SPFLI'.
    callback_wa-get         = 'X'.
    callback_wa-get_late    = 'X'.
    callback_wa-cb_prog     = sy-repid.
    callback_wa-cb_form     = 'CALLBACK_SPFLI'.
    APPEND callback_wa TO callback.

    CLEAR callback_wa.
    callback_wa-ldbnode     = 'SFLIGHT'.
    callback_wa-get         = 'X'.
    callback_wa-cb_prog     = sy-repid.
    callback_wa-cb_form     = 'CALLBACK_SFLIGHT'.
    APPEND callback_wa TO callback.

    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
        ldb_not_reentrant           = 1
        ldb_incorrect               = 2
        ldb_already_running         = 3
        ldb_error                   = 4
        ldb_selections_error        = 5
        ldb_selections_not_accepted = 6
        variant_not_existent        = 7
        variant_obsolete            = 8
        variant_error               = 9
        free_selections_error       = 10
        callback_no_event           = 11
        callback_node_duplicate     = 12
        OTHERS                      = 13.

    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 independent 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.