SAP MDG · DATA MODEL & UI

How to get Drop Down with Filters in MDG UI ?

SAP MDG OVS Help - All methods - Dop Down with Filter

Audience: ABAP developers who build FPM / SAP MDG UIs. Goal: the minimum code each IF_FPM_GUIBB_OVS~HANDLE_PHASE_0..3 method needs. For each one: what it is for, what it receives (IMPORTING), what it must hand back (EXPORTING / callback calls), and what the user sees. The samples are deliberately hardcoded so that the mechanics stay visible. Companion: MDG_OVS_Handle_Methods_Guide.md is a project-specific worked exa…

How to Code OVS Handle Methods in FPM (SAP MDG): A Generic Guide

Audience: ABAP developers who build FPM / SAP MDG UIs. Goal: the minimum code each IF_FPM_GUIBB_OVS~HANDLE_PHASE_0..3 method needs. For each one: what it is for, what it receives (IMPORTING), what it must hand back (EXPORTING / callback calls), and what the user sees. The samples are deliberately hardcoded so that the mechanics stay visible. Companion: MDG_OVS_Handle_Methods_Guide.md is a project-specific worked example with real data selection.

Release note: parameter names and the optional parameters of IF_WD_OVS differ between SAP_UI / NetWeaver releases. Check anything marked verify in your release in SE24 (IF_FPM_GUIBB_OVS, IF_WD_OVS, your superclass feeder).

Tags in code comments: " [CORE] = reusable pattern, keep as is. " [PROJECT] = project-specific, replace with your own.


1. What OVS is and when to use it

The Object Value Selector (OVS) is a value-help popup that your own ABAP code drives. In FPM, the feeder class of a GUIBB (form or list) implements IF_FPM_GUIBB_OVS. FPM calls one method per phase, and each method talks to the popup through IO_OVS_CALLBACK (REF TO IF_WD_OVS).

Use OVS when a DDIC search help cannot do the job: the list depends on runtime data (other fields, the current row, the change request, the user), it combines several sources, or one selection must fill several fields. If a DDIC search help works, use that instead.

PhaseMethodAimKey callback call
0HANDLE_PHASE_0Configure the popup textsset_configuration( )
1HANDLE_PHASE_1Define (and pre-fill) the search fieldsset_input_structure( )
2HANDLE_PHASE_2Read the criteria, return the result listquery_parameters, set_output_table( )
3HANDLE_PHASE_3Write the selected row back to the fieldselection, context_element
CODE
1[value help clicked] -> PHASE_0 (texts) -> PHASE_1 (search fields) 2 -> (auto-run | user presses Go) -> PHASE_2 (set_output_table) -> user picks a row 3 -> PHASE_3 -> value in field (each new search repeats PHASE_2)

Phase 1 does not search. The search runs in phase 2, either on Go or at once if phase 1 sets display_values_immediately = abap_true.


2. Setup (core)

  1. In the feeder class of the GUIBB (IF_FPM_GUIBB_FORM or IF_FPM_GUIBB_LIST), redefine the four OVS methods if the superclass already implements IF_FPM_GUIBB_OVS. If it does not, add INTERFACES if_fpm_guibb_ovs.
  2. Enter the feeder in the component configuration and give the field a display type with value help, such as Input Field. A Text View never offers F4.
  3. In GET_DEFINITION, set OVS_NAME and clear DDIC_SHLP_NAME:
ABAP
1METHOD if_fpm_guibb_form~get_definition. " or if_fpm_guibb_list~get_definition 2 super->if_fpm_guibb_form~get_definition( " [CORE] pass ALL params of your release 3 EXPORTING io_component_config = io_component_config 4 iv_display_type = iv_display_type " verify in your release 5 IMPORTING eo_field_catalog = eo_field_catalog 6 et_field_description = et_field_description ). 7 READ TABLE et_field_description ASSIGNING FIELD-SYMBOL(<ls_d>) 8 WITH KEY name = '<YOUR_FIELD>'. " [PROJECT] field name 9 IF sy-subrc = 0. 10 CLEAR <ls_d>-ddic_shlp_name. " [CORE] DDIC help must not win 11 <ls_d>-ovs_name = '<YOUR_FEEDER_CLASS>'. " [PROJECT] plain class name 12 ENDIF. 13ENDMETHOD.
  • ET_FIELD_DESCRIPTION has the type FPMGB_T_FORMFIELD_DESCR (form) or FPMGB_T_LISTFIELD_DESCR (list).
  • OVS_NAME must be the plain class name. A literal is safest. If you derive it at runtime, verify in your release that the plain name comes back.

