Default Values in MDG Single Object Maintenance UIs Based On FPM BOL Feeder Classes
Default Values in MDG Single Object Maintenance UIs Based On FPM BOL Feeder Classes
Default Values in MDG Single Object Maintenance UIs Based On FPM BOL Feeder Classes
2014
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
TABLE OF CONTENTS
BUSINESS SCENARIO .................................................................................................................................... 3
DEFAULT VALUES IN THE CHANGE REQUEST UIBB ................................................................................ 4
By Code using enhancements ....................................................................................................................... 4
By Code using inheritance and Web Dynpro customizing ......................................................................... 7
By Web Dynpro Personalization .................................................................................................................... 9
By BAdI ........................................................................................................................................................... 10
DEFAULT VALUES FOR THE ENTITY.......................................................................................................... 10
By Code .......................................................................................................................................................... 10
By Web Dynpro Personalization .................................................................................................................. 12
By BAdI ........................................................................................................................................................... 14
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
BUSINESS SCENARIO
You would like to initialize some fields of the Single Object Maintenance UI with default values.
Figure 1
In Figure 1 you see the UI for data model SF, entity type PFLI which we will use to demonstrate different
ways of setting default values. The upper UI Building Block (UIBB) for the change request data is not part of
the floorplan definition at least not at design time. I will be added to the floorplan at runtime.
The lower UIBB belongs to the floorplan of the currently running application. The UI and its feeder classes
can be SAP-owned or customer-owned.
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
Figure 3: The Change Request UIBB directly after starting the application with the enhancement
Figure 2 shows that it requires just few lines of code to set default values for the header data of a change
request. However, since you have to enhance a method at the end, you might prefer class enhancements
over source code enhancements. In this case you would create a Post Exit for method
IF_FPM_GUIBB_FORM~PROCESS_EVENT with access to private and protected components of
CL_USMD_CR_GUIBB_GENERAL_DATA.
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
Figure 5: The same code as in figure 2 but this time as a class enhancement
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
Figure 7: The code of the redefined method. Please pay attention to the call of the super class.
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
The next task is the link from the UI-configuration to the new feeder class. This can be done by creating a
customizing for the UIBB-configuration. This customizing has to be of the same name as the configuration. In
the customizing it is possible to enter a feeder class which overwrites the class from the configuration level.
Figure 8: Exchange the feeder class by running the configurator in customizing mode.
Replacing the feeder class via customizing provides you a modification-free possibility to link your own code
with an existing UI. However, customizing means that this solution is client dependent.
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
This solution works on user-level which makes it very flexible for the individual user. In contrast to the
solution with enhancements you dont need a development user here. The default values take effect
immediately since you set them in the system you work in. Transporting these settings is not necessary and
also not possible. Default values cant be set when the application runs in administration mode (URLparameter sap-config-mode=X). I.E. an administrator cant set default values for all users.
Personalization is only possible if it is allowed on system-level and not disabled on application-level.
Deleting the default value can be done the same way as it was set:
Figure 10: The context menu of an input field with a default value
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
By BAdI
There is no BAdI which allows you to set default values in the change request header.
By Code
Setting default values in the UIBB of an entity works very similar to setting values in the UIBB of the change
request. There are several possibilities where to place the code depending on which feeder classes are
used. If you use class CL_MDG_BS_GUIBB_FORM directly as feeder class, you can either enhance this
class or inherit from it and redefine method IF_FPM_GUIBB_FORM~PROCESS_EVENT. The latter one is
the better solution and you should create a subclass of CL_MDG_BS_GUIBB_FORM if your feeder class
does not already inherit from this class. In this case a programming error has only impact on the UIBB using
this feeder class instead of all form-UIBBs.
In case you are dealing with an SAP-owned UIBB, you can introduce your own feeder class by Web Dynpro
customizing as described on pages 7 and 8.
The following two screenshot show the example code of a feeder class which inherits from
CL_MDG_BS_GUIBB_FORM and the relevant part of the UIBB for the creation of flight connections.
10
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
Figure 11: A redefinition of PROCESS_EVENT with the code for default values
In this case we have set values for an entity which does not yet have a key, which is why the upper two fields
are highlighted in red. After populating these fields the highlighting and the error message in the message
area will disappear.
11
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
After clicking the link 0404, the entity will be displayed. All entity data are in input fields which are in readonly mode. The user has a default value for the unit of measure of the distance but it will not be set by Web
Dynpro because the field is read-only.
12
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
After pressing the Edit button the input fields of non-key fields change to edit mode. Nevertheless the field for
the unit of measure remains blank, because the fields are technically the same as before and Web Dynpro
only applies default values when a field is displayed the first time.
Figure 15: Switching from display to edit mode does not set default values from personalization
This example was only shown for the sake of completeness. It does not mean a big limitation because
default values are more important during the creation of an entity, a process when all input fields are open for
changes immediately.
13
Default Values in MDG Single Object Maintenance UIs based on FPM BOL feeder classes
By BAdI
14
www.sap.com