Sub topic 14
Reading messages and correcting errors
This chapter covers how to read the messages the migration cockpit produces and how to fix the data or mappings behind them. It assumes you can already create a migration project, upload a populated template or fill a staging table, and run the validation, value conversion, simulation and import steps. It also assumes you can work with CSV or XML files. Exact button labels and message texts vary by release, so treat the wording here as a guide.
Where messages come from
Almost every step in an object's lifecycle can produce messages. The step that raises a message tells you what kind of problem it is.
| Step | What is checked | Typical problem |
|---|---|---|
| File upload or staging load | Structure of the file or table | Missing sheet, wrong column count, unreadable XML |
| Validate data | Content against field rules and mandatory fields | Required field empty, value too long, wrong format |
| Convert values | Mapping of source values to target values | Source value has no mapping |
| Simulate import | Full import logic without saving data | Missing configuration, missing dependent object, authorization gap |
| Execute import | The actual posting | Duplicate key, locked record, a business rule rejects the data |
An error found early costs little to fix. An error found during execution may mean part of the data is already loaded. This is why the earlier steps matter, and why you should not skip simulation.
Message types and what they mean
Each message has a type. Learn to separate the types, because they call for different responses.
- Error. The instance cannot be migrated. You must correct the cause.
- Warning. The instance can continue, but something may not be what you intended. Read each one and decide. A warning that repeats on every record is often a sign of a mapping or default you forgot to set.
- Information. A note about what the system did, such as a derived value.
- Success. The step completed for that instance.
An instance is one record of a migration object, for example one customer or one G/L account. Each instance carries its own status. A single migration object can therefore end up partly loaded, with some instances successful and some in error.
Anatomy of a message
A useful message tells you four things. Read them in this order:
- Which instance. The key or a reference to the source row, such as the customer ID.
- Which field or structure. Where in the data the problem sits.
- Message text and number. The text says what is wrong. The message class and number let you search for notes and documentation.
- Which step raised it. This tells you where to correct it.
Many errors do not report the root cause. A single bad value in a parent record can make dozens of child records fail. When many messages appear at once, look at the first message per instance and group the rest by message text. Fixing one cause often clears many messages.
Common causes and their fixes
| Cause | Typical message theme | Fix |
|---|---|---|
| Mandatory field empty | "Field is required" | Fill the value in the source, or set a default in the mapping |
| Value too long | Length exceeded | Shorten the source value, or map it to a shorter code |
| Unmapped source value | No target value for source value | Add the entry in the value mapping, then repeat conversion |
| Duplicate key | Record already exists | Remove the duplicate from the source, or confirm the existing record is the intended one |
| Missing dependent object | Reference not found | Load the prerequisite object first, or correct the reference |
| Missing configuration | Customizing entry not found | Ask the functional team to maintain the setting in the target system |
| Authorization | Not authorized | Extend the migration user's role. Do not work around it |
Some causes are not data errors. A missing configuration entry or an authorization gap is fixed in the target system or by an administrator. Editing the file will not help. Deciding quickly whether a message is a data problem, a mapping problem or a system problem saves most of the time you would otherwise spend on correction.
The correction loop
The loop is the same for every migration object. What changes between transfer approaches is where you correct the data.
For each approach:
- File-based transfer. Correct the values in your source file, then upload it again. If you upload the whole file again, expect every instance to be processed again, so check how your release treats instances that already succeeded.
- Staging tables. Correct the rows in the staging table, or in the tool that feeds it, and reload or reprocess. The staging table holds your data between runs, so fix it at the source and avoid one-off edits that the next load will overwrite.
- Direct transfer. You normally have no file to edit. Corrections happen in the source system, in the selection and mapping rules, or in the target configuration. Then you repeat the transfer.
Value mapping errors are corrected in the cockpit itself. You add or change the mapping, then repeat the conversion step. You do not need to touch the source data.
Catch common errors before the cockpit does
The cockpit's own validation is the authority, but you can remove the most common errors earlier and cheaply. The script below checks a source CSV for duplicate keys and for values longer than a limit. The file and field names are placeholders, not SAP template fields. Replace them with the columns of your own extract.
import csv
from collections import Counter
def precheck(path, key_field, max_lengths):
"""Return a list of problems found in a source CSV before upload."""
problems = []
keys = Counter()
with open(path, newline="", encoding="utf-8") as f:
for line_no, row in enumerate(csv.DictReader(f), start=2):
keys[row[key_field]] += 1
for field, limit in max_lengths.items():
if len(row[field]) > limit:
problems.append(f"line {line_no}: {field} is longer than {limit} characters")
problems += [f"duplicate key {k}" for k, n in keys.items() if n > 1]
return problems
for problem in precheck("customers.csv", "CustomerId", {"Name": 40}):
print(problem)The script reports line numbers starting at 2, because line 1 is the header. Run it again after each correction until it prints nothing. Then upload the file.
Working through a large error list
When an import reports hundreds of errors, a fixed routine keeps you from fixing the same problem repeatedly.
- Filter to errors only. Leave warnings for later.
- Sort or group by message text. Note the count per text.
- Take the most frequent message and find one example instance.
- Decide whether it is a data, mapping or system cause.
- Fix the cause, not the single record. For a data cause, fix the pattern in the source.
- Repeat the step and compare the error count with the previous run.
Keep a short log with the run, the message, the cause and the fix. The log is useful later. The same errors tend to return in each test cycle, and a documented fix lets you apply it again during cutover without rediscovering it.
Pitfalls
- Fixing in the target. Changing a record directly in the S/4HANA system after a partial load makes the source and target disagree. The next run may then report a duplicate or overwrite your change. Correct the source, and repeat the step.
- Ignoring warnings. A warning that a default was applied may mean every record was loaded with a value nobody approved.
- Chasing consequences. If a parent object fails, its dependent objects fail too. Fix the parent first, following the load order from the dependency chapter.
- Changing the template structure. Adding, deleting or renaming columns in a downloaded template usually causes structural errors on upload. Download a fresh template if the structure is damaged.
- Treating a simulation as a guarantee. Simulation does not save data, so it cannot see problems that arise only from other records posted in the same run, such as a lock or a number range that runs out. Allow for a few new errors at import.
Exercise
A customer import reports 300 errors. Grouping by message text shows 280 of them say that a source value for the payment terms has no mapping, and 20 say that the name is too long. Which errors do you fix first, where do you fix each group, and which step do you repeat afterwards?
Show answer
Fix the 280 payment-terms errors first, because they are the largest group and probably share one cause. Add the missing source-to-target entries in the value mapping in the cockpit, then repeat the value conversion step. Fix the 20 name errors in the source data (the file or staging table) by shortening the names, then upload or reload the data and repeat validation. Finally repeat the simulation. Run it again until it shows no errors, and only then execute the import.