Automatic Email Alerts to Purchasing and Production for Usage Decisions and Quality Rejections
Short answer: A custom program run by a background job at short intervals that reads the usage decisions made since the last run and, for rejections, sends an email with material, batch, vendor, purchase order, rejected quantity and decision code to the purchasing group, the production supervisor or a quality distribution list depending on the origin of the inspection lot. Acceptances can be sent as a daily summary.
- Estimated effort
- M · 4–6 working days
- System
- ECC and S/4HANA
- Tables
- 8
- Scope
- Global
- Built by
- NeKuDos Teknoloji
- Last updated
Why is the standard not enough?
When a usage decision is made in QA11 or QA32, the standard system informs nobody automatically; follow-up actions of the usage decision do not send email without a custom function and do not determine the recipient by purchasing group. QA33 lists decisions afterwards but needs someone to look. The custom job determines the recipient by origin, prevents a second email for the same lot and logs the result.
Who uses it? Buyers, production planning, quality control and warehouse teams.
Closest standard alternatives
Tables used
The tables the program reads and updates. ECC and S/4HANA differences are marked separately.
| Table | Role | Access | System |
|---|---|---|---|
| QAVEUsage Decision | Usage decisions: code, valuation, date and time (driving table) | Read | ECC + S/4 |
| QALSInspection Lot Record | Inspection lot: origin, material, batch, vendor, order | Read | ECC + S/4 |
| QPCTCode Texts | Text of the usage decision code | Read | ECC + S/4 |
| QAMBLink Between Inspection Lot and Material Document | Link from usage decision stock postings to material documents | Read | ECC + S/4 |
| MSEGMaterial Document Item | Quantity moved to blocked stock or returned | Read | ECC + S/4 |
| EKKOPurchasing Document Header | Purchasing group of the order | Read | ECC + S/4 |
| T024Purchasing Groups | Email address of the purchasing group | Read | ECC + S/4 |
| TVARVCTable of Variant Variables (Client-Specific) | Timestamp of the last successful run | Read / write | ECC + S/4 |
S/4HANA notes
- MSEG → MATDOC: In S/4HANA MATDOC replaces MSEG; reading MSEG works through a compatibility view but is slow at high volumes.
BAPIs and functions used
- SO_DOCUMENT_SEND_API1SAPoffice: Send Document with Attachments. Sends the alert email
Selection screen parameters
| Parameter | Description | Type | Reference field | Required | Example |
|---|---|---|---|---|---|
| S_WERK | Plant | Range / multiple | QALS-WERK | Yes | 1000 |
| S_ART | Inspection type | Range / multiple | QALS-ART | No | 01, 04 |
| S_HERK | Lot origin | Range / multiple | QALS-HERKUNFT | No | 01, 04, 08 |
| P_REJ | Send only rejections immediately | Checkbox | — | No | X |
| P_SUMM | Send acceptances as a daily summary | Checkbox | — | No | X |
| P_DLIST | Default distribution list | Single value | — | No | KALITE_BILDIRIM |
| P_TEST | Test mode (list without sending) | Checkbox | — | No | — |
Result list columns
| # | Column | Source |
|---|---|---|
| 1 | Inspection lot | QALS-PRUEFLOS |
| 2 | Origin | QALS-HERKUNFT |
| 3 | Material | QALS-MATNR |
| 4 | Batch | QALS-CHARG |
| 5 | Vendor | QALS-LIFNR |
| 6 | Purchase order | QALS-EBELN |
| 7 | Decision code | QAVE-VCODE |
| 8 | Valuation | QAVE-VBEWERTUNG |
| 9 | Rejected quantity | Calculated Quantity moved to blocked stock or returned (QAMB → MSEG) |
| 10 | Recipient | Calculated Purchasing group, production supervisor or distribution list |
| 11 | Status | Calculated Sent, added to summary, no recipient or error |
Sample result list
| Inspection lot | Origin | Material | Batch | Vendor | Purchase order | Decision code | Valuation | Rejected quantity | Recipient | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| 010000004512 | 01 | HM-1001 | L2611-09 | 100512 | 4500021462 | R1 | R | 2,000 | [email protected] | Sent |
| 010000004530 | 01 | SC-3300 | 100387 | 4500021478 | A2 | A | 0 | [email protected] | Added to daily summary | |
| 040000001288 | 04 | BR-2100 | F2611-04 | R2 | R | 150 | [email protected] | Sent | ||
| 080000000315 | 08 | SP-0045 | R1 | R | 40 | [email protected] | No recipient found; sent to distribution list |
How does the program work?
- The job runs every 15 minutes; the date and time of the last successful run are stored in TVARVC and updated at the end of the job.
- Usage decisions made after this time are read from QAVE; the decision code and valuation (VBEWERTUNG: A accept, R reject) are taken and the code text comes from QPCT.
- The inspection lot is read from QALS: origin (01 goods receipt, 04 production, 08 stock transfer etc.), material, batch, vendor, order and lot quantity. The quantity moved to blocked stock or returned is calculated from the usage decision stock postings (QAMB and the linked material document items).
- Recipient: for goods receipt lots the email address of the order’s purchasing group (T024-SMTP_ADDR), for production lots the production supervisor, for other origins the distribution list from the parameter.
- The email with lot and decision data is sent with SO_DOCUMENT_SEND_API1; a second email for the same inspection lot is not sent. Acceptances can be sent once a day as a summary table.
- At the end of the run, sent, recipient-not-found and failed records are listed in the log.
Performance notes
Restrict QAVE by decision date and time; since each run only reads the decisions of the last 15 minutes, the job finishes in a few seconds. Read QALS, EKKO and T024 in bulk with the keys from the decision list.
Features
- Runs as a background job The job is scheduled to run every 15 minutes.
- Test mode (check without posting)
- Line-by-line result and error log
- Send the result by email
Authorization objects
- Q_INSPTYPEInspection lot display authorization by inspection type
- S_BTCH_JOBAuthorization to schedule the background job
- S_OC_SENDAuthorization to send email
Frequently asked questions
Can the email be sent at the moment of the decision?
Yes: a function with the same logic can be attached to the usage decision follow-up action. The background job approach does not slow down the decision screen, an email problem does not block saving the decision and the resend check lives in one place. Either option is chosen as needed.
Can inspection results be attached to the email?
Yes. Characteristic results (QAMR) can be added to the email as a table or as a PDF attachment, and a rejection report to share with the vendor can be produced as well. This adds 1–2 days to the estimate.
Does it work on S/4HANA?
Yes. QALS, QAVE and T024 are the same in S/4HANA. If clean core is preferred, inspection lot data is read from I_InspectionLot; the BCS classes can be used for sending email.
Related reports
Automatic Vendor Quality Notification Creation for Rejected Characteristics
A custom background job that automatically opens a quality notification against the vendor for goods receipt lots with a rejected characteristic. The …
Inspection Lots Awaiting Usage Decision Aging Report
A custom ALV report that lists inspection lots without a usage decision, with how many days they have been waiting, whether they exceed the target …
Blocked Stock Left from Rejected Usage Decisions Report
A custom ALV report that lists the quantities rejected at the usage decision and posted to blocked stock that are still sitting in blocked stock, with …
Let us build this program for your system
Briefly describe your system and expectations. We will clarify the scope and come back with an effort and price quote.