# 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 from an Excel file through the standard user BAPI. A different value can be written for each user; test mode compares current and new values, and protected user groups are never touched. Passwords and role assignments are outside the scope of the program.

- Type: Program, Custom development, Mass upload
- Module: BASIS
- Estimated effort: S (3–5 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/mass-update-user-master-data-from-excel/


## Why is the standard not enough?

SU10 writes the same value to the selected users; but it cannot write a different email, department or validity date to each user from a file, and it offers no before/after comparison. In SU01 users are changed one by one. This program processes each row of the file with its own values, shows the differences in test mode and keeps a log per row.

### Closest standard alternatives

- SU10: Writes the same value to selected users; no per-user values or comparison.
- SU01: Changes users one at a time; not suitable for bulk changes.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| USR02 | User group and validity dates; written through the BAPI | Write | - | ECC + S/4 |
| ADRP | First and last name; written through the BAPI | Write | ADRP-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| ADR6 | Email address; written through the BAPI | Write | ADR6-ADDRNUMBER = USR21-ADDRNUMBER AND ADR6-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| ADCP | Department and function; written through the BAPI | Write | ADCP-ADDRNUMBER = USR21-ADDRNUMBER AND ADCP-PERSNUMBER = USR21-PERSNUMBER | ECC + S/4 |
| USR01 | Default printer; written through the BAPI | Write | USR01-BNAME = USR02-BNAME | ECC + S/4 |
| USR21 | Person and address number of the user | Read | USR21-BNAME = USR02-BNAME | ECC + S/4 |
| USGRP | Existence check for the user group | Read | USGRP-USERGROUP = USR02-CLASS | ECC + S/4 |

## BAPIs and functions used

- BAPI_USER_EXISTENCE_CHECK: Checks whether the user in the file exists in the system
- BAPI_USER_GET_DETAIL: Reads current address, logon and default values for comparison
- BAPI_USER_CHANGE: Changes only flagged fields; password parameters are not used

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | Upload file (XLSX or CSV) | Single value | - | Yes |
| P_TEST | Test mode (compare only) | Checkbox | - | No |
| P_BLANK | Blank cell clears the field | Checkbox | - | No |
| S_PROT | Protected user groups (never changed) | Range / multiple | USR02-CLASS | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| User | USR02-BNAME | Yes |
| First name | ADRP-NAME_FIRST | No |
| Last name | ADRP-NAME_LAST | No |
| Email | ADR6-SMTP_ADDR | No |
| Department | ADCP-DEPARTMENT | No |
| Function | ADCP-FUNCTION | No |
| User group | USR02-CLASS | No |
| Valid from | USR02-GLTGV | No |
| Valid to | USR02-GLTGB | No |
| Default printer | USR01-SPLD | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| User | USR02-BNAME |
| Email | ADR6-SMTP_ADDR |
| Department | ADCP-DEPARTMENT |
| User group | USR02-CLASS |
| Valid to | USR02-GLTGB |
| Changed fields | Calculated: File fields that differ from the current value |
| Status | Calculated: Success / Test / Skipped / Error |
| Message | Calculated: BAPI return message or check error |

## How does the program work?

1. The file is read; the user name is mandatory. By default a blank cell means "do not change"; if the option is on, it clears the field.
2. The user is checked with BAPI_USER_EXISTENCE_CHECK; users in protected user groups (e.g. emergency, technical) are skipped.
3. The user group is checked in USGRP, and the default printer and email format are validated; the validity start cannot be after the end.
4. Current values are read with BAPI_USER_GET_DETAIL and compared with the file; only differing fields are flagged in the change flag structures (ADDRESSX, LOGONDATAX, DEFAULTSX).
5. In test mode only the comparison list is produced. In a real run, BAPI_USER_CHANGE is called per user; the password structure is never filled.
6. The result is shown per row in ALV: changed fields, status and BAPI message. Failed rows can be downloaded in the same template; the changes also appear in the SU01 change documents.

## Authorization objects

- S_USER_GRP: Change users by user group (ACTVT 02); also required for the target group
- S_TCODE: Access to the program's transaction code

## Frequently asked questions

### Does the program reset passwords or assign roles?

No. The program never uses the password parameters and reads no password data. Role assignments are also out of scope; they should go through approval in PFCG or SU01.

### Can the changes be traced afterwards?

Yes. The BAPI writes the standard user change documents; the change documents report in SUIM shows who changed what and when. The program's own log is also kept by file name and row.

### Does it work where Central User Administration (CUA) is used?

With CUA, changes must be made in the central system. When the program runs there, the BAPI distributes the changes to the child systems; local changes in a child system may be blocked by the CUA settings.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=basis-user-master-mass-update-upload
