display a help value and return selected value(s)

Display a help value using function modules on an F4 event.

* Local Data -----------------------------------------------------------
  data: ls_shlp          type shlp_descr.
  data: ls_interface     type ddshiface.
  data: ls_interface_inp like line of it_interface.
  data: ld_subrc         type sy-subrc.
  data: ld_flg_active    type boole-boole.

* check input parameter ------------------------------------------------
  if id_shlpname is initial.
    zcx_pbw_gui=>gd_dmy = text-001.
    raise exception type zcx_pbw_gui
      exporting
        textid = zcx_pbw_gui=>error_shlp
        var1   = zcx_pbw_gui=>gd_dmy
        .
  endif.

* get description of search help ---------------------------------------
  call function 'F4IF_GET_SHLP_DESCR'
    exporting
      shlpname = id_shlpname
    importing
      shlp     = ls_shlp
    exceptions
      others   = 1.

  if ( sy-subrc <> 0 ).
    zcx_pbw_gui=>gd_dmy = text-002.
    raise exception type zcx_pbw_gui
      exporting
        textid = zcx_pbw_gui=>error_shlp
        var1   = zcx_pbw_gui=>gd_dmy
        .
  endif.

* mark all entries for which we want to have some values back
  loop at ls_shlp-interface into ls_interface.
    ls_interface-valfield = 'X'.
*   if we have input values write them in search help structure
    read table it_interface into ls_interface_inp with key
                                 shlpfield  = ls_interface-shlpfield
                                 valtabname = ls_interface-valtabname.
    if ( sy-subrc = 0 ).
      ls_interface-value = ls_interface_inp-value.
    endif.    " sy-subrc = 0
    modify ls_shlp-interface from ls_interface.
  endloop.

* call search help
  call function 'F4IF_START_VALUE_REQUEST'
    exporting
      shlp          = ls_shlp
*      multisel      = i_multisel
    importing
      rc            = ld_subrc
    tables
      return_values = rt_values
    exceptions
      others        = 1.

  if ( sy-subrc <> 0 ).
    zcx_pbw_gui=>gd_dmy = text-002.
    raise exception type zcx_pbw_gui
      exporting
        textid = zcx_pbw_gui=>error_shlp
        var1   = zcx_pbw_gui=>gd_dmy
        .
  endif.