# Inspection Results Upload from Laboratory File Program

> A custom interface program that records the measured values in a CSV/XLSX file produced by laboratory instruments or a laboratory information system against inspection lot characteristics in bulk. It removes manual results entry and typing errors, checks everything in test mode and can valuate and close the characteristics.

- Type: Program, Custom development, Interface
- Module: QM
- Estimated effort: M (5–7 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/inspection-results-upload-from-lab-file-program/


## Why is the standard not enough?

QE51N and QE01 expect results to be keyed in on the screen; there is no standard transaction that reads measured values from a file on a schedule. Certified laboratory interfaces need setup and licences. For laboratories that get a CSV from their instruments, a simple interface that reads the file and records the results through the standard BAPI is enough.

### Closest standard alternatives

- QE51N: Expects results to be keyed in on the screen; does not read files.
- QE01: Records results for one inspection lot; no scheduled bulk load.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| QALS | Inspection lot and usage decision status (check) | Read | QALS-PRUEFLOS = dosyadaki parti | ECC + S/4 |
| QAMV | Characteristic definition, unit and tolerance limits (check) | Read | QAMV-PRUEFLOS = QALS-PRUEFLOS | ECC + S/4 |
| QAMR | Characteristic result and valuation | Write | QAMR-PRUEFLOS = QAMV-PRUEFLOS AND QAMR-MERKNR = QAMV-MERKNR | ECC + S/4 |
| QASE | Single measured values | Write | QASE-PRUEFLOS = QAMV-PRUEFLOS AND QASE-MERKNR = QAMV-MERKNR | ECC + S/4 |

## BAPIs and functions used

- BAPI_INSPOPER_GETCHAR: Reads the characteristics and limits of the lot operation
- BAPI_INSPOPER_RECORDRESULTS: Records the results and optionally valuates and closes them
- BAPI_TRANSACTION_ROLLBACK: Rolls back in test mode
- BAPI_TRANSACTION_COMMIT: Saves successful results permanently

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | Results file or folder | Single value | - | Yes |
| P_SERVER | Read from application server (background) | Checkbox | - | No |
| P_CLOSE | Valuate and close characteristics | Checkbox | - | No |
| P_TEST | Test mode (check without saving) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| Inspection lot | QALS-PRUEFLOS | Yes |
| Operation number | Operation number from the inspection plan (e.g. 0010); passed to the BAPI as the operation | Yes |
| Characteristic no. | QAMV-MERKNR | No |
| Master characteristic (instead of no.) | QAMV-VERWMERKM | No |
| Measured value | QASE-MESSWERT | Yes |
| Inspector | QASE-PRUEFER | No |
| Inspection date | QASE-PRUEFDATUV | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| Inspection lot | QALS-PRUEFLOS |
| Characteristic no. | QAMV-MERKNR |
| Characteristic text | QAMV-KURZTEXT |
| Value | Calculated: Measured value from the file |
| Valuation | QAMR-MBEWERTG |
| Status | Calculated: From the BAPI return messages: checked, recorded or error |
| Message | Calculated: First error or success message from the BAPI return table |

## How does the program work?

1. The file is read from the user's PC or, in a background job, from a folder on the application server; the first row is skipped as the header.
2. Each row is split into inspection lot, operation number, characteristic number (or master characteristic), measured value, inspector and date.
3. BAPI_INSPOPER_GETCHAR reads the characteristics and tolerance limits of the lot. Checks: the lot exists and has no usage decision (QALS-STAT35 blank), the characteristic is open, and for quantitative characteristics the value is numeric.
4. BAPI_INSPOPER_RECORDRESULTS records the results as single values or as a summary; with "Valuate and close" selected, the characteristic is accepted or rejected against its tolerance limits and closed.
5. In test mode the change is rolled back with BAPI_TRANSACTION_ROLLBACK; in a real run BAPI_TRANSACTION_COMMIT follows each lot. The processed file is moved to an archive folder and failed rows are written to a separate file.

## Authorization objects

- Q_INSPTYPE: Inspection lot authorization by inspection type
- Q_TCODE: QM transaction code authorization for results recording

## Frequently asked questions

### Are different instrument file formats supported?

Yes. The column mapping for each instrument or lab system can be kept in a small maintenance table, so adding a new instrument does not need a code change.

### Can qualitative (coded) characteristics be loaded?

Yes. If the file holds a code group and code instead of a value, the program records it as a qualitative result.

### Can this program be used on S/4HANA?

Yes. BAPI_INSPOPER_RECORDRESULTS is supported on S/4HANA and the QM tables keep the same structure.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=qm-inspection-results-upload
