HCM Program Custom development Interface

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

  • SU10 User Mass Maintenance. Changes or locks users in bulk; does not compare them with HR master data.
  • PA30 Maintain HR Master Data. User and e-mail are entered manually in infotype 0105; there is no directory synchronization.

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
PA0000HR Master Record: Infotype 0000 (Actions)Actions and employment status (driving table)ReadECC + S/4
PA0001HR Master Record: Infotype 0001 (Organizational Assignment)Org unit, position and cost centreReadECC + S/4
PA0002HR Master Record: Infotype 0002 (Personal Data)First and last nameReadECC + S/4
PA0105HR Master Record: Infotype 0105 (Communications)SAP user name and e-mail (communication)Read / writeECC + S/4
HRP1000Infotype 1000 (Object) Database TableOrg unit and position namesReadECC + S/4
HRP1001Infotype 1001 (Relationships) Database TableManager relationship (A012)ReadECC + S/4
USR02User Logon DataSAP user: lock and validityRead / writeECC + 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

ParameterDescriptionTypeReference fieldRequiredExample
S_BUKRSCompany codeRange / multiplePA0001-BUKRSNo1000
S_PERNRPersonnel numberRange / multiplePA0000-PERNRNo00001024
P_MODERun: delta / full comparisonRadio button—YesDelta
P_LOCKLock SAP users of leaversCheckbox—NoX
P_CREATECreate users for new hiresCheckbox—NoX
P_TESTTest runCheckbox—NoX

Result list columns

#ColumnSource
1Personnel no.PA0000-PERNR
2First namePA0002-VORNA
3Last namePA0002-NACHN
4SAP userPA0105-USRID
5Org unitHRP1000-STEXT
6Directory accountCalculated Logon name returned by the directory
7DifferenceCalculated Attributes that differ (title, department, manager, status)
8ActionCalculated Create, update, disable or none
9ResultCalculated Success, error or test

Sample result list

Personnel no.First nameLast nameSAP userOrg unitDirectory accountDifferenceActionResult
00001024DenizArıkanDARIKANSatınalma Müdürlüğüdeniz.arikanManagerUpdateSuccess
00001071BurakTezcanBTEZCANBakım Planlamaburak.tezcanStatus: leftDisable + SAP lockSuccess
00001102SelinOkyayFinans OperasyonNo accountCreateTest
00001088CanErsoyCERSOYKalite Güvencecan.ersoyTitleUpdateError: directory did not respond
A view built with fictional sample data; not real system data.

How does the program work?

  1. 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.
  2. Org unit and position names come from HRP1000; the manager is found with RH_GET_LEADER (HRP1001 relationship A012 ‘manages’).
  3. 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.
  4. For every record the comparison sets an action: new account, attribute update (title, department, manager, cost centre), disable, or no action.
  5. 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.
  6. 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.
  7. 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

BASIS Program Custom Background program

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 …

USR02 · USR21 · ADR6 · AGR_USERS

BASIS Program Custom Mass upload

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 …

USR02 · ADRP · ADR6 · ADCP

HCM Program Custom Background program

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 …

PA0000 · PA0001 · PA0105 · USR02

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.

Related report: Employee Master Data and Active Directory Comparison and Update