SAP Check Employee will help you identifiy if an Employee number PERNR exists and check if this number corresponds to an active employee. For Both check-up you will find the BAPI to use and the table to query if you are looking to optimize the performance.
Table of Contents
SAP Check Employee Existence
SAP Check Employee Existence BAPI
The SAP Standard BAPI to check if an employee number exists in SAP is BAPI_EMPLOYEE_CHECKEXISTENCE.
It takes as input the PERNR (Employee Number) and the output will be a message.
- If the PERNR exists, the RETURN will be empty.
- If the PERNR doesn’t exist, the RETURN will contain the following error
- TYPE E
- CODE PG001
- MESSAGE Personnel number not yet assigned
If you digg into the BAPI_EMPLOYEE_CHECKEXISTENCE, there is a call to?P_EMPLOYEE_CHECKEXISTENCE.
The return sy-subrc will be formatted into BAPI message with?BALW_BAPIRETURN_GET.
SAP Check Employee Existence Table
The main table for SAP Employee are the PA0* Tables
To check if a SAP Employee number, just make a select from the table PA003?Payroll Status.
You can also check the table PA0002 for?HR Master Record: Infotype 0002 (Personal Data).
For more detail about employees handling on SAP check?Employee Central
SAP Check Employee Status
SAP Check Employee?Status BAPI
In order to check if an Employee is active, you can use the Standard BAPI HR_PT_CHECK_EMPLOYEE_ACTIVE.?
CALL FUNCTION 'HR_PT_CHECK_EMPLOYEE_ACTIVE' " EXPORTING endda = " p0001-endda End Date begda = " p0001-begda Start Date TABLES ab = " pc20i Cluster RD/B2: Table AB wpbp = " pc205 Payroll Results: Work Center/Basic Pay . " HR_PT_CHECK_EMPLOYEE_ACTIVE
SAP Check Employee Existence Table
In SAP HR tables, Status for Employee is stored in PA0000 (?HR Master Record: Infotype 0000 (Actions) )
Check the following fields for SAP Employee information:
- STAT1 ? ?Customer-Specific Status
- Status 1 is customer-specific and is not used in the standard system
- STAT2 ? ?Employment Status
- Status 2 relates to the employee?s employment relationship
- STAT3 ? ?Special Payment Status
Status 3 controls an employee?s entitlement to special payment for automatic special payments within Payroll and Accounting