One of the powerful tools for configuring SAP HR is features – structured decision logic that looks at various attributes of an employee. Features are used to determine all sorts of things in the SAP HR system – which wagetype to use in paying an employee, which benefit plans they are eligible for, which pay frequency to use and so on.
Sometimes we need more flexibility in a given feature than the system provides. Maybe the decision logic has more steps than the feature can handle (i.e. the variable key is too small to support all the decisions we need to make), or maybe we need to make a decision on an attribute that doesn't exist in the feature. We can extend the flexibility of features by calling ABAP code, which in turn is used to make whatever decision we need.
Before I go into the details for constructing the ABAP code and linking it to the feature, I have to point out one very important restriction: The ABAP code only has access to the data that was passed into the feature. Every feature has a structure assigned to it, a collection of data items that is sent to the feature for it to use in its decision. In turn, the ABAP code only has that data to work with.
Here's a shell of ABAP code you can start with:
REPORT ZHR_FEATURE_CODE.
FORM ext_call_f USING namen back status struc STRUCTURE structure-name.