MDG 8.0 in real life blog series – How to set a predefined value for a field
Hello, welcome to the third episode of this series.
I know that many of you were been asking how to set a predefined value for a specific field in your change request.
How to do it? There is a badi? Can you do it directly in the data model?
Yes probabile there is a way to do it programmatically, but when I tried it, I discovered many issues with this approach, and since FPM is in place, why don’t we use a so powerful tool that offers a very flexible environment for the UI configuration, that make the things more and more easier?
Let’s see how to do it.
Introduction to FPM customization:
in FPM you can do three types of customizations.
1) Personalization – every user can do it. They can change the basic behaviour of ui sections and this changes are visible only to the user that have changed it.
2) Customization – the FPM administrator can do it. The changes are visible to all the users using the same component configuration on which the customization have been done. The admin can change advanced fields and section settings.
3) Configuration – if something is not feasible with customization, maybe you can do it with configuration, but this is almost a development and you need to do it via SAP GUI.
We will use CUSTOMIZATION here.
Step 1
Enable your user as FPM administrator. Make sure in SU01 that you have the following paramter
Step 2
Start the customizing for the view you want to change:
Right click on the field you want to change -> technical settings -> copy the link indicated below
Paste the link in a browser and add the following parameter:
- &sap-config-mode=x
as well explained here: Activating Administrator Mode – Floorplan Manager for Web Dynpro ABAP – SAP Library
Now the magic will happen! You will see a yellow bar that indicated that the customizing is active, and some additional buttons on the ui
there are more surprises! If you right click on a field you see a new option. Click on it!
Now you can change a lot of stuffs ๐
for example if you want to add a default value, write something in the field and then open the options and set the following radio button
Easy right? ๐
See you in the next episode!
very useful!!!
Thank you Emanuele!
Hello Alessandro,
nice blog, but it is not easier to use the context to set the fields?
You have the possibility to set the paramter (WDDISABLEUSERPERSONALIZATION) as false in the application configuration, so you will get the possibility to save field contents as default value.
BR,
Hasan
Hi Hasan!
Yes this is possible, but a personalization is valid only for the user that have set it.
If you want to make it valid for all the users you have to use che customization (that is the one explained here).
Hi,
please keep in mind that this approach defines the value ONLY in the UI. The value is NOT sent to the MDG Framework. You should not expect any validation of this value or derivation based upon this value. This does not happen as long as the enduser does not trigger any UI action that would actually write the value to the MDG Framework.
So if your task is pre-defining values in general, I'd still recommend using the derivation options as offered by the MDG Framework. With that, you can be sure that your code is not only executed by the single object user interface, but also in mass related scenarios such as an initial load.
Cheers
Michael
Hi Michael, thank you for the clarification!
I had some issues with the derivation to set default values for key fields such as controlling area for profit centers, so I discovered this approach (that is useful for many other things). For other fields I think that yes, in case the purpose is just to set a default value is better to implement a derivation.
Thank again.
Hi Alessandro,
Thanks for the nice blog, very useful. Is there a similar way to default values for fields with Dropdown option. As in this case the option ofย Value - "Set Default" is not available.
Thanks,
Kartikey Rawat
I don't think so, in this case maybe you have to enhance the FPM configuration
It worked like a charm! Thanks Alessandro! ๐