Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Sep 26, 2017 at 01:57 PM

    Did you try to

    • Add APOFASISAP to the input parameters (so use a MODIFY itab statement and not an APPEND)
    • Move the code to the SELECT step and select data yourself in the exit
    Add comment
    10|10000 characters needed characters exceeded

    • If your code is in the 'SELECT' step, I would then expect that you perform the final SELECT from database yourself and then call FM F4UT_RESULTS_MAP to transfer the result to the search help, so you should be able to solve the no-values yourself?

      If you don't perform the final select yourself, give more information, like did you change the callcontrol-step value, e.g. to 'DISP' like when result is already mapped in a correct 'SELECT' step or 'PRESEL' to get back to selection-screen when there were no record for the required field so user will see the selection and next execution will go thru the following steps?