QM Program Custom development Background program

Mass Usage Decision for Inspection Lots That Passed All Characteristics

Short answer: A custom background program that sets the usage decision with a chosen code for inspection lots whose characteristics were all accepted and that have no open quality notification, and posts the quality stock to unrestricted stock. Quality teams deal only with problem lots, and clean lots do not wait in stock.

Estimated effort
M · 4–6 working days
System
ECC and S/4HANA
Tables
5
Scope
Global
Built by
NeKuDos Teknoloji
Last updated

Why is the standard not enough?

QA11 makes the usage decision for one lot. QA16 offers a collective decision for accepted lots, but it is a dialog and does not apply company-specific checks (open notification, minimum waiting time, selected inspection types). The automatic usage decision setting in the inspection type works with a single code per inspection type and does not report which lot was skipped and why.

Who uses it? Quality control supervisors, laboratory teams, and warehouse and production planners who need quality stock released quickly.

Closest standard alternatives

  • QA11 Record Usage Decision. Makes the usage decision for one lot.
  • QA16 Collective Usage Decision for Accepted Lots. Offers a collective decision for accepted lots; it is a dialog and does not apply company-specific checks.

Tables used

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

TableRoleAccessSystem
QALSInspection Lot RecordCandidate inspection lots and quantity to be postedReadECC + S/4
QAMVCharacteristic Specifications for Inspection ProcessingCharacteristics of the lotReadECC + S/4
QAMRCharacteristic Results During Inspection ProcessingCharacteristic valuation; all must be acceptedReadECC + S/4
QMELNotification HeaderOpen quality notification linked to the lot (check)ReadECC + S/4
QAVEUsage DecisionUsage decision that is setWriteECC + S/4

BAPIs and functions used

  • BAPI_INSPLOT_GETSTATUSRead Inspection Lot Status. Checks the lot status and that results recording is complete
  • BAPI_INSPLOT_SETUSAGEDECISIONSet Usage Decision. Sets the usage decision and posts the quality stock
  • BAPI_TRANSACTION_COMMITCommit a BAPI transaction. Saves the decision permanently

Selection screen parameters

ParameterDescriptionTypeReference fieldRequiredExample
S_WERKPlantRange / multipleQALS-WERKYes1000
S_ARTInspection typeRange / multipleQALS-ARTYes04
S_HERKLot originRange / multipleQALS-HERKUNFTNo04
S_MATNRMaterialRange / multipleQALS-MATNRNoFG-2050
P_CODGRPUsage decision code groupSingle valueQAVE-VCODEGRPYesUD01
P_VCODEUsage decision codeSingle valueQAVE-VCODEYesA1
P_MINAGEMinimum days since lot creationSingle value—No0
P_NOTIFSkip lots with an open quality notificationCheckbox—NoX
P_TESTTest mode (list without deciding)Checkbox—NoX

Result list columns

#ColumnSource
1Inspection lotQALS-PRUEFLOS
2MaterialQALS-MATNR
3BatchQALS-CHARG
4Posted to unrestrictedQALS-LMENGEZUB
5UnitQALS-MENGENEINH
6Decision codeQAVE-VCODE
7StatusCalculated Decided, eligible (test) or skipped
8MessageCalculated Reason for skipping or the BAPI return message

Sample result list

Inspection lotMaterialBatchPosted to unrestrictedUnitDecision codeStatusMessage
040000001877FG-2050P2611-151,200KGA1DecidedUsage decision saved, 1,200 KG posted to unrestricted stock
040000001880FG-2051P2611-16800KGSkippedCharacteristic 0040 is open
040000001884FG-1002P2611-170PCSkippedOpen quality notification exists: 300001275
A view built with fictional sample data; not real system data.

How does the program work?

  1. Lots without a usage decision (QALS-STAT35 blank) and created at least the set number of days ago are read from QALS with the plant, inspection type, lot origin and material from the selection screen.
  2. BAPI_INSPLOT_GETSTATUS checks that results recording is complete. Every characteristic in QAMV must have an accepting valuation in QAMR (MBEWERTG = A); lots with open or rejected characteristics are skipped.
  3. If selected, lots with an open quality notification linked to the lot (QMEL-PRUEFLOS) are skipped.
  4. BAPI_INSPLOT_SETUSAGEDECISION is called with the code group and code from the selection screen; the quantity still to be posted (LMENGEZUB) is posted to unrestricted stock.
  5. In test mode only the eligible lots are listed; in a real run BAPI_TRANSACTION_COMMIT follows each lot. Decided and skipped lots are logged with their reasons and a summary is sent by email.

Performance notes

Schedule the program as a background job that runs hourly or at the end of each shift. Read QAMV and QAMR once with the list of candidate lots; committing per lot isolates locked lots.

Features

  • Test mode (check without posting)
  • Line-by-line result and error log
  • Runs as a background job
  • Send the result by email After each run, a summary of decided and skipped lots is sent to the quality supervisor.

Authorization objects

  • Q_INSPTYPEInspection lot authorization by inspection type
  • Q_GP_CODEAuthorization for the usage decision code group
  • M_MSEG_WMBMaterial document authorization by plant for the stock posting

Frequently asked questions

Which lots get a decision?

Only lots whose characteristics are all valuated as accepted, whose results recording is complete and, if selected, that have no open quality notification. All other lots are skipped and the reason is logged.

Can stock be posted to a stock type other than unrestricted?

Yes. A target stock type (e.g. keep in quality stock, blocked stock) can be added to the selection screen, or the target can be set per inspection type.

Can this program be used on S/4HANA?

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

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: Mass Usage Decision for Inspection Lots That Passed All Characteristics