WM Program Custom development Enhancement

EWM–QM Integration: Rule-Based Inspection Lots and Automatic Stock Routing After the Usage Decision

Short answer: An EWM enhancement that decides with company rules when an inspection lot is opened for incoming material and, after the usage decision, routes the stock automatically to unrestricted, blocked or the returns area. Inspection documents are created automatically, the follow-up action is chosen from the decision code and the required warehouse tasks are created on their own.

Estimated effort
L · 15–22 working days
System
ECC and S/4HANA
Tables
9
Scope
Global
Built by
NeKuDos Teknoloji
Last updated

Why is the standard not enough?

Standard EWM–QM integration determines inspection rules with fixed criteria such as material, inspection type and document type; rules like the supplier's quality history, first delivery, specific batch properties or company-specific exemptions need BAdIs. The logistics follow-up actions after the usage decision are also tied to the decision code in a fixed way; splitting stock for partial decisions, moving conditional acceptances to a separate area and an automatic task to the returns area cannot be set up as standard. This enhancement keeps the rules in one maintenance table and applies them through standard BAdIs.

Who uses it? Incoming quality inspection teams, warehouse supervisors, purchasing, quality assurance managers.

Closest standard alternatives

  • QA11 Record Usage Decision. Records the usage decision; the follow-up action is tied to the decision code in a fixed way.
  • QA32 Change Data for Inspection Lot. Lists and processes inspection lots; does not decide whether a lot is opened.
  • /SCWM/POST Posting Change. Changes the stock type manually; no automatic routing based on the usage decision.

Tables used

The tables the program reads and updates. ECC and S/4HANA differences are marked separately.

TableRoleAccessSystem
/SCDL/DB_PROCH_IEWM Inbound Delivery HeaderEWM inbound delivery headerReadECC + S/4
/SCDL/DB_PROCI_IEWM Inbound Delivery ItemEWM inbound delivery items: product, batch, quantityReadECC + S/4
QMATInspection Type - Material ParametersActive inspection types of the materialReadECC + S/4
QALSInspection Lot RecordInspection lot: material, batch, supplier, lot quantityRead / writeECC + S/4
QAVEUsage DecisionUsage decision and decision codeReadECC + S/4
LFA1Vendor Master (General Section)Supplier name (rule and monitor)ReadECC + S/4
/SCWM/AQUAEWM Available QuantityQuality stock and stock type after the follow-up actionReadECC + S/4
/SCWM/HUHDREWM Handling Unit HeaderInspected handling unitReadECC + S/4
/SCWM/ORDIM_OEWM Open Warehouse TasksPutaway or returns area task created by the follow-up actionWriteECC + S/4

BAPIs and functions used

  • BAPI_INSPLOT_GETDETAILRead Inspection Lot Details and Usage Decision. Reads status and decision data of the inspection lot
  • SO_NEW_DOCUMENT_ATT_SEND_API1SAPoffice: Send New Document with Attachments. Sends an email to purchasing and quality on rejection

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
P_LGNUMWarehouse numberSingle value/SCWM/LAGP-LGNUMYesW100
S_WERKPlantRange / multipleQALS-WERKYes1000
S_MATNRMaterialRange / multipleQALS-MATNRNoHM-1001
S_LIFNRSupplierRange / multipleQALS-LIFNRNo300045
P_OPENOnly items with incomplete follow-upCheckbox—NoX

Result list columns

#ColumnSource
1Inspection lotQALS-PRUEFLOS
2MaterialQALS-MATNR
3BatchQALS-CHARG
4SupplierQALS-LIFNR
5Supplier nameLFA1-NAME1
6Lot quantityQALS-LOSMENGE
7Applied ruleCalculated Matching row in the rule table: inspection required, sample or no inspection
8Decision codeQAVE-VCODE
9Follow-up actionCalculated Action chosen from the decision code: unrestricted, blocked + returns area, conditional acceptance area
10Destination bin/SCWM/ORDIM_O-NLPLA
11Warehouse task/SCWM/ORDIM_O-TANUM
12StatusCalculated Awaiting decision, follow-up complete or error

Sample result list

Inspection lotMaterialBatchSupplierSupplier nameLot quantityApplied ruleDecision codeFollow-up actionDestination binWarehouse taskStatus
010000004512HM-1001B2611-04300045Örnek Ambalaj A.Ş.2,400Inspection required (first delivery)A1Unrestricted + normal putawayA-02-01-05000000081245Complete
010000004513YM-2040B2611-07300112Demo Kağıt Ltd.800Sample onlyR1Blocked + returns areaIADE-01000000081251Complete, email sent
010000004517AM-3315B2611-09300045Örnek Ambalaj A.Ş.120Inspection required (shelf life)Awaiting decision
010000004520HM-1008B2611-12300207Deneme Kimya San.1,500Inspection requiredA2Conditional acceptance areaError: no empty bin in destination storage type
A view built with fictional sample data; not real system data.

How does the program work?

  1. A rule table holds the decision ‘inspection required’, ’no inspection’ or ‘sample only’ per plant, material or material group, supplier, first delivery, remaining shelf life and delivery type. The quality team can maintain the rules; changes are tracked with history.
  2. When an inbound delivery arrives in EWM (/SCDL/DB_PROCH_I, /SCDL/DB_PROCI_I), the /SCWM/EX_QM_INSP_RELEVANCE BAdI applies the rule table. For items that need no inspection, no inspection document is opened; for items that do, and if the inspection type is active for the material (QMAT), the QM inspection lot (QALS) in S/4HANA and the EWM inspection document are created automatically.
  3. For rules that require a sample, the sample quantity is rounded to the packaging unit with /SCWM/EX_QM_SAMPLE_ROUND_QTY. Stock waiting for inspection is put away as quality stock to the quality waiting area.
  4. When the usage decision is made (QA11 or Fiori), the /SCWM/EX_QFU_SET_FUCODE BAdI chooses the logistics follow-up action from the decision code in QAVE: on acceptance, change to unrestricted stock and normal putaway; on rejection, blocked stock and a task to the returns area; on conditional acceptance, unrestricted stock but putaway to a separate storage type. For partial decisions the quantity is split by the decision lines.
  5. The stock type change and the required warehouse tasks (/SCWM/ORDIM_O) are created automatically with the /SCWM/EX_QFU_STOCK_ACTION BAdI. On rejection, the buyer and the quality owner receive an email with batch, quantity and decision code.
  6. A monitor shows open inspection lots, decisions made, follow-up actions created and tasks in one screen; items whose follow-up action failed can be reprocessed.

Performance notes

Because the inspection relevance decision runs while the delivery is saved, cache the rule table on first read and avoid database reads per item. Create follow-up actions in the step that runs after the decision is saved, not inside the usage decision itself.

Features

  • Line-by-line result and error log Every rule decision and follow-up action is logged with the inspection lot.
  • Send the result by email Rejections notify purchasing and quality.
  • Double-click drill-down to the document The inspection lot, delivery and warehouse task can be opened from the monitor.

Authorization objects

  • Q_INSPLOTInspection lot processing authorization
  • Q_UD_CODEUsage decision code authorization
  • /SCWM/QFUPLogistics follow-up action authorization
  • /SCWM/QDOCEWM inspection document authorization

Frequently asked questions

Does the enhancement need to be rebuilt when the rules change?

No. Inspection relevance and follow-up actions are kept in a maintenance table; the quality team can add rows for a new supplier, material group or decision code. Only adding a new kind of criterion (e.g. a new batch property) needs development.

How is partial acceptance handled?

When the usage decision splits quantities across stock types, each decision line gets its own follow-up action: the accepted quantity goes to unrestricted stock and the rejected quantity to blocked stock and the returns area.

Can it be used with ECC?

The enhancement is written for the integration of EWM with QM inspection lots in S/4HANA. With EWM running separately next to ECC the inspection objects differ, so the rules have to be adapted separately.

Related reports

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.

Related report: EWM–QM Integration: Rule-Based Inspection Lots and Automatic Stock Routing After the Usage Decision