Dynamic fields in WebUI using GET_A method (no new configuration needed)
Yesterday i’ve found a nice way to show/hide fields dynamically in WebUI!!
The first idea that occurred to me was to create 2 different configurations, one with the field and the other without… Then go to method DO_CONFIG_DETERMINATION and select the correct configuration according to the logic that i wanted…
For me, this is not the right approach! WHY? imagine a requirement where we have 10 dynamic fields:
For 1 dynamic field, we need 2 configurations;
For 2 dynamic fields, we need 4 configurations;
I’ve tryed to find a new solution using different foruns and blogs but unsucessfully… and then i’ve found the light (:P)
My solution is based on the creation of a custom Switch and Business Function, and used them in the BSP application (using method GET_A to change the visibility). Please check the following example:
Go to transaction BSP_WD_CMPWB, open Component SRQM_INCIDENT_H and view IncidentHeaderEF.
Let’s assume that we want to show/hide field “status” (LCSTATUS) from context node BTADMINH.
Note: All the objects should be enhanced!
The objective is to hide field LCSTATUS:
Now i will describe the steps to hide the field:
- Create Switch using SFW1:
- Create Business Function using SFW2:
- Create Business Function Set using SFW3:
- Activate Business Function in SFW5
- Go to SM30 and open CRMV_GIL_COMP_AT:
- In this view, we will set the attributes from BOL Objects with a switch ID and visible or not (check on GENIL_MODEL_BROWSER):
- Now the BOL attribute has a switch ID. Next step is to maintain the visibility in the view of the component. This should be done in method GET_A of the attribute (in this case LCSTATUS):
- If we open the WebUI, the field status should be hidden:
IMPORTANT NOTE: this will not work for extensions in AET!!! the standard will not go through GET_A of the attribute.
The reason why is because the name of the attribute starts with “EXT.”…
To solve that a new method should be created in the class of the context node:
Hope this can solve some problems that both have in SAP CRM 😀