Register Login

Create new Employee in table using function modules or BAPIS

Updated May 18, 2018

What are the steps to create new table using function modules or bapis without running tcode pa30 and pa40?

While writing a program to create a new employee for tables pa0001, pa0002, pa0004 by supplying my own personnel data in the parameters i am getting  some problem. Other attributes for the tables are also manually inserted using screens later.

Since I am using standards tables, I have to use function modules and bapis, but none of it seems to work for me.

Whenver you are working with employees data, after hiring, first you need to  lock the employee and then create or change(HR_INFOTYPE_OPERATION  or  related BAPI's)  and then unlock the employee.

Use  bapi_employee_enqueue


We have some other function modules also their to lock and unlock the employee number

First you need to hire the  employee, then only employee number is generated. Then only we can go forward.

You can use HR_MAINTAIN_MASTERDATA to hire and maintain infotypes and for other actions.

Also check function module HR_PAD_HIRE_EMPLOYEE.

You can use this function module to hire an employee with any infotype data and cost assignment data in the background. You can also assign a reference personnel number or additional personnel assignment (in Concurrent Employment) to an employee.

Dialog processing is not available, which means that all the necessary data must be transferred immediately upon calling the function module using the parameter PNNNN_TAB or PREF_TAB.

For the accompanying data, all validation checks are made that would occur in a dialog box on the infotypes’ individual screens. Any (error) messages that might occur during the check are returned to the person who called the function module.


To fill the parameter PNNNN_TAB, you can use the relevant method in the class CL_HR_PNNNN_TYPE_CAST.

Fill the relevant infotype structure (for example, P0002) with data.

Then convert this infotype-specific format using the class CL_HR_PNNNN_TYPE_CAST to the general HR format PRELP and add it to table PNNNN_TAB.


You can only perform initial hiring actions with this function module, meaning that if the personnel number already exists in the database, you receive an error message. Completing data or executing an infogroup can only be done using the standard maintenance transactions PA30 (“Maintain HR Master Data") and PA40 ("Personnel Actions").

You can, however, assign a reference personnel number or additional personnel assignment (in Concurrent Employment) to an already existing personnel number. To do this, enter the already existing personnel number in the parameter REFERENCEPERNR. The system then copies the copyable data (see Data Sharing Settings View V_T582G) of the already existing personnel number to the employee to be hired.

Prerequisite for using the parameter REFERENCEPERNR. Set the flag CCURE PC_UI from table T77S0 ("System Table“) to ‘X’ according to SAP Note 783499 and complete the additional steps described in the Note.

You have the option of executing a test run by using the parameter NO_COMMIT.

It is not possible to create infotype texts.

Dynamic actions are not performed.

This function module enables you to use internal and external number assignment for personnel numbers.

You can only assign one position to an employee in the organizational assignment (infotype 0001), this means that it is not possible to use this function module to create multiple occupancies. 
There is no bapi for the same purpose.. you can do custom wrapper around these FMs. 

Copy and remote enable them.