Skip to Content
0
Sep 26, 2017 at 09:36 AM

How to pass a value in fields in a Search-Help with FM EXIT

108 Views

I have a Search Help with many fields to be displayed to the user in order to apply values. I want from the user to give 3 fields APOFASI-SKOPOS-KATDANL. in the CALLCONTROL-STEP = SELECT in the EXIT FM, I want to get these values in variables then I make some selects and find another field APOFASISAP. I am trying to pass back to the selection fields of the search help the field APOFASSISAP with the value I found and in the APOFASI to be blank. The code is:

READ TABLE shlp-selopt INTO wa_shlp_selopt
                            WITH KEY shlpfield = 'APOFASI'.
lv_apofasi = wa_shlp_selopt-low.
ls_result-apofasi = ''.
IF lv_apofasi <> ''.
  wa_shlp_selopt-low = ''.
  MODIFY shlp-selopt FROM wa_shlp_selopt INDEX sy-tabix.
ENDIF.

READ TABLE shlp-selopt INTO wa_shlp_selopt WITH KEY shlpfield = 'SKOPOS'.
lv_skopos = wa_shlp_selopt-low.

READ TABLE shlp-selopt INTO wa_shlp_selopt WITH KEY shlpfield = 'KATDANL'.
lv_katdanl = wa_shlp_selopt-low.

SELECT SINGLE apofasisap INTO lv_apofasisap_arx
  FROM zsl_glk_apof
  WHERE apofasi = lv_apofasi.

SELECT * FROM zsl_glk_apof_tr
  WHERE apofasisap_trp = lv_apofasisap_arx.

  wa_apofasisap_tr-apofasisap_tr = zsl_glk_apof_tr-apofasisap_tr.
  APPEND wa_apofasisap_tr TO it_apofasisap_tr.

ENDSELECT.
wa_shlp_selopt-shlpname  = 'ZAPOF_TROP'.
wa_shlp_selopt-shlpfield = 'APOFASISAP'.
wa_shlp_selopt-sign      = 'I'.
wa_shlp_selopt-option    = 'EQ'.
wa_shlp_selopt-low       = wa_apofasisap_tr-apofasisap_tr.
APPEND wa_shlp_selopt TO shlp-selopt.

This code does not replace/add the values to the appropriate fields.

Can someone help on this?

Thanks in advance,

Elias