
SAP HCM with ABAP
SAP ABAP in HCM module is quite different from conventional ABAP in other modules.
3) Use of Macros and Provide statement
1) Use of Infotypes
An infotype represents a group of related data fields, providing information structure, facilitating data entry, and allowing time dependent storage.
In other words, infotypes are information units used to enter the time dependent data of the employee.
Categories of Infotypes:
2) Use of Logical Database
In general ABAP, we seldom use logical database, on the other hand, in HR ABAP most of the programs use logical database to select data from Infotypes by using Get event. (E.g. GET PERNR - get data from logical database
PNP or GET OBJEC - get data from logical database PCH).
3) Use of Macros and Provide statement
In ABAP, we use read statement to read particular record, on the other hand, in HR ABAP, apart from read statement, we have Macros and provide statement.
Macro is pre defined code which reads data from internal table (internal infotype) based on dates.
• Like subroutines and function modules, macro modules can be used to modularize programs. Macro modules are frequently used in HR.
• Macros from logical database - PNP are defined in program SAPDBPNP (include DBPNPMAC) with the keyword DEFINE. They can be used in any program that uses the logical database PNP. Similarly, macros from logical database- PCH are defined in program DBPCHCOM. Please note that you cannot use macros for logical databases PCH and PNP at the same time.
• If you want to use these macros in reports that do not use the logical database PNP, you must include program DBPNPMAC with the keyword INCLUDE.
• You can also define your own macros. In accordance with the naming convention, the first two letters stand for the application.
• Some macros are also stored in the Macros in ABAP Programs table (TRMAC).
Provide statement is like Select statement but selects data from internal table
The syntax for this statement is:
PROVIDE f1 f2 … FROM itab1
g1 g2 … FROM itab2
…
BETWEEN f AND g.
- We can use * instead of individual field names
- itab1, itab2 etc will be of structure Pnnnn
- f and g are from and to dates.
This statement will retrieve the contents of the specified fields from the internal tables ( itab1, itab2, ...) and places them in the table header lines within the required range. Also executes the processing block enclosed by the PROVIDE and ENDPROVIDE statements for each range.
4) Storage and Access of Data
Storage and access of data in hr abap is completely different in HR ABAP comparing with ABAP. We use transaction code PA20 and PA30 to maintain data in infotypes.
PA20 is display mode and PA30 is change mode.
We can create, change, display, copy, and delete in infotypes with PA30 transaction.
5) Authorization checks
For Infotypes authorizations can be maintained infotype and subtype (field) level as HR data is more sensitive and secrete.
These 2 are the authorisation objects, P_ORGIN & P_ORGXX.
P_ORGIN consisting of fields
AUTHC Authorization level
INFTY Infotype
PERSA Personnel Area
PERSG Employee Group
PERSK Employee Subgroup
SUBTY Subtype
VDSK1 Organizational Key
P_ORGXX consisting of fields
AUTHC Authorization level
INFTY Infotype
SACHA Payroll Administrator
SACHP Administrator for HR Master Data
SACHZ Administrator for Time Recording
SBMOD Administrator Group
SUBTY Subtype
Once these are provided to the user , he/ she can access the data accordingly.
Let us take for example there is a role maintained for a user.
THis is how it looks for a user in SU01.
Standard Cross-application Authorization Objects
Standard Transaction Code Check at Transaction Start
Standard Transaction Code Check at Transaction Start
Transaction Code PA51 ZPTR0011
Changed Human Resources
Changed HR: Master Data
Changed HR: Master Data
Authorization level R
Infotype 2006, 2007
Personnel Area HYD, BGL
Employee Group *
Employee Subgroup *
Subtype *
Organizational Key *
Inactiv Standard HR: Clusters
Inactiv Standard HR: Master Data - Personnel Number Check
Now this employee is capable of looking into data from 2 personal areas HYD and BGL only .
Also if this being maintained can be used in the custom reports(Z-report) as well for restricting the data according to locations.
Note: To assign authorisation object to roles:
I. Go to transaction code - PFCG
II. Enter role name/Create a new role
III. Click Change
IV. Click on authorizations tab
V. Click on Change icon (Change Authorization Data) - Ensure the mode is Change Roles
VI. Under Human Resources, click + Manually icon, enter P_ORGIN, click continue/press enter
VII. Enter the details of the authorisations for the P_ORGIN.
(For details of authorisation levels, please see AUTHC (Authorization Level))
Additional resources:
Additional Links:
Common infotypes:
