Skip to Content

  Passing data to Dynamic Selections of LDB in LDB_PROCESS Function Module

Though using LDB is considered to be less effective to query in a custom application program, there are certain requirements in real time scenario to use LDB. I had such requirement recently, to use LDB for a custom program & I had to restrict the data selection using the dynamic selections available in LDB Selection Screen. I found there is a very little guidance in this area & I had spent 2 hours to see how to pass dynamic selection parameter to LDB_PROCESS Function Module. Hence thought sharing this would help developers to save their development efforts.

LDB Taken for Example – ADA – Assets Database

A portion of ADA selection screen captured below:

/wp-content/uploads/2013/09/1_288117.png
Let us see how to apply the field – Last inventory On – ANLAV-IVDAT existing in dynamic selection in LDB_PROCESS Function module.

/wp-content/uploads/2013/09/2_288119.png

    CALL FUNCTION ‘LDB_PROCESS’
EXPORTING
ldbname                  = lc_ldb_ada -> LDB to be used
variant                     = space
expressions            = li_texpr -> Dynamic selections
TABLES
callback                  = li_callback -> Forms to save data to internal table
selections               = li_seltab  -> Values to
Selection fields     

EXCEPTIONS
ldb_not_reentrant           = 1 …

   The dynamic selections are to be passed to the parameter ‘EXPRESSIONS’

    Data needed for passing this parameter:


*–Local Internal Table————————————————
lw_trange TYPE rsds_range“Range Workarea
lw_freange TYPE  rsds_frange,” Range Workarea – Final

      li_selopt TYPE rsds_selopt_t,“Select Options
li_texpr TYPE rsds_texpr, “Expression
li_trange TYPE rsds_trange, “Range Table
li_frange TYPE rsds_frange_t, “Rangle Table – Final

*–Local Work Area—————————————————–
lw_trange TYPE rsds_range“Range Workarea
lw_freange TYPE  rsds_frange,” Range Workarea – Final

*–Last Inventory Date from custom program Selection Screen
APPEND LINES OF s_ivdat TO li_selopt.
lw_freangefieldname = lc_ivdat.
lw_freangeselopt_t = li_selopt.
APPEND lw_freange TO li_frange.

*–Convert to type Expressions

    CALL FUNCTION ‘FREE_SELECTIONS_RANGE_2_EX’
EXPORTING
field_ranges = li_trange
IMPORTING
expressions  = li_texpr.

Now call your LDB_PROCESS with these parameters & selection tab filled. You will see the data being pulled from LDB are restricted as per the filters added in LI_TEXTPR.

CALL FUNCTION ‘LDB_PROCESS’
EXPORTING
ldbname                     = lc_ldb_ada -> LDB to be used
variant                     = space
expressions                 = li_texpr   -> Dynamic selections
TABLES
callback                    = li_callback -> Forms to save data
to internal table
selections                  = li_seltab -> Values to
Selection fields

EXCEPTIONS
ldb_not_reentrant           = 1 …

Good Luck!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply