How to Add or Use the Customer Fields in ESS Leave Request
This blog explains How to Add or Use the Customer Fields in ESS Leave Request.
Requirement: I came across some discussions how can we add a Customer field to use as a Checkbox or Dropdown list in ESS Leave Request, So let me explain some of this scenarios.
Solution:
You can do with Customization of FPM component
Step 1:
Goto IMG path in Tx: SPRO
Personnel Management-> Employee Self-Service (Web Dynpro ABAP)-> Service Specific Settings -> Working Time -> Leave Requests -> Processing Processes -> Specify Processing Processes for Types of Leave -> Define Absences/Processing Processes -> Choose
Choose the Leave type for which you need the Customer Field, for ex: SMCL (Casual Leave).
Here you can find the ‘Field Selection for Additional Data’ you need to select one of the value from F4 help as shown below.
Step 2:
Goto Tx: SE80 and select Webdynpro Component as ‘FPM_FORM_UIBB’
Expand Component Configurations and select ‘HRESS_CC_GUIBBF_LEAVREQ’ and Start Configurator
You need to create Enhancement by going to ‘Other functions’ button as shown below.
Give the name as Z_ HRESS_CC_GUIBBF_LEAVREQ and SAVE it.
Goto Z_ HRESS_CC_GUIBBF_LEAVREQ and Start Configurator and Click on Change button as shown
Goto Group Additional Data, Elements
Change the Attributes as shown below
Step 3:
Goto Tx: SE80 and select Webdynpro Component as ‘FPM_OVP_COMPONENT’
Expand Component Configurations and select ‘HRESS_CC_PTARQ_LEAVREQ’ and Start Configurator.
You need to create Enhancement by going to ‘Other functions’ button as shown below.
Give the name as Z_ HRESS_CC_PTARQ_LEAVREQ and SAVE it.
Goto Z_ HRESS_CC_PTARQ_LEAVREQ and Start Configurator and Click on Change button as shown
Goto Page LRF as shown below
Goto SELECTION_FORM tab and Click on Attributes and change the Configuration Name as ‘Z_ HRESS_CC_GUIBBF_LEAVREQ’
Click on Save, that should look like below
Step 4:
Expand Webdynpro Applications and select ‘HRESS_A_PTARQ_LEAVREQ_APPL’
Expand ‘HRESS_A_PTARQ_LEAVREQ_APPL’ goto HRESS_AC_PTARQ_LEAVREQ and Start Configurator
You need to create Enhancement by going to ‘Other functions’ button as shown below.
Give the name as Z_ HRESS_AC_PTARQ_LEAVREQ and SAVE it.
Now you will see the new Configuration Component at ‘ Applic. Configurations’ with the above Z name.
Goto Z_ HRESS_AC_PTARQ_LEAVREQ and Start Configurator and Click on Change button as shown.
Then Change the configuration to Z_HRESS_CC_PTARQ_LEAVREQ and click on save as shown below.
Output:
Login into Portal and go to Create Leave request Page you will find the Additional Data Field – Hours as Check box as shown below.
The Additional Data Field will appear only for ‘CASUAL LEAVE’ as you have configured for only SMCL in Step1.
Business Logic/Validations:
The business logic should be written in the BADI PT_ABS_REQ in the method ‘SIMULATE_VIA_BLOP’
Then you can validate by seeing the Value as checked(X) for Customer01 field in the debugging mode as shown below.
Open IM_ATTABS_TAB by double click, you can see the Customer 01 field Value as ‘X’.
You can write your own logic for validations further for this field.
Dropdown List
For Getting the field as Dropdown.
In step 2, for example select the Customer02 field and change the display type as ‘Drop Down’ in Attributes Element.
To assign the values for the dropdown list you need to enhance the method MODIFY_DEF_DEFAULT_LABEL (at the end of this method) of class CL_HRESS_PTARQ_LEAVREQ_GUIBBF write your logic, for example as below.
Example code:
data: lt_fixed_values type WDR_CONTEXT_ATTR_VALUE_LIST,
ls_fixed_values type WDR_CONTEXT_ATTR_VALUE.
READ TABLE ct_field_description ASSIGNING
WITH KEY name = ‘CUSTOMER02’.
IF sy-subrc IS INITIAL.
ls_fixed_values-value = ’01’.
ls_fixed_values-text = ‘MALE’.
insert ls_fixed_values into table lt_fixed_values.
-fixed_values = lt_fixed_values.
ENDIF.
There might be some other ways to get this requirement done but I followed this way. If anything best please let me know.
Hope This blog helps all of you……Any comments or suggestions are most welcome
Regards,
Mohsin.
New NetWeaver Information at SAP.com
Very Helpfull