FPM Forms are the new alternate User Interface (along with Adobe UI) provided by SAP in EHP6 for HCM Process and Forms. A decent introduction about this new UI was already provided by Siddharth Rajora in this blog –
Like me, many of my friends must have already worked on “Adobe Interactive Forms” and on introduction of this new UI – FPM Forms (Web Dynpro ABAP based UI) the very first question that came to my mind was – “How does this handle the Scripting (i.e. How to dynamically make a UI field editable/visible)? Like Adobe Interactive Forms has Form Calc and Java scripts that takes care of this scripting, do we have anything special that does this scripting”. Well, I continued doing my research and found couple of ways to achieve this.
In this blog, I would like to demonstrate one of the possible ways to achieve this functionality (I shall write one more blog to demonstrate the other option too). Before diving into this topic, I would like to give a quick brief on the differences found in the EHP5 and EHP6 versions with respect to the Scripting.
New Features in EHP6
Scripting in EHP6 can be handled using the backend services. A new parameter is added to the Backend Service’s Interface (IF_HRASR00GEN_SERVICE) methods – INITIALIZE and DO_OPERATIONS in EHP6 –
The UI_ATTRIBUTES has the following fields (which is a similar structure as SERVICE_DATASETS except a new field called as “UI_ATTRIBUTE”) –
BEGIN OF ty_s_gensrv_ui_attribute,
fieldgroup TYPE asr_field_group,
fieldname TYPE hrasr_fieldname,
fieldindex TYPE asr_fieldindex,
ui_attribute TYPE hrasr_ui_attribute,
END OF ty_s_gensrv_ui_attribute .
This new field UI_ATTRIBUTE can accommodate the following values –
Went ahead implementing this concept using the below steps –
- To which ever fields I intend to have this “Dynamic” behavior, I went ahead setting the “UI Attribute” to my backend service (Assumption: Necessary configuration before reaching this point) –
2. Controlled the UI Attribute in my custom backend service class’s method (INITIALIZE / DO_OPERATIONS), in my case I placed the below code in DO_OPERATIONS method –
READ TABLE UI_ATTRIBUTES ASSIGNING <FS_UI> WITH KEY FIELDNAME = ‘I0105_BEGDA’.
IF SY–SUBRC = 0.
IF ME->ZFLAG1 = ABAP_TRUE.
<FS_UI>–UI_ATTRIBUTE = ‘H’.
<FS_UI>–UI_ATTRIBUTE = ‘I’.
3. Triggered the appropriate event to bring in the dynamic UI behavior –
Like for this requirement, I want to hide the “Valid From” field when the check box is set. So in order to achieve this functionality, I went ahead attaching it to “Check” event. So when user toggles on this “Check box” control, the “USER_EVENT_CHECK” event gets triggered i.e. DO_OPERATIONS method gets called which takes care of my Dynamic UI behavior using Step-2 code.
Final Outcome (The End) –
On selecting the “Hide Display Valid From field” check box, I see the below screen –