# Customer Complaint Quality Notification Creation Interface from File or Portal

> A custom interface program that reads customer complaints exported by a web portal, CRM or call centre from a file and creates a customer complaint quality notification for each row, with delivery, material, batch and defect code. It prevents the same complaint from being created twice through the external reference and lists the result per row.

- Type: Program, Custom development, Interface
- Module: QM
- Estimated effort: M (4–6 working days)
- Last updated: 2026-11-17
- URL: https://nekuhub.com/en/programs/customer-complaint-quality-notification-creation-interface/


## Why is the standard not enough?

QM01 creates notifications one by one and manually; if complaints are collected in another system, each one is typed again and delivery and batch data are often missing. The standard offers no ready file interface for customer complaints. The custom interface validates the complaints in the file, completes missing material and batch from the delivery item and opens the notifications through the standard BAPI.

### Closest standard alternatives

- QM01: Creates quality notifications manually one at a time; does not read file or portal data.
- QM02: Changes an existing notification; does not create notifications in bulk.

## Tables used

| Table | Role | Access | Join | System |
|---|---|---|---|---|
| QMEL | Notification headers created; duplicate check by external reference | Read / write | - | ECC + S/4 |
| QMFE | Notification defect item and defect code | Write | - | ECC + S/4 |
| KNA1 | Customer check | Read | KNA1-KUNNR = QMEL-KUNUM | ECC + S/4 |
| LIKP | Check that the delivery belongs to the customer | Read | LIKP-VBELN = QMEL-LS_VBELN | ECC + S/4 |
| LIPS | Material, batch and delivered quantity from the delivery item | Read | LIPS-VBELN = QMEL-LS_VBELN AND LIPS-POSNR = QMEL-LS_POSNR | ECC + S/4 |

## BAPIs and functions used

- BAPI_QUALNOT_CREATE: Creates the customer complaint notification for each row
- BAPI_QUALNOT_SAVE: Saves the notification created
- BAPI_TRANSACTION_COMMIT: Makes the save permanent

## Selection screen parameters

| Parameter | Description | Type | Reference field | Required |
|---|---|---|---|---|
| P_FILE | File or application server folder | Single value | - | Yes |
| P_QMART | Notification type | Single value | QMEL-QMART | Yes |
| P_MOVE | Move processed file to the archive folder | Checkbox | - | No |
| P_TEST | Test mode (check without creating notifications) | Checkbox | - | No |

## Input file columns

| Column | Target field | Required |
|---|---|---|
| External reference | QMEL-REFNUM | Yes |
| Customer | QMEL-KUNUM | Yes |
| Delivery | QMEL-LS_VBELN | No |
| Delivery item | QMEL-LS_POSNR | No |
| Material (blank = from delivery) | QMEL-MATNR | No |
| Batch (blank = from delivery) | QMEL-CHARG | No |
| Complaint quantity | QMEL-RKMNG | Yes |
| Unit | QMEL-MGEIN | No |
| Short text | QMEL-QMTXT | Yes |
| Defect code group | QMFE-FEGRP | No |
| Defect code | QMFE-FECOD | No |
| Priority | QMEL-PRIOK | No |

## Result list columns

| Column | Source |
|---|---|
| Row | Calculated: Row number in the file |
| External reference | QMEL-REFNUM |
| Notification | QMEL-QMNUM |
| Status | Calculated: Created, duplicate (skipped), test OK or error |
| Message | Calculated: Check message or the first message from the BAPI return table |

## How does the program work?

1. The file (CSV or XLSX) is read from the user's PC or, in a background job, from a folder on the application server. If a notification with the same external reference (QMEL-REFNUM) already exists, the row is skipped.
2. Checks: the customer exists in KNA1; if a delivery is given, it belongs to the customer in LIKP; if a delivery item is given, material and batch are completed from LIPS and the complaint quantity may not exceed the delivered quantity (LIPS-LFIMG); the defect code group and code must exist in the catalog.
3. BAPI_QUALNOT_CREATE is called with the selected notification type: customer, material, batch, complaint quantity and unit, delivery reference, priority and short text in the header; defect code group and code in the item; a description, if any, goes to the long text.
4. The notification is saved with BAPI_QUALNOT_SAVE and BAPI_TRANSACTION_COMMIT. In test mode only the checks run and no notification is created.
5. Result and message are listed per row; failed rows are written to a separate file and the processed file is moved to an archive folder.

## Authorization objects

- Q_QMEL: Authorization to create quality notifications by notification type
- Q_TCODE: QM transaction authorization (QM01)

## Frequently asked questions

### What happens if the same complaint is sent twice?

The program checks the external reference (QMEL-REFNUM). If a notification with this reference exists, the row is skipped as a "duplicate" and the existing notification number is shown in the message.

### Can a direct portal connection be used instead of a file?

Yes. The same check and creation logic can be published as an OData service or an RFC, so the portal writes the complaint to SAP immediately and gets the notification number back. The effort range grows with the service design.

### Does the program work on S/4HANA?

Yes. BAPI_QUALNOT_CREATE, BAPI_QUALNOT_SAVE, QMEL and QMFE are also used in S/4HANA; the file template stays the same.

---
Let us build this program for your system: https://nekuhub.com/en/request-a-quote/?report=qm-customer-complaint-notification-interface
