SAP MDG · DATA MODEL UI
How do I implement a custom SAP MDG UIBB feeder by redefining GET_DATA and GET_FIELD_UI_PROP for context-based field behavior?
Use a redefined MDG feeder class that calls the standard implementation first, reads the application context with `CL_USMD_APP_CONTEXT=>GET_CONTEXT`, and then changes field properties or field usage only for the targeted attribute and process. In the sample pattern, `SPERR` is enabled for process `CUP5`, while `GET_DATA` updates `CT_FIELD_USAGE`, sets `EV_FIELD_USAGE_CHANGED`, and can add an informational message.
Use a redefined MDG feeder class that calls the standard implementation first, reads the application context with `CL_USMD_APP_CONTEXT=>GET_CONTEXT`, and then changes field properties or field usage only for the targeted attribute and process. In the sample pattern, `SPERR` is enabled for process `CUP5`, while `GET_DATA` updates `CT_FIELD_USAGE`, sets `EV_FIELD_USAGE_CHANGED`, and can add an informational message.
A common SAP MDG feeder pattern is to inherit from `CL_BS_CU_GUIBB_GENERAL_DATA`, redefine only the methods that need custom behavior, and keep the standard `super->...` call as the baseline. Then use `CL_USMD_APP_CONTEXT=>GET_CONTEXT` to read the current change request and process, and switch field behavior only for the intended attribute, for example making `SPERR` editable in process `CUP5`.
Process flow
- 1. Create or enhance the feeder class by inheriting from `CL_BS_CU_GUIBB_GENERAL_DATA`.
- 2. Redefine `IF_FPM_GUIBB_FORM~GET_DATA`, `IF_FPM_GUIBB_FORM~GET_DEFINITION`, and `GET_FIELD_UI_PROP` as needed.
- 3. Call the superclass implementation first so standard MDG/FPM behavior remains intact.
- 4. Read the runtime context with `CL_USMD_APP_CONTEXT=>GET_CONTEXT` and `GET_ATTRIBUTES`.
- 5. Check the current change request, request type, and process before changing UI behavior.
- 6. In `GET_FIELD_UI_PROP`, change only the target field property, such as `SPERR` for process `CUP5`.
- 7. In `GET_DATA`, loop over `CT_FIELD_USAGE`, adjust edit-mode dependent flags, and set `EV_FIELD_USAGE_CHANGED = ABAP_TRUE` when you modify usage.
- 8. Optionally read `USMD120C` by `
USMD_CREQUEST` when you need CR status-based logic or logging information like in the sample pattern.
Referenced tables
| Object | Purpose |
|---|---|
USMD120C | Change request header table used in the sample to read the current change request by `USMD_CREQUEST`. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1REPORT z_uibb_redefined_non_modular_sample.
2
3" Custom feeder training sample based on Z*UIBB* style.
4" Scope: only redefined methods, non-modular implementation style.
5
6CLASS lcl_z_uibb_sample DEFINITION
7 PUBLIC
8 INHERITING FROM cl_bs_cu_guibb_general_data
9 FINAL
10 CREATE PUBLIC.
11
12 PUBLIC SECTION.
13 METHODS if_fpm_guibb_form~get_data REDEFINITION.
14 METHODS if_fpm_guibb_form~get_definition REDEFINITION.
15 PROTECTED SECTION.
16 METHODS get_field_ui_prop REDEFINITION.
17ENDCLASS.
18
19CLASS lcl_z_uibb_sample IMPLEMENTATION.
20
21 METHOD get_field_ui_prop.
22 super->get_field_ui_prop(
23 EXPORTING
24 io_entity = io_entity
25 iv_attr_name = iv_attr_name
26 iv_change_allowed = abap_undefined
27 is_prop = is_prop
28 RECEIVING
29 rs_property = rs_property ).
30
31 DATA(lo_context) = cl_usmd_app_context=>get_context( ).
32 IF lo_context IS BOUND.
33 lo_context->get_attributes(
34 IMPORTING
35 ev_crequest_id = DATA(lv_request_id)
36 ev_crequest_type = DATA(lv_cr_type)
37 ev_process = DATA(lv_process) ).
38
39 IF iv_attr_name = 'SPERR' AND lv_process = 'CUP5'.
40 rs_property-read_only = abap_false.
41 rs_property-enabled = abap_true.
42 ENDIF.
43 ENDIF.
44 ENDMETHOD.
45
46 METHOD if_fpm_guibb_form~get_data.
47 super->if_fpm_guibb_form~get_data(
48 EXPORTING
49 io_event = io_event
50 iv_raised_by_own_ui = iv_raised_by_own_ui
51 it_selected_fields = it_selected_fields
52 iv_edit_mode = iv_edit_mode
53 io_extended_ctrl = io_extended_ctrl
54 IMPORTING
55 et_messages = et_messages
56 ev_data_changed = ev_data_changed
57 ev_field_usage_changed = ev_field_usage_changed
58 ev_action_usage_changed = ev_action_usage_changed
59 CHANGING
60 cs_data = cs_data
61 ct_field_usage = ct_field_usage
62 ct_action_usage = ct_action_usage ).
63
64 DATA(lo_context) = cl_usmd_app_context=>get_context( ).
65 IF lo_context IS BOUND.
66 lo_context->get_attributes(
67 IMPORTING
68 ev_crequest_id = DATA(lv_request_id)
69 ev_crequest_type = DATA(lv_cr_type)
70 ev_process = DATA(lv_process) ).
71
72 IF lv_request_id IS NOT INITIAL.
73 SELECT SINGLE * FROM usmd120c INTO @DATA(ls_cr)
74 WHERE usmd_crequest = @lv_request_id.
75 ENDIF.
76
77 LOOP AT ct_field_usage ASSIGNING FIELD-SYMBOL(<fs_fu>).
78 IF iv_edit_mode = 'R'.
79 <fs_fu>-read_only = abap_true.
80 ELSEIF iv_edit_mode = 'E' AND lv_process = 'CUP5'.
81 IF <fs_fu>-name = 'SPERR' OR <fs_fu>-name = 'ZZEXCLGRP'.
82 <fs_fu>-read_only = abap_false.
83 <fs_fu>-enabled = abap_true.
84 ENDIF.
85 ENDIF.
86 ENDLOOP.
87 ev_field_usage_changed = abap_true.
88
89 APPEND VALUE fpmgb_s_t100_message(
90 msgid = '00'
91 msgno = '398'
92 msgty = 'I'
93 parameter_1 = |Z UIBB feeder runtime executed for CR { lv_request_id }| )
94 TO et_messages.
95 ENDIF.
96 ENDMETHOD.
97
98 METHOD if_fpm_guibb_form~get_definition.
99 super->if_fpm_guibb_form~get_definition(
100 IMPORTING
101 eo_field_catalog = eo_field_catalog
102 et_field_description = et_field_description
103 et_action_definition = et_action_definition
104 et_special_groups = et_special_groups
105 et_dnd_definition = et_dnd_definition
106 es_options = es_options
107 es_message = es_message
108 ev_additional_error_info = ev_additional_error_info ).
109 ENDMETHOD.
110
111ENDCLASS.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I enhance an SAP MDG FPM form feeder with context-driven read-only logic?
- How do I make an SAP MDG UIBB field editable only for a specific process in GET_FIELD_UI_PROP?
- How do I implement non-modular custom feeder logic in CL_BS_CU_GUIBB_GENERAL_DATA?
Possible questions
- How do I read the MDG change request context in a feeder class?
- How do I enable or disable a field dynamically in an MDG UIBB?
- How do I adjust field usage in IF_FPM_GUIBB_FORM~GET_DATA?
- How do I control SPERR based on MDG process CUP5?
- What is the standard pattern for calling super in redefined FPM feeder methods?