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 ofIF_WD_OVSdiffer 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.
| Phase | Method | Aim | Key callback call |
|---|---|---|---|
| 0 | HANDLE_PHASE_0 | Configure the popup texts | set_configuration( ) |
| 1 | HANDLE_PHASE_1 | Define (and pre-fill) the search fields | set_input_structure( ) |
| 2 | HANDLE_PHASE_2 | Read the criteria, return the result list | query_parameters, set_output_table( ) |
| 3 | HANDLE_PHASE_3 | Write the selected row back to the field | selection, context_element |
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)
- In the feeder class of the GUIBB (
IF_FPM_GUIBB_FORMorIF_FPM_GUIBB_LIST), redefine the four OVS methods if the superclass already implementsIF_FPM_GUIBB_OVS. If it does not, addINTERFACES if_fpm_guibb_ovs. - 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.
- In
GET_DEFINITION, setOVS_NAMEand clearDDIC_SHLP_NAME:
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_DESCRIPTIONhas the typeFPMGB_T_FORMFIELD_DESCR(form) orFPMGB_T_LISTFIELD_DESCR(list).OVS_NAMEmust 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:
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:
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.
| IMPORTING | Type | Meaning |
|---|---|---|
IV_FIELD_NAME | NAME_KOMP | Field whose value help was pressed |
IO_OVS_CALLBACK | REF TO IF_WD_OVS | Callback object to the popup |
IV_INDEX (lists) | I | Row whose value help was pressed |
| EXPORTING / populate via callback | What 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 |
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.
| IMPORTING | Type | Meaning |
|---|---|---|
IV_FIELD_NAME, IO_OVS_CALLBACK, IV_INDEX (lists) | as in phase 0 | as in phase 0 |
| EXPORTING / populate via callback | What 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 |
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.
| IMPORTING | Type | Meaning |
|---|---|---|
IV_FIELD_NAME, IO_OVS_CALLBACK | as in phase 0 | Read query_parameters from the callback |
IV_INDEX (lists) | I | Row to which the search refers |
| EXPORTING / read or populate via callback | What 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 |
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.
| IMPORTING | Type | Meaning |
|---|---|---|
IV_FIELD_NAME, IO_OVS_CALLBACK | as in phase 0 | Read selection from the callback |
IV_WD_CONTEXT_ATTR_NAME | WD context attribute name | Attribute for the field (verify type in your release) |
IV_INDEX (lists) | I | Verify in your release that it exists in phase 3 |
| EXPORTING / read or populate | What to do |
|---|---|
EO_FPM_EVENT | REF 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) |
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..3 | Z* feeder classes and the superclass for your UI |
GET_DEFINITION: OVS_NAME set, DDIC_SHLP_NAME cleared | Z* 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_structure | Authorisation-role tables used to find users |
Phase 2 query_parameters → set_output_table by value | HR 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 fields | Ranking rules, requestor / change-request lookups |
| Empty state: empty table plus message, never a fake row | BAL logging utility and its on/off switch |
Phase 3 selection (one row) → context_element | Transport 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
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.
| Area | Comes from |
|---|---|
| Title "Person Responsible" | Phase 0 window_title |
| Search fields, labels, defaults | Phase 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 headings | Phase 0 column_texts |
| Rows | Phase 2 set_output_table |
| Selected row → field value | Phase 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_NAMEset,DDIC_SHLP_NAMEcleared. The value-help icon is visible in edit mode.- Every phase has the
iv_field_nameguard withsuper->. - Phase 0 sets texts only. Column names match the result components.
- Phase 1 type = the type read from
query_parametersin phase 2. - Phase 2:
IS BOUNDcheck,set_output_tableby value, row limit, no technical columns. - Empty result: empty table plus message, no fake row.
- Phase 3:
selectionis one row. Write the key. - Lists: the correct row (
iv_indexagainst a fresh buffer fromGET_DATA). - All project logic sits in
get_candidates( )and is tagged[PROJECT].
8. Troubleshooting
| Symptom | Likely cause / fix |
|---|---|
| DDIC help opens, or no help | DDIC_SHLP_NAME not cleared, wrong OVS_NAME, field display-only |
| List empty until Go | display_values_immediately = abap_false |
Dump at ASSIGN query_parameters->* | Not bound, or a different type than the phase 1 input |
| Extra columns / DDIC headings | Technical components in the result type / column_texts names do not match |
| Value not returned or in the wrong row | selection read as a table, text written instead of key, stale iv_index buffer |
| Value lost after the next roundtrip | GET_DATA overwrites it. Update its buffer too (verify) |
| Other value helps broken | Missing iv_field_name guard or super-> delegation |
| Slow popup | No row limit, leading-wildcard LIKE on a key, logic in GET_DATA |
Referenced tables
| Object | Purpose |
|---|---|
ET_FIELD_DESCRIPTION | Open 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?