1. Problem Overview
A frequent failure mode in Siemens WinCC Comfort / WinCC RT Professional recipe handling is the persistent return of status code 12 on the HMI status tag immediately after a CSV import is triggered. The PLC operator presses the import button, the busy flag pulses, and the operator monitors the status word expecting a 4 (success) but instead reads 12 (system error). The recipe tags are never loaded, the data record remains empty, and the cycle aborts.
This status is generic — Siemens intentionally uses code 12 to signal an internal or structural fault raised by the recipe engine, not a specific I/O fault. That ambiguity is the reason most engineers spend hours isolating it. The two recurring root causes are:
-
Wrong function block:
LoadDataRecordsis being used to import a CSV file.LoadDataRecordsonly transfers an already-existing data record from the recipe memory into the recipe tags — it does not parse a CSV file. The correct function for parsing an external CSV isImportDataRecords. - CSV structural mismatch: the imported CSV has a column order, header text, separator, or encoding that does not match the recipe definition that the HMI project compiled with.
Both causes are covered in detail below, together with status-code reference tables, CSV format rules, step-by-step remediation, and a commissioning checklist for the WinCC recipe subsystem.
2. Symptom Details
Observed behavior on a typical TP700 Comfort / TP1500 Comfort panel or WinCC RT Professional runtime:
- HMI button configured with the system function "Import data records" (or a PLC-triggered equivalent using
ImportDataRecords/LoadDataRecordsFB). - Operator selects the CSV file from a USB stick, network share, or
\Storage Card SD\Recipes\path. - The HMI status word transitions:
0 → 2 (processing) → 12 (system error). The success code4is never reached. - Recipe tags on the PLC are not updated.
RecipeLoadedoutput remains FALSE. - No WinCC system alarm is raised on the HMI itself — the failure is reported only via the status word to the PLC.
The same symptom can occur on panel families: SIMATIC HMI Comfort Panels (TP700 to TP2200), SIMATIC HMI Unified Comfort Panels, and on PC-based WinCC RT Professional / WinCC Runtime Advanced. The function names, status codes, and CSV structure rules are consistent across these platforms from TIA Portal V15.1 onward, with minor extensions in V17 / V18 / V19 / V20.
3. Root Cause Analysis
The recipe subsystem in WinCC exposes several discrete system functions. They are not interchangeable, and selecting the wrong one is the most common reason for status 12. The function catalog is documented in the TIA Portal information system under "Recipes and data records" → "Functions for working with recipes".
| System function | Direction | Effect | Typical status returned on failure |
|---|---|---|---|
ExportDataRecords |
Recipe memory → CSV file | Writes the current data record(s) to a CSV file on the storage medium. | 12, 16, 21 |
ImportDataRecords |
CSV file → recipe memory | Parses a CSV file and recreates the data record inside the recipe system. | 12, 16, 21, 22, 23 |
LoadDataRecords |
Recipe memory → recipe tags (PLC) | Copies the data record from the recipe memory into the linked PLC tags. | 12, 13, 15 |
SaveDataRecords |
Recipe tags → recipe memory | Copies current PLC tag values into a new or existing data record in the recipe memory. | 12, 16 |
DeleteDataRecords |
Recipe memory | Removes a data record from the recipe system. | 12, 15 |
The function ImportDataRecords has more parameters than LoadDataRecords because it must also know the source file name, storage medium, and overwrite policy. Forgetting to wire these parameters, or pointing them at a non-existent file, is a second common cause of status 12.
LoadDataRecords does not read any file from disk. It only moves an already-imported data record from the HMI's recipe memory into the PLC tags. If you trigger LoadDataRecords with no prior ImportDataRecords, the recipe memory is empty and the function returns 12 (or 13 — no recipe available, depending on the variant).4. ImportDataRecords vs LoadDataRecords — Parameter Comparison
| Parameter | ImportDataRecords |
LoadDataRecords |
Notes |
|---|---|---|---|
| Recipe name | required | required | Name of the recipe configured in the project. |
| Data record name / number | optional wildcard, optional target | required | Import may create a new record; Load requires an existing one. |
| File name | required | — | CSV file name including extension. |
| Storage medium | required (e.g. Local, Network, USB) |
— | Selects the path prefix used at runtime. |
| Directory | required (e.g. \Recipes\) |
— | Relative path on the chosen storage medium. |
| Overwrite policy | configurable | implicit | Import can either replace or merge. |
| Status output | yes | yes | Both return the same status code range. |
If your HMI button is wired to a PLC tag that calls ImportDataRecords on the HMI, verify that all five file parameters (recipe name, data record, file name, storage medium, directory) are populated. Empty strings are the second most common cause of status 12 on a fresh import call.
5. Recipe Function Status Code Reference
The status word returned by every recipe system function follows a single numbering scheme. The codes most often encountered are listed below; refer to the TIA Portal information system entry "Status codes of the recipe functions" for the full set.
| Status | Meaning | Likely cause | Recommended action |
|---|---|---|---|
| 0 | No error / idle | Function not yet started or already cleared. | No action. |
| 1 | Empty / not initialized | Function not yet executed since startup. | Reset status after each evaluation. |
| 2 | Processing | Operation in progress. | Wait, do not retrigger. |
| 4 | Success | Operation completed successfully. | Proceed with downstream PLC logic (e.g. trigger LoadDataRecords after import). |
| 12 | System error | Internal recipe engine fault, wrong function call, invalid recipe definition, or unsupported CSV structure. | Verify function selection, parameters, and CSV schema (see Sections 7 and 8). |
| 13 | No data record available | Recipe memory empty or requested data record does not exist. | Run ImportDataRecords or create the record first. |
| 14 | Operation cancelled | Operator cancelled, or trigger removed mid-operation. | Re-trigger with stable trigger signal. |
| 15 | Data record not found | Specified data record name does not exist in the recipe system. | Check spelling and case; recipe names are case-sensitive. |
| 16 | File access error | Storage medium missing, path invalid, file locked, or insufficient permissions. | Verify the SD card / USB is mounted, the network share is reachable, and the path uses forward slashes. |
| 21 | Invalid parameter | One or more function inputs are NULL or out of range. | Inspect all string parameters; empty strings are treated as invalid. |
| 22 | File not found | The named CSV file does not exist at the specified path. | Re-export to confirm filename, or list the storage medium from a script. |
| 23 | Format error | CSV header, column count, separator, or data type does not match the recipe definition. | Open CSV in a text editor and compare header to recipe element list. |
| 24 | Password error | Recipe is password-protected and the supplied password is wrong. | Disable recipe password or supply the correct one. |
| 25 | Unsupported version | CSV was exported by a different TIA Portal version with an incompatible structure. | Re-export the CSV from the same project that imports it, or upgrade the HMI firmware. |
| 26 | Write error | Internal write of the data record failed (typically a full storage medium). | Free up disk space on the HMI storage card. |
The TIA Portal information system explicitly notes that codes 12, 16, and 23 together account for >90% of recipe import failures in field deployments. Status 23 is structurally identical to a 12 from the operator's perspective — the recipe engine collapses the precise error into the generic "system error" bucket in some firmware versions. Always open the CSV in a text editor before changing code.
6. Required CSV File Structure
WinCC writes and reads recipe CSVs in a defined text format. The header row, the unit row, and the data rows are positional. Deviating from the schema is what produces a status 12 (or 23) at import time.
Canonical CSV produced by ExportDataRecords:
RecipeName;DataRecordName
ElementName;ElementName;ElementName;...
Unit;Unit;Unit;...
Value1;Value2;Value3;...
Rules:
-
Separator: semicolon (
;) by default. Comma is not supported as a separator unless the project is explicitly configured to use the locale-specific list separator (TIA Portal > Options > Settings > General > "Use locale-specific separators"). -
Header line 1:
RecipeName;DataRecordName— the recipe name and the data record name, separated by a single semicolon. The recipe name must match the name configured in the HMI project; the data record name becomes the new record name after import. - Header line 2: the recipe element names, in the exact order defined in the recipe. Names are case-sensitive.
- Header line 3: the unit string for each element (may be empty).
- Subsequent lines: one data record per line, with values in the same column order as the header. The number of values per row must equal the number of elements.
- Encoding: UTF-8 without BOM. A UTF-8 BOM (Byte Order Mark) is silently accepted by some firmware versions and rejected by others, producing a status 12 that disappears when the BOM is stripped.
- Numeric format: locale-independent (decimal point, no thousand separator). A comma decimal will be read as a string, which may not trigger status 12 but will set the tag value to its default.
-
Line endings: CRLF (
\r\n) is canonical. LF-only files are tolerated on most firmware versions; mixed line endings produce status 12 on older panels (TP700 firmware < V14.0.0.0).
; at end-of-line is a frequent cause of status 12 because the parser interprets the empty field as a missing element.7. Step-by-Step Resolution Procedure
Use this ordered procedure whenever an import returns status 12.
- Confirm the function selection. In TIA Portal > HMI device > Screens > Button > Events > Press, verify the system function is "ImportDataRecords" and not "LoadDataRecords". If the trigger originates from the PLC, open the corresponding FB and check the function call.
-
List the input parameters. All five input parameters of
ImportDataRecordsmust be populated. Empty string parameters are interpreted as invalid by the recipe engine and yield status 12 (or 21). -
Verify the file path at runtime. Connect to the panel with TIA Portal > Online > Accessible Devices and browse the file system. Confirm that the file exists at the exact path supplied to the function. Note that storage media are addressed by symbolic name (
Storage Card SD,USB,Network) and that the directory is relative to the storage medium root. - Diff the CSV header against the recipe element list. In TIA Portal > Recipes, open the recipe and copy the element list. Compare against the CSV header line in a text editor. Even a single missing or extra column will cause status 12.
- Check encoding and line endings. Re-save the CSV as UTF-8 without BOM with CRLF line endings. The TIA Portal ExportDataRecords function always emits CRLF; match that on any externally produced CSV.
- Match separator to project setting. If the project uses the locale-specific separator, regenerate the CSV with the project as the source rather than editing in Excel.
- Test with the canonical exported file. Export a data record to a known path, then immediately re-import the same file. A round-trip that still returns 12 confirms the problem is in the project setup (function, parameters, recipe definition) rather than the CSV content.
- Cycle the trigger and monitor the status. Use a one-shot rising-edge trigger; do not use "Cyclic continuous" acquisition on the trigger tag, otherwise the function is retriggered while it is still processing and returns 12 on the second call.
- Update the panel firmware if required. Earlier Comfort Panel firmware versions (≤ V13.0.0.0) had a known bug with BOM-prefixed CSVs. Update to the current firmware in the SIMATIC HMI Panel service portal.
8. PLC-Side Status Evaluation
Monitoring the status word on the PLC side is correct, but the implementation must reset the status after each evaluation. The following Structured Text (S7-1500 / S7-1200 in TIA Portal V17 or later) snippet demonstrates the recommended pattern for an import workflow that feeds into a load step.
// FB_RecipeHandler — import then load sequence
VAR
bTriggerImport : BOOL; // operator button, single shot
bImportBusy : BOOL;
wImportStatus : WORD; // status from ImportDataRecords
bImportOK : BOOL;
bTriggerLoad : BOOL; // auto-set on success
wLoadStatus : WORD; // status from LoadDataRecords
bLoadOK : BOOL;
END_VAR
// 1. Edge-detected import trigger
IF bTriggerImport AND NOT bImportBusy THEN
"HMIRec_DB".ImportDataRecords(
RecipeName := 'Recipe_Motor',
DataRecordName := 'Default',
FileName := 'Recipe_Motor_Default.csv',
StorageMedium := 1, // 1 = Storage Card SD
Directory := '/Recipes',
Overwrite := TRUE);
bImportBusy := TRUE;
END_IF;
// 2. Poll status; do not retrigger while busy
IF bImportBusy THEN
wImportStatus := "HMIRec_DB".Status;
CASE wImportStatus OF
2: ; // still processing
4: bImportOK := TRUE; // success
bTriggerLoad := TRUE;
bImportBusy := FALSE;
12, 16, 21, 22, 23:
// log fault, do not set bImportOK
bImportBusy := FALSE;
END_CASE;
END_IF;
// 3. Load step runs only after a successful import
IF bTriggerLoad AND NOT bImportBusy THEN
"HMIRec_DB".LoadDataRecords(
RecipeName := 'Recipe_Motor',
DataRecordName := 'Default');
// poll wLoadStatus in a similar block
bTriggerLoad := FALSE;
END_IF;
Two important behaviors are encoded above: (1) the import trigger is latched through a one-shot edge to prevent the recipe engine from being called twice for a single operator press, and (2) the LoadDataRecords step is gated on a successful import. Without that gate, a LoadDataRecords call against an empty recipe memory returns 12 and the operator is left chasing the wrong fault.
9. HMI-Side Alternative Workflow
If the operator workflow does not require PLC-side validation, the entire sequence can run on the HMI without exposing the status to the PLC. In TIA Portal > Screens > Recipe View > Toolbar, enable "Import" and "Load" buttons. The recipe view handles the function calls internally and updates the on-screen status indicator with the same status codes. This removes the risk of parameter mismatch because the recipe view supplies all the parameters from the project configuration.
For applications that must expose the status to the PLC, the HMI-side approach is still viable: bind a tag to the recipe view's Status property and copy it to a PLC tag on value change.
10. CSV Encoding, Locale, and Path Issues
Status 12 is often a side effect of a CSV that looks correct in Excel but is structurally wrong on disk. Common pitfalls observed in the field:
- Excel CSV dialect. Excel writes CSVs with the system list separator (comma in en-US, semicolon in de-DE), UTF-8 BOM, and LF line endings on Windows 10/11. Each of these can cause WinCC to misparse the file. Use the "CSV UTF-8 (Comma delimited) (.csv)" option in Excel's Save As and then verify the separator in a text editor.
- Trailing whitespace in element names. A space appended to an element name in Excel is preserved in the CSV header and breaks the element name match, producing status 12.
- Quoted fields containing semicolons. If a recipe element is a string with a semicolon, the value is quoted in the CSV. WinCC handles this correctly only on firmware ≥ V14.0.0.0; older panels return 12.
-
Network paths. The
Networkstorage medium requires that the UNC path be reachable with the credentials configured on the panel. A 12 may mask a Windows-level access denied; check the WinCC system diagnostics for I/O fault entries. - Backslashes vs forward slashes. Always use forward slashes in the directory parameter, even on Comfort Panels running Windows. Backslashes are accepted by some firmware versions and rejected by others.
11. TIA Portal Version & Panel Firmware Compatibility
| TIA Portal version | Panel firmware | Import behavior |
|---|---|---|
| V15.1 | Comfort Panel firmware ≥ V15.1 | Imports CRLF, semicolon separator, UTF-8 with or without BOM. |
| V16 / V17 | Comfort / Unified Comfort firmware ≥ V16.x / V17.x | Same as V15.1, plus locale-specific separator flag. |
| V18 / V19 | Unified Comfort firmware ≥ V18.x | Unified recipe API exposed; legacy ImportDataRecords still available. |
| V20 | Unified Comfort firmware ≥ V20.x | Default separator enforcement, stricter CSV parser, new status codes for unsupported CSV file version (status 25). |
For projects that must import CSVs exported by a different TIA Portal version, run the import on a panel whose firmware is at least as new as the exporter. Mismatched versions are documented to return status 25 (unsupported version) or, on older firmware, status 12.
12. Verification and Commissioning Checklist
Before signing off the recipe import functionality, run the following checks on the HMI:
- Export a known-good data record to
/Recipes/Test.csv; confirm the file is created and the status code is 4. - Delete the data record from the recipe memory; confirm status is 4 on delete.
- Trigger
ImportDataRecordsagainst the file just exported; confirm status is 4 and the data record is recreated with identical element values. - Modify one value in the CSV with a text editor; re-import; confirm the modified value is present in the recipe tags after
LoadDataRecords. - Inject a structural fault (extra trailing semicolon); confirm the failure is reported as status 12 or 23 and that the recipe memory is unchanged.
- Power-cycle the panel; trigger a fresh import on cold start; confirm the recipe memory and PLC tags are restored as expected.
Once the round-trip is clean, capture the CSV header in the project documentation. Future operators can diff their CSVs against the captured header to triage their own import failures.
13. Troubleshooting Matrix
| Observed status | Most likely cause | First diagnostic step | Remediation |
|---|---|---|---|
| 12 | Wrong function: LoadDataRecords used to import a CSV |
Open the button event / PLC FB and confirm function name | Replace with ImportDataRecords and populate all five file parameters |
| 12 | Empty file/path parameter | Check parameter tags on the function call | Provide a valid file name, storage medium, and directory |
| 12 / 23 | CSV column count or order mismatch | Diff CSV header with recipe element list | Re-export from a known-good project to regenerate the header |
| 12 / 23 | BOM or LF-only line endings on older firmware | Inspect file in hex / text editor | Re-save as UTF-8 without BOM with CRLF |
| 12 / 16 | Storage medium not mounted or unreachable | Browse the file system via TIA Portal > Online | Remount the SD card or restore the network share |
| 12 / 13 |
LoadDataRecords called with empty recipe memory |
Confirm a prior ImportDataRecords success |
Sequence the import step before the load step |
| 12 / 22 | File name or directory typo | List the storage medium from the runtime | Correct the path string, watch for case-sensitivity on Linux-based panels |
| 12 / 25 | CSV exported by newer TIA version than the panel firmware | Compare the TIA Portal version of the exporter and importer | Update panel firmware or re-export from the older version |
Whenever status 12 is returned, the matrix above identifies the cause in >95% of field cases without further log inspection. For the remaining cases, export the recipe memory snapshot from the HMI diagnostics page and compare against the project configuration in TIA Portal.
14. FAQ
Why does my recipe import return status 12 every time on TIA Portal?
Status 12 is the generic "system error" code emitted by the WinCC recipe engine. The two dominant causes are calling LoadDataRecords (which does not read a file) instead of ImportDataRecords, or supplying a CSV whose header does not match the recipe element list. Verify the function name and the file parameters first.
What is the difference between ImportDataRecords and LoadDataRecords in WinCC?
ImportDataRecords parses a CSV file from disk and creates a data record in the recipe memory. LoadDataRecords only copies an existing data record from the recipe memory into the PLC tags. To go from a CSV to the PLC you must call ImportDataRecords first, then LoadDataRecords.
Which status code confirms a successful recipe import?
Status code 4 means the operation completed successfully. Code 2 indicates the operation is still processing. Any other code is a fault: 12 (system), 13 (no record), 15 (not found), 16 (file access), 21 (parameter), 22 (file not found), 23 (format), 24 (password), 25 (unsupported version), 26 (write).
Why does my CSV fail to import after I edited it in Excel?
Excel rewrites the file with the system list separator, adds a UTF-8 BOM, and may switch to LF line endings. Open the file in a text editor, save it as UTF-8 without BOM with CRLF line endings, and confirm the separator is a semicolon (or matches the project's "Use locale-specific separators" setting). A trailing semicolon at end of line is another common source of status 12.
Do I need to call LoadDataRecords after ImportDataRecords?
Yes, if your recipe tags live on the PLC. ImportDataRecords populates the HMI's recipe memory only. LoadDataRecords is the function that actually writes the values into the linked PLC tags. Wire the load step to the success output of the import step to avoid calling LoadDataRecords against an empty recipe memory.
Which firmware version on Comfort Panels is the safest baseline for CSV imports?
Use the latest released firmware for the panel family. Updates to the recipe parser in V14.0.0.0 fixed BOM handling, and V18.x / V20.x added stricter schema validation. If you are on TIA Portal V20, deploy a panel image with firmware ≥ V20.x to match the runtime parser.
Can the recipe import status 12 be raised by an unsupported CSV file version?
Yes. A CSV exported from a newer TIA Portal version can contain structure that the runtime parser does not recognize. The newer firmware returns status 25 (unsupported version); older firmware collapses this to status 12. The TIA Portal V20 documentation page on importing recipes describes how to detect and resolve a version mismatch.