Skip to Content

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

Sep 26, 2017 at 09:36 AM


avatar image

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.

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.

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,


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Raymond Giuseppi
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
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks Raymond. The APOFASISAP is in the input parameters but the user do not use it. I use append because it is not used from the user, namely the user do not input a value.

This code is in the SELECT option of the EXIT.




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?