Employee Master Data and Active Directory Comparison and Update
Short answer: An interface program that compares hires, leavers and organizational changes in SAP HCM with the accounts in the corporate directory (Active Directory) and updates the differences. Job title, department, manager and cost centre are pushed to the directory; leavers have their directory account and SAP user locked, and new hires get users in SAP and connected systems. Every step is tracked with a log and an error file.
- Estimated effort
- L · 12–18 working days
- System
- ECC and S/4HANA
- Tables
- 7
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
SU01 and SU10 maintain users one by one or in bulk, and PA30 stores the user name and e-mail in infotype 0105; but there is no ready comparison and update tool between SAP HCM and the directory. This normally requires a separate identity management product. For companies without one, the program treats HR master data as the single source and aligns the directory and SAP users with it.
Who uses it? Information security and IT infrastructure teams, SAP authorization administrators, HR operations teams.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| PA0000HR Master Record: Infotype 0000 (Actions) | Actions and employment status (driving table) | Read | ECC + S/4 |
| PA0001HR Master Record: Infotype 0001 (Organizational Assignment) | Org unit, position and cost centre | Read | ECC + S/4 |
| PA0002HR Master Record: Infotype 0002 (Personal Data) | First and last name | Read | ECC + S/4 |
| PA0105HR Master Record: Infotype 0105 (Communications) | SAP user name and e-mail (communication) | Read / write | ECC + S/4 |
| HRP1000Infotype 1000 (Object) Database Table | Org unit and position names | Read | ECC + S/4 |
| HRP1001Infotype 1001 (Relationships) Database Table | Manager relationship (A012) | Read | ECC + S/4 |
| USR02User Logon Data | SAP user: lock and validity | Read / write | ECC + S/4 |
BAPIs and functions used
- RH_GET_LEADERGet Manager of an Organizational Object. Finds the manager of an org unit
- BAPI_USER_LOCKLock User. Locks the SAP user of a leaver
- BAPI_USER_CHANGEChange User. Updates the user's validity date and address data
- BAPI_USER_CREATE1Create User. Creates SAP users for new hires
- HR_INFOTYPE_OPERATIONMaintain HR Infotype Record. Writes the user name and e-mail from the directory to infotype 0105
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| S_BUKRS | Company code | Range / multiple | PA0001-BUKRS | No | 1000 |
| S_PERNR | Personnel number | Range / multiple | PA0000-PERNR | No | 00001024 |
| P_MODE | Run: delta / full comparison | Radio button | — | Yes | Delta |
| P_LOCK | Lock SAP users of leavers | Checkbox | — | No | X |
| P_CREATE | Create users for new hires | Checkbox | — | No | X |
| P_TEST | Test run | Checkbox | — | No | X |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Personnel no. | PA0000-PERNR |
| 2 | First name | PA0002-VORNA |
| 3 | Last name | PA0002-NACHN |
| 4 | SAP user | PA0105-USRID |
| 5 | Org unit | HRP1000-STEXT |
| 6 | Directory account | Calculated Logon name returned by the directory |
| 7 | Difference | Calculated Attributes that differ (title, department, manager, status) |
| 8 | Action | Calculated Create, update, disable or none |
| 9 | Result | Calculated Success, error or test |
Sample result list
| Personnel no. | First name | Last name | SAP user | Org unit | Directory account | Difference | Action | Result |
|---|---|---|---|---|---|---|---|---|
| 00001024 | Deniz | Arıkan | DARIKAN | Satınalma Müdürlüğü | deniz.arikan | Manager | Update | Success |
| 00001071 | Burak | Tezcan | BTEZCAN | Bakım Planlama | burak.tezcan | Status: left | Disable + SAP lock | Success |
| 00001102 | Selin | Okyay | Finans Operasyon | No account | Create | Test | ||
| 00001088 | Can | Ersoy | CERSOY | Kalite Güvence | can.ersoy | Title | Update | Error: directory did not respond |
How does the program work?
- By change date (since the last run), PA0000 (action and employment status STAT2), PA0001 (org unit, position, cost centre), PA0002 (first and last name) and PA0105 (subtype 0001 SAP user, 0010 e-mail) are read.
- Org unit and position names come from HRP1000; the manager is found with RH_GET_LEADER (HRP1001 relationship A012 ‘manages’).
- The account list from the directory is taken through middleware via an LDAP query or the directory API; the matching key is the personnel number (employee ID attribute) or the e-mail in PA0105.
- For every record the comparison sets an action: new account, attribute update (title, department, manager, cost centre), disable, or no action.
- For leavers (STAT2 = 0) the SAP user is locked with BAPI_USER_LOCK and its validity end is set to the leaving date with BAPI_USER_CHANGE; the directory account is disabled through the middleware.
- For new hires, an SAP user is created with BAPI_USER_CREATE1 according to the position-to-role mapping in a rule table; the user name and e-mail from the directory are written back to PA0105 with HR_INFOTYPE_OPERATION.
- A test run only shows the difference list. In a live run every action is logged, and failed ones go to an error file that can be reprocessed.
Performance notes
Schedule a full comparison weekly and a delta run every night. Read the PA tables by the AEDTM change date; request only the attributes needed from the directory.
Features
- Test mode (check without posting) Produces the difference list without changing anything
- Line-by-line result and error log Every action is logged with user, time and result
- Download failed lines as a separate file Failed records are written to an error file that can be reprocessed
- Runs as a background job Scheduled as a nightly delta and a weekly full comparison
- Send the result by email A summary of locked and created accounts is e-mailed to the security team
Authorization objects
- P_ORGINAuthorization to read employee data by personnel area, employee group and infotype
- S_USER_GRPAuthorization to create, change and lock users by user group
Frequently asked questions
Is it needed when an identity management product is in place?
No. If an identity management product exists, it runs this flow. The program is for companies without such a product or that only want to connect SAP HCM with the directory.
How does it connect to the directory?
The connection depends on the company's middleware: a direct LDAP query or an integration service calling the directory API. The SAP side stays the same; only the connection layer is adapted during installation.
Does it work on S/4HANA?
Yes. The user BAPIs and HCM infotypes are the same on S/4HANA. Because employees are also business partners there, business partner synchronization is left to the standard employee-to-business-partner sync.
Related reports
Automatic Lock of Inactive Users Program
A custom background program that first warns dialog users who have not logged on for a given period by email, locks them with an administrator lock …
Mass Update of User Master Data from Excel
A custom program that mass updates the first name, last name, email, department, function, user group, validity dates and default printer of users …
Automatic SAP User Lock Job for Leaving Employees
A background job that, on the leaving date, automatically locks the SAP users stored in infotype 0105 for employees with a recorded leaving action and …
Let us build this program for your system
Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.