Create search hlp with a parameter for a standard field in screen exit?

855 views Asked by At

In an exit screen I added a new field, everything is ok for display/modification/save management.

Now I would like to add a search help on this field, but the need is relatively complex so I have to do a specific search help with a search help exit (thus with an FM).

First I would like to provide as a parameter to my search help the value of a field of my standard screen (with its ID parameter?) because from this value I have to perform a process (execution of methods of different nested objects with rules complex management) which will give me the result to display.

The result must be of the form: Code/Text, on two columns. For example I could have:

CODE1 Text code 1
CODE2 Text code 2
CODE3 Text code 3

I have already created the search help as well as the FM for the search help exit, I manage to trigger the search help on the field, but in debug I cannot recover this standard zone in the FM interface.

1

There are 1 answers

1
PaulDaigle On

I recommend using the F4IF_INT_TABLE_VALUE_REQUEST function. The function works with a table with "mapping" data and another with the data you want to display in the search help. And in the return table you can read the data on which the user clicked. The 'tl_city' table corresponds to the data that will be displayed in the search help and 'tl_return' will have the row selected by the user.

Here is a basic example:

CLEAR wl_map.
wl_map-fldname   = 'F0001'.
wl_map-dyfldname = 'CITYFROM'.
APPEND wl_map TO tl_map.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
  retfield        = 'CITYFROM'
  value_org       = 'S'
TABLES
  value_tab       = tl_city
  dynpfld_mapping = tl_map
  return_tab      = tl_return
EXCEPTIONS
  parameter_error = 1
  no_values_found = 2
  OTHERS          = 3.

  READ TABLE tl_return INTO wl_return INDEX 1.
  IF sy-subrc IS INITIAL.

      p_ctfr = wl_return-fieldval.
  ENDIF.