Hi!
I quickly describe 4 main aspects you need to know before creating an abap code for HCM.
When I conducted job interviews I came across a widespread misconception. I heart something like that: "
I never wrote abap code for HCM module task, but it doesn't matter – You tell me some HCM db table names and everything will be ok".
No... It doesn't work like this!
- No 'select' sql-operator.
The most part of HR master data store in 'infotypes'. Firstly, Infotype looks like db table. But not. It's more complicated entity. The main difference is a build-in permission check and log changes. Other difference there are.
So, you need to use special FM for personal data accessing and handling. These are HR_READ_INFOTYPE, HR_INFOTYPE_OPERATION, RH_READ_INFTY, class cl_hrpa_read_infotype and so on.
Other often-used data store in cluster table. This payroll data, time evaluation data, trips and some other. In this case it's needed to use 'import from database' and 'export to database' operators. Usually special standard macros are used, e.g. rp-imp-c1-te in include RPC1TE00. There are also special FMs and classes for cases such as payroll FM HR_GET_PAYROLL_RESULTS and many others.
Of cause, do not forget about 'select' operator forever. But in most cases, it uses for simple reference tables selection. For example, for getting the employee's category list from T503K table. By the way try to find classes named CL_HR*[TABLE_NAME]* before use 'select', they are there.
So beware 'select' operator. Check yourself when you type 'select'.
Help.sap.com official infotype documentation.
- Logical DB PNP or PNPCE
This is the great tool for reading personal master data. It uses often and has high performance. And there are some tips and tricks to use it correctly. You should know at least some base of them.
To be honest, LBD PNP(PNPCE) uses not in every task and maybe you will not to be faced with it. But you should be ready are.
Standard quick help note here.
The article about PNP on blog.sap.com. It's not comprehensive, but I didn't find more detailed.
Also, there is a PCH LDB but it uses more rarely.
- Time-depended data.
Be careful with data reading. Keep in mind the date and period everywhere. Almost all HCM data are time-depended.
You know even an employee name isn't lifetime constant. It can be changed, e.g. after marriage.
It's wrong to thing "I have to get a name". The right – "I have to get a name by certain date".
What positions are in a department? It's strictly depends by date.
How many vacancies were closed? It has a sense in a certain period only.
Moreover, almost all setup tables have their own time constraints. One business process may have different settings in different period.
Ignoring the time dependencies is a common error! Even for developers familiar with HCM.
Ask yourself is a selected data may be time-depended? Don't forget do it in every task.
- Organizational hierarchy, hr-objects relationships and 'evaluation path'.
Organization structure presents as a graph of HR-objects. I mean 'graph' like a math term - set of objects and relationships between.
In organization structure there are a kinds of hr-object type like 'Organization unit', 'Position', 'Workplace' and some other including custom object types.
HR objects can be linked by different relationships.
Typically, task is a selection a right objects in a appropriate order. Selection conditions can be complicated. And sometimes – be obviously for task owner but non-clear for developer.
Fortunately, there is a great tool – 'evaluation path'.
It carries out selection of hr-object according to certain conditions. Evaluation path is a customizing set to define how hr-object will be selected from all scope. If you are familiar with XML-world be in mind ' evaluation path' likes a XPath language expression.
Your task owner should tell you which evaluation path you have to use.
The often-used FM RH_STRUC_GET processes an evaluation path and returns hr-object set. It's not very difficult.
Keep in mind if a developer doesn't know about it the program turns into a real nightmare!
😊
Useful links about evaluation paths:
What Are Evaluation Paths in SAP OM?
Evaluation Path : How to create and use
The conclusion
Of course, ABAP for HCM is a large application scope with wide range of technical features. Mentioned topics are the tip of iceberg.
To systemize the base knowledge on the HCM ABAP development I recommended to use the course
HR350 - Programming in SAP HCM.
I should mention this course contains just some basic information. So, you need to know more to perform the actual HCM project tasks.
Good luck with HCM ABAP!