Rules for every phase: check iv_field_name and delegate other fields to super->. Declare one search structure (phase 1 → query_parameters) and one result structure (phase 2 → selection) as class types. column_texts and label_texts are keyed by component name, and every component of the result type becomes a column.

The samples below use these class types and constant:

ABAP
1TYPES: BEGIN OF ty_search, " [CORE] phase 1 input = phase 2 query_parameters 2 key TYPE xubname, 3 text TYPE ad_namtext, 4 END OF ty_search, 5 ty_result TYPE ty_search, " [CORE] popup columns (key first, no technical fields) 6 tt_result TYPE STANDARD TABLE OF ty_result WITH EMPTY KEY. 7CONSTANTS gc_field TYPE name_komp VALUE '<YOUR_FIELD>'. " [PROJECT]

3. The four methods

Signatures are as in the companion guide. Verify in your release: list feeders get IV_INDEX, while form feeders may not. Every sample starts with the same guard, which is shown once here:

ABAP
1IF iv_field_name <> gc_field. " [CORE] not our field -> standard 2 super->if_fpm_guibb_ovs~handle_phase_N( ... ). " pass all parameters 3 RETURN. 4ENDIF.

3.1 HANDLE_PHASE_0: configuration

Aim: set the popup texts. No database work. Called: first, every time the value help opens.

IMPORTINGTypeMeaning
IV_FIELD_NAMENAME_KOMPField whose value help was pressed
IO_OVS_CALLBACKREF TO IF_WD_OVSCallback object to the popup
IV_INDEX (lists)IRow whose value help was pressed
EXPORTING / populate via callbackWhat to pass
(no exporting parameters)n/a
set_configuration( )window_title, table_header, column_texts (WDR_NAME_VALUE_LIST: name = result component, value = heading). Optional (verify in your release): label_texts, group_header, col_count, row_count
ABAP
1METHOD if_fpm_guibb_ovs~handle_phase_0. 2 " guard (see above) 3 io_ovs_callback->set_configuration( " [CORE] 4 window_title = 'Person Responsible'(w01) 5 table_header = 'Person Responsible List'(w02) 6 column_texts = VALUE wdr_name_value_list( 7 ( name = 'KEY' value = 'User ID'(c01) ) 8 ( name = 'TEXT' value = 'User Name'(c02) ) ) ). 9ENDMETHOD.

Common mistakes: selecting data here. Column names that differ from the result components (they must be upper case and match exactly). On screen: the popup title and the table header. Column headings appear with the rows.

3.2 HANDLE_PHASE_1: input structure

Aim: define and optionally pre-fill the search fields, and decide whether the search runs at once. Called: right after phase 0.

IMPORTINGTypeMeaning
IV_FIELD_NAME, IO_OVS_CALLBACK, IV_INDEX (lists)as in phase 0as in phase 0
EXPORTING / populate via callbackWhat to pass
(no exporting parameters)n/a
set_input_structure( )input: a structure, by value. Its components are the search fields and its values are the defaults. label_texts: optional, verify in your release. display_values_immediately: abap_true = run phase 2 now
ABAP
1METHOD if_fpm_guibb_ovs~handle_phase_1. 2 " guard (see above) 3 DATA(ls_input) = VALUE ty_search( key = 'J*' ). " [CORE] optional default 4 io_ovs_callback->set_input_structure( " [CORE] 5 input = ls_input 6 label_texts = VALUE wdr_name_value_list( 7 ( name = 'KEY' value = 'User ID'(c01) ) 8 ( name = 'TEXT' value = 'User Name'(c02) ) ) 9 display_values_immediately = abap_true ). 10ENDMETHOD.

Common mistakes: expecting a search here. Using a type other than the one phase 2 assigns to query_parameters. On screen: the search area with one input per component and a Go button. With abap_true, the result list shows at once as well.

3.3 HANDLE_PHASE_2: search and output

Aim: read the criteria and hand a result table to the popup. Called: after phase 1 (if display_values_immediately) and on every Go.

IMPORTINGTypeMeaning
IV_FIELD_NAME, IO_OVS_CALLBACKas in phase 0Read query_parameters from the callback
IV_INDEX (lists)IRow to which the search refers
EXPORTING / read or populate via callbackWhat to do
(no exporting parameters)n/a
query_parameters (read)REF TO data of the phase 1 structure. Check IS BOUND, then ASSIGN ->*
set_output_table( output = lt_result )Standard table by value (not REF #( )). An empty table = empty list
ABAP
1METHOD if_fpm_guibb_ovs~handle_phase_2. 2 " guard (see above) 3 FIELD-SYMBOLS <ls_q> TYPE ty_search. " [CORE] read criteria 4 IF io_ovs_callback->query_parameters IS BOUND. 5 ASSIGN io_ovs_callback->query_parameters->* TO <ls_q>. 6 ENDIF. 7 " [PROJECT] replace the hardcoded rows with get_candidates( <ls_q> ), see section 5 8 DATA(lt_result) = VALUE tt_result( 9 ( key = 'JDOE' text = 'John Doe' ) 10 ( key = 'ASMITH' text = 'Alex Smith' ) 11 ( key = 'PLEE' text = 'Pat Lee' ) ). 12 io_ovs_callback->set_output_table( output = lt_result ). " [CORE] by value 13ENDMETHOD.

Common mistakes: REF #( lt_result ). Dereferencing an unbound query_parameters. Technical fields (rank, GUID) in the result type, which show up as columns. A fake "NO VALUE" row the user can select. Searching already in GET_DATA. No row limit. On screen: the result table with the phase 0 headings.

3.4 HANDLE_PHASE_3: selection

Aim: write the selected row's key back to the field. Called: once, when the user selects a row. The popup then closes.

IMPORTINGTypeMeaning
IV_FIELD_NAME, IO_OVS_CALLBACKas in phase 0Read selection from the callback
IV_WD_CONTEXT_ATTR_NAMEWD context attribute nameAttribute for the field (verify type in your release)
IV_INDEX (lists)IVerify in your release that it exists in phase 3
EXPORTING / read or populateWhat to do
EO_FPM_EVENTREF TO CL_FPM_EVENT. Optional follow-up event, handled in PROCESS_EVENT
selection (read)REF TO data of one row of the result type (not a table)
context_element->set_attribute( )Write the key to iv_wd_context_attr_name. Verify in your release that the element is your field's (and row's)
ABAP
1METHOD if_fpm_guibb_ovs~handle_phase_3. 2 " guard (see above) 3 FIELD-SYMBOLS <ls_sel> TYPE ty_result. " [CORE] one row 4 CHECK io_ovs_callback->selection IS BOUND. 5 ASSIGN io_ovs_callback->selection->* TO <ls_sel>. 6 CHECK <ls_sel> IS ASSIGNED. 7 io_ovs_callback->context_element->set_attribute( " [CORE] key, not text 8 name = iv_wd_context_attr_name value = <ls_sel>-key ). 9ENDMETHOD.

If your superclass already maps the key back, call super-> and add only follow-up logic. Verify in your release, and do not write the value twice. Common mistakes: treating selection as a table. Writing the text instead of the key. Writing to the wrong list row. GET_DATA overwriting the value on the next roundtrip (verify). On screen: the popup closes and the field shows ASMITH.


4. Core vs. project-specific

CORE / reusable pattern (keep)PROJECT-SPECIFIC (replace with your own)
Redefine IF_FPM_GUIBB_OVS~HANDLE_PHASE_0..3Z* feeder classes and the superclass for your UI
GET_DEFINITION: OVS_NAME set, DDIC_SHLP_NAME clearedZ* tables / views used as the data source
iv_field_name guard plus super->Custom roles and role-name patterns
Phase 0 set_configuration, phase 1 set_input_structureAuthorisation-role tables used to find users
Phase 2 query_parameters → set_output_table by valueHR master enrichment (segment, profit centre, region)
Wildcard conversion (* / blank → pattern or no condition)Message-variable conventions (for example MSGV3 = role/org)
Result structure: key first, no technical fieldsRanking rules, requestor / change-request lookups
Empty state: empty table plus message, never a fake rowBAL logging utility and its on/off switch
Phase 3 selection (one row) → context_elementTransport numbers, header and change-log comments

The right-hand column lives in one method, get_candidates( ), or in configuration.


5. Generic end-to-end skeleton

ABAP
1CLASS <your_feeder_class> DEFINITION PUBLIC 2 INHERITING FROM <your_standard_feeder> CREATE PUBLIC. " [PROJECT] 3 PUBLIC SECTION. 4 " ty_search, ty_result, tt_result, gc_field: see section 2 5 METHODS if_fpm_guibb_form~get_definition REDEFINITION. " or ..._list~ 6 METHODS if_fpm_guibb_ovs~handle_phase_0 REDEFINITION. 7 METHODS if_fpm_guibb_ovs~handle_phase_1 REDEFINITION. 8 METHODS if_fpm_guibb_ovs~handle_phase_2 REDEFINITION. 9 METHODS if_fpm_guibb_ovs~handle_phase_3 REDEFINITION. 10 PROTECTED SECTION. 11 METHODS get_candidates " [PROJECT] swap this only 12 IMPORTING is_query TYPE ty_search 13 RETURNING VALUE(rt_result) TYPE tt_result. 14ENDCLASS. 15  16CLASS <your_feeder_class> IMPLEMENTATION. 17 " get_definition, handle_phase_0..3: as in sections 2 and 3 18 " (phase 2 calls get_candidates( ) instead of the hardcoded rows) 19  20 METHOD get_candidates. " [PROJECT] <YOUR_DATA_SOURCE> 21 " Sample: hardcoded rows. In a real system, select from <YOUR_DATA_SOURCE>, e.g. 22 " user master USR21 -> person name ADRP, skip locked users (USR02-UFLAG), using 23 " is_query: '*' -> LIKE/CP pattern, blank -> no condition; cap with UP TO n ROWS. 24 rt_result = VALUE #( ( key = 'JDOE' text = 'John Doe' ) 25 ( key = 'ASMITH' text = 'Alex Smith' ) 26 ( key = 'PLEE' text = 'Pat Lee' ) ). 27 ENDMETHOD. 28ENDCLASS.

Empty state (core): if rt_result is empty, still call set_output_table with the empty table and show an info message, for example through cl_fpm_factory=>get_instance( )->mo_message_manager->report_message( ) with iv_severity = if_fpm_message_manager=>gc_severity_info (verify the constant and where the message appears in your release). Never add a fake selectable row.


6. Output: what the user sees

Before the click. The field shows a hint and a value-help icon:

Illustrative HTML render of the "User Responsible" cell (sample data). Not a real screenshot.

The popup. This render shows a result structure extended with three more components (SEGMENT, PRCTR, REGION) and their column/label texts. The minimal samples above produce only the first two columns.

Illustrative HTML render of the popup (sample data). Not a real screenshot. Source: person-responsible-popup.html.

AreaComes from
Title "Person Responsible"Phase 0 window_title
Search fields, labels, defaultsPhase 1 input components, label_texts, values
"Person Responsible List (3)"Phase 0 table_header. The count is added by the UI (verify in your release)
Column headingsPhase 0 column_texts
RowsPhase 2 set_output_table
Selected row → field valuePhase 3 context_element->set_attribute

The exact look (Go button, Hide Filters link, radio selection, Cancel) depends on the UI theme and release.


7. Checklist

  • Feeder entered in the configuration. The field is an input field with value help.
  • OVS_NAME set, DDIC_SHLP_NAME cleared. The value-help icon is visible in edit mode.
  • Every phase has the iv_field_name guard with super->.
  • Phase 0 sets texts only. Column names match the result components.
  • Phase 1 type = the type read from query_parameters in phase 2.
  • Phase 2: IS BOUND check, set_output_table by value, row limit, no technical columns.
  • Empty result: empty table plus message, no fake row.
  • Phase 3: selection is one row. Write the key.
  • Lists: the correct row (iv_index against a fresh buffer from GET_DATA).
  • All project logic sits in get_candidates( ) and is tagged [PROJECT].

8. Troubleshooting

SymptomLikely cause / fix
DDIC help opens, or no helpDDIC_SHLP_NAME not cleared, wrong OVS_NAME, field display-only
List empty until Godisplay_values_immediately = abap_false
Dump at ASSIGN query_parameters->*Not bound, or a different type than the phase 1 input
Extra columns / DDIC headingsTechnical components in the result type / column_texts names do not match
Value not returned or in the wrong rowselection read as a table, text written instead of key, stale iv_index buffer
Value lost after the next roundtripGET_DATA overwrites it. Update its buffer too (verify)
Other value helps brokenMissing iv_field_name guard or super-> delegation
Slow popupNo row limit, leading-wildcard LIKE on a key, logic in GET_DATA

Referenced tables

ObjectPurpose
ET_FIELD_DESCRIPTIONOpen table ET_FIELD_DESCRIPTION.

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • OVS Search Help Handle Example
  • Multiple Filter in Drp Down search Help
  • In MDG How to create Custom Drop Down List

Possible questions

  • OVS Search Help Handle Example
  • Multiple Filter in Drp Down search Help
  • In MDG How to create Custom Drop Down List
  • What configuration is required for SAP MDG OVS Help - All methods - Dop Down with Filter?
  • How can this SAP MDG scenario be tested?

Keywords

OVS HelpOVS HANDLE Phase 0 to 3OVSHANDLEMDG Drop DownMDG Search Help.