Independent Calls and the Database Program 

If you call logical databases independently using the function module LDB_PROCESS, you can call special subroutines in the database program:

LDB_PROCESS_INIT

If you want to call a logical database more than once in succession, the database program must contain the following subroutine:

FORM LDB_PROCESS_INIT CHANGING SUBRC LIKE SY-SUBRC.
  ...
  SUBRC = 0.
ENDFORM.

This is the first subroutine to be called in the database program. Once the parameter SUBRC has been set to 0, the logical database can perform the initialization routines required to allow it to be called more than once. If the parameter SUBRC is not set to 0, the function module LDB_PROCESS triggers the exception LDB_NOT_REENTRANT.

LDB_PROCESS_CHECK_SELECTIONS

When you call a logical database using LDB_PROCESS, there is no selection screen processing. Instead, the selections are passed to the function module as interface parameters. The PAI subroutine is not called. However, if you still want to check the selections, you can define the following subroutine in the database program:

FORM LDB_PROCESS_CHECK_SELECTIONS CHANGING SUBRC LIKE SY-SUBRC
                                           MSG ..LIKE SYMSG.    
  ...
  SUBRC = ...
ENDFORM.

This subroutine is called after the parameters and selection tables of the selection screen have been filled from the interface parameters of LDB_PROCESS. If the parameter SUBRC is not set to 0, the function module LDB_PROCESS triggers the exception LDB_SELECTIONS_NOT_ACCEPTED. You can assign a message to the structured parameter MSG. This is available to the caller of the function module in the system fields SY-MSG... The eight components of MSG contain the message type, ID, and number, and up to four message variables.