3 Ways of Retrieving Infotype Data with ABAP

Straight Out Selecting

There are many ways to retrieve Infotype data in SAP HCM from ABAP code. One of way the Infotype data can be retrieved is by using Query from the related Infotype table. This approach perhaps the most straightforward one. The syntax looks something like this:

In the example above, the current Infotype 1 Data with the subtype 001 of employee with Personnel Number 10 is retrieved.

Wrapped in Function Module

Another approach is probably one of the most popular way to retrieve Infotype data. It utilized the standard Function Module that provided by SAP called “HR_READ_INFOTYPE”. By following the same scenario as previous approach (same parameter), the Function Module can be called like this

By using this Function Module, at least we can utilize the EXCEPTIONS or error handling that are predefined from the Function Module. This approach might need a bit more codes to get the job done but considered relatively more efficient then the previous approach since this is the tool that provided by SAP.

Object Oriented with Classes

The third approach is using Object Oriented approach. This approach similar to the previous approach since it also utilized the standard codes from SAP in a form of Classes. The steps of using this approach are as follow:

  1. Create the instance of the infotype object reader.

2. Get the Infotype data by calling the method of the object reader instance that just been created above. Assign the parameters by following the same scenario as the previous approach with the Employee’s Personnel Number, Infotype, Subtype, Begin Date and End Date with the addition of some required parameters such as SRPS, OBJPS, etc.

3. Then to store the data into internal table, use the following Class.

This approach can results in even more codes but Object Oriented has its advantages over the procedural in some cases. That’s why it’s always important to acknowledge some alternatives for doing one task.

Encapsulate the Classes

I decided to create a custom ABAP Class to encapsulate all the Classes used in the previous approach to make it neater. By utilizing this global class instead, hopefully your code can look a lot more nicer and cleaner. You can see the repository here : https://github.com/aufaraditya/ABAP-INFTY-VALUE

Hopefully this post is useful in any way.

--

--

--

Indonesian origin. A Dad. SAP ABAP Developer. Geek. Meme Ehthusiast. Creator of https://www.instagram.com/sapabap101/

Love podcasts or audiobooks? Learn on the go with our new app.

Rendering user installed commands as a tree.

Upload files to Cloud Storage from WordPress

Not Everyone Should Be a Programmer

Being a full-stack developer, How is it?

Apache Kafka — 101 & How It Comes to Picture

Byte Stream With UTF-8 Encoding

A good intuition for efficient transformations

Using Continuous Improvement Tools Effectively

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aditya Aufar

Aditya Aufar

Indonesian origin. A Dad. SAP ABAP Developer. Geek. Meme Ehthusiast. Creator of https://www.instagram.com/sapabap101/

More from Medium

#2 How we work — IT analysis

THE EXPERIENCE IN BECOMING AN AWS CERTIFIED CLOUD PRACTITIONER

Wordpress and SQL pod on the top of K8S using ansible.

How to create a Jenkins job?