Applies to: GRC Process Control 10.0 / Process Control 10.1.
Summary
This document provides information “How to implement Enhancement for Custom defined field(s) in GRC Process Control 10.0 and 10.1.
Author: Amit Saini
Created on: April 2015
Prerequisite(s) Custom Defined Field(s) are already defined.
Audience
GRC Process Control consultants, partners.
Introduction
With SAP GRC Process Control 10.0/10.1, there is added flexibility in defining the customer-specific fields. You can define them as: ‘Single value’ or multiple values’ for either a HR entity, for example, “Organization” or a non-HR entity, for example, “Issue” In order to control the visibility of CDF fields on UI, for example to mark CDF fields as ‘Required’, ‘Hidden’, or ‘Read Only’, we need to implement the enhancement spot.
Implementing ‘Enhancement’ spot
Firstly, we need to define a class
[Transaction ‘Se24’] which implements the interface: ‘IF_GRFN_API_CUSTOMFIELD_BADI’.
There are changing attributes CT_CUSTOMFIELD_MDATA and CT_CUSTOMFIELD_DATA available in method AFTER_RETRIEVE that can be modified.
Table CT_CUSTOMFIELD_MDATA is used adjust the following fields:
- HIDDEN can be used to hide the field on UI
- READONLY can be used to set the field “Display only”.
- REQUIRED can be used to make the field required.
- VALUESET can be used to define text for dropdown.
- FIELDLABEL can be used to adjust label of the field.
Table CT_CUSTOMFIELD_DATA is used to adjust following field: "VALUE" and can be used for value defaulting .
By the method BEFORE_UPDATE, we can modify the value entered by user or can implement the “input check” and raise the exception; in
case the user entry does not pass the check.
Secondly, we need to implement the new BADI using enhancement spot ‘GRFN_API_CUSTOMFIELD ‘.
This enhancement spot is called during the ‘Retrieve’ and ‘Update’ of Custom Defined fields for both HR and non-HR entities.
The transaction used is SE19.
Choose enhancement as ‘GRFN_API_CUSTOMFIELD’ and click on button ‘Create Implementation’.
Enter the name and text for ‘Implementation’, we want to create and do not select the option‘Composite Enhancement
Implementation’.
An "Enhancement Implementation" can only contain one type of "Enhancement Implementation Element". Therefore, for a project where
you must implement enhancements to both an Enhancement Point, and a Function Module Interface, you cannot group them in the same Enhancement Implementation. Instead, you must create two separate Enhancement Implementations, and in turn group those in a "Composite Enhancement Implementation". For our example, we require to implement BADI and hence did not select the option ‘Composite Enhancement Implementation’.
Enter the implementation class ‘ZBADI_USER_DEFINED” defined in first step and continue.
Save and activate the ‘Enhancement Implementation’.
Now we could define the IF_GRFN_API_CUSTOMFIELD_BADI~AFTER_RETRIEVE and IF_GRFN_API_CUSTOMFIELD_BADI~BEFORE_UPDATE in implemented class ZBADI_USER_DEFINED to control the CDF on UI.
Let us understood this, with an example .Execute program ‘GRFN_CHECK_CDF’ to know the metadata created.
I want to set field ‘ZTEST_VALUE’ defined for ‘Issue’ as mandatory using my enhancement point.
So I have implemented the methods IF_GRFN_API_CUSTOMFIELD_BADI~AFTER_RETRIEVE and IF_GRFN_API_CUSTOMFIELD_BADI~BEFORE_UPDATE in class ZBADI_USER_DEFINED.
Now I perform ‘Manual Test of effectiveness’ task for a manual control.
And create issue for the control.
Method ‘API_RETRIEVE_CUSTOMFIELD’ of class ‘CL_GRFN_UTIL_CDF’
is used to modify the CDF metadata. It further calls the enhancement point ‘GRFN_API_CUSTOMFIELD’.
If method IF_GRFN_API_CUSTOMFIELD_BADI~AFTER_RETRIEVE is implemented, it will modify the CDF metadata.
Once the source code highlighted, is executed, the metadata is changed.
CDF is enabled as mandatory with “Enhancement point’ implementation.
Now user submits data without entering mandatory custom defined fields.
A check has been implemented in IF_GRFN_API_CUSTOMFIELD_BADI~BEFORE_UPDATE of class
‘ZBADI_USER_DEFINED’ to check the input values for CDF. This has been called via ‘API_UPDATE_CUSTOMFIELD’ of class ‘CL_GRFN_UTIL_CDF’.
User is not able to submit data without entering the Custom Defined Field(s).