{"audience":"Quality control supervisors, laboratory teams, and warehouse and production planners who need quality stock released quickly.","authorization_objects":[{"note":"Inspection lot authorization by inspection type","object":"Q_INSPTYPE"},{"note":"Authorization for the usage decision code group","object":"Q_GP_CODE"},{"note":"Material document authorization by plant for the stock posting","object":"M_MSEG_WMB"}],"components":[],"countries":[],"effort_days_max":6,"effort_days_min":4,"effort_size":"M","faq":[{"a":"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.","q":"Which lots get a decision?"},{"a":"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.","q":"Can stock be posted to a stock type other than unrestricted?"},{"a":"Yes. BAPI_INSPLOT_SETUSAGEDECISION is supported on S/4HANA and the QM tables keep the same structure.","q":"Can this program be used on S/4HANA?"}],"features":[{"code":"test_run","label":"Test mode (check without posting)","note":""},{"code":"log","label":"Line-by-line result and error log","note":""},{"code":"background","label":"Runs as a background job","note":""},{"code":"email","label":"Send the result by email","note":"After each run, a summary of decided and skipped lots is sent to the quality supervisor."}],"functions":[{"name":"BAPI_INSPLOT_GETSTATUS","role":"Checks the lot status and that results recording is complete"},{"name":"BAPI_INSPLOT_SETUSAGEDECISION","role":"Sets the usage decision and posts the quality stock"},{"name":"BAPI_TRANSACTION_COMMIT","role":"Saves the decision permanently"}],"gap":"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.","id":"qm-mass-usage-decision","industries":[],"input_columns":[],"kind":"program","language":"en","lastmod":"2026-11-17","logic":"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.\n2. 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.\n3. If selected, lots with an open quality notification linked to the lot (QMEL-PRUEFLOS) are skipped.\n4. 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.\n5. 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.","module":"QM","object_type":"batch_job","output_columns":[{"calculated":false,"formula":"","label":"Inspection lot","source_field":"PRUEFLOS","source_table":"QALS"},{"calculated":false,"formula":"","label":"Material","source_field":"MATNR","source_table":"QALS"},{"calculated":false,"formula":"","label":"Batch","source_field":"CHARG","source_table":"QALS"},{"calculated":false,"formula":"","label":"Posted to unrestricted","source_field":"LMENGEZUB","source_table":"QALS"},{"calculated":false,"formula":"","label":"Unit","source_field":"MENGENEINH","source_table":"QALS"},{"calculated":false,"formula":"","label":"Decision code","source_field":"VCODE","source_table":"QAVE"},{"calculated":true,"formula":"Decided, eligible (test) or skipped","label":"Status","source_field":null,"source_table":null},{"calculated":true,"formula":"Reason for skipping or the BAPI return message","label":"Message","source_field":null,"source_table":null}],"parameters":[{"example":"1000","kind":"select_option","label":"Plant","name":"S_WERK","ref_field":"QALS-WERK","required":true},{"example":"04","kind":"select_option","label":"Inspection type","name":"S_ART","ref_field":"QALS-ART","required":true},{"example":"04","kind":"select_option","label":"Lot origin","name":"S_HERK","ref_field":"QALS-HERKUNFT","required":false},{"example":"FG-2050","kind":"select_option","label":"Material","name":"S_MATNR","ref_field":"QALS-MATNR","required":false},{"example":"UD01","kind":"parameter","label":"Usage decision code group","name":"P_CODGRP","ref_field":"QAVE-VCODEGRP","required":true},{"example":"A1","kind":"parameter","label":"Usage decision code","name":"P_VCODE","ref_field":"QAVE-VCODE","required":true},{"example":"0","kind":"parameter","label":"Minimum days since lot creation","name":"P_MINAGE","ref_field":"","required":false},{"example":"X","kind":"checkbox","label":"Skip lots with an open quality notification","name":"P_NOTIF","ref_field":"","required":false},{"example":"X","kind":"checkbox","label":"Test mode (list without deciding)","name":"P_TEST","ref_field":"","required":false}],"part_of":[],"performance":"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.","process":"INV","quote_url":"https://nekuhub.com/en/request-a-quote/?report=qm-mass-usage-decision","related":["qm-inspection-lots-pending-ud-aging","qm-inspection-results-upload"],"releases":[],"source":"custom","standard_alternatives":[{"note":"Makes the usage decision for one lot.","tcode":"QA11"},{"note":"Offers a collective decision for accepted lots; it is a dialog and does not apply company-specific checks.","tcode":"QA16"}],"summary":"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.","tables":[{"access":"read","join_on":"QALS-STAT35 = ' '","role":"Candidate inspection lots and quantity to be posted","table":"QALS","variant":"both"},{"access":"read","join_on":"QAMV-PRUEFLOS = QALS-PRUEFLOS","role":"Characteristics of the lot","table":"QAMV","variant":"both"},{"access":"read","join_on":"QAMR-PRUEFLOS = QAMV-PRUEFLOS AND QAMR-VORGLFNR = QAMV-VORGLFNR AND QAMR-MERKNR = QAMV-MERKNR","role":"Characteristic valuation; all must be accepted","table":"QAMR","variant":"both"},{"access":"read","join_on":"QMEL-PRUEFLOS = QALS-PRUEFLOS","role":"Open quality notification linked to the lot (check)","table":"QMEL","variant":"both"},{"access":"write","join_on":"QAVE-PRUEFLOS = QALS-PRUEFLOS","role":"Usage decision that is set","table":"QAVE","variant":"both"}],"title":"Mass Usage Decision for Inspection Lots That Passed All Characteristics","url":"https://nekuhub.com/en/programs/mass-usage-decision-for-accepted-inspection-lots-program/","vendor_id":"nekudos"}