SAP WM Bin Stock LQUA ABAP Report Generator
LQUA is the table behind most WM stock reports. This generator produces two ABAP queries: a list of aged quants in one storage type, and a summary that counts quants per bin so you can spot mixed bins.
Fill in
Quant detail with stock age
DATA: lv_cutoff TYPE sy-datum.
TYPES: BEGIN OF ty_quant,
lgnum TYPE lqua-lgnum,
lgtyp TYPE lqua-lgtyp,
lgpla TYPE lqua-lgpla,
matnr TYPE lqua-matnr,
werks TYPE lqua-werks,
lgort TYPE lqua-lgort,
charg TYPE lqua-charg,
verme TYPE lqua-verme,
meins TYPE lqua-meins,
wdatu TYPE lqua-wdatu,
END OF ty_quant.
DATA lt_quant TYPE STANDARD TABLE OF ty_quant.
lv_cutoff = sy-datum - 180.
SELECT lgnum lgtyp lgpla matnr werks lgort charg verme meins wdatu
FROM lqua
INTO CORRESPONDING FIELDS OF TABLE lt_quant
UP TO 10000 ROWS
WHERE lgnum = '100'
AND lgtyp = '001'
AND werks = '1000'
AND wdatu <= lv_cutoff
ORDER BY wdatu.Quants per bin summary
TYPES: BEGIN OF ty_bin_sum,
lgpla TYPE lqua-lgpla,
quants TYPE i,
qty TYPE lqua-verme,
END OF ty_bin_sum.
DATA lt_bin_sum TYPE STANDARD TABLE OF ty_bin_sum.
SELECT lgpla
COUNT( * ) AS quants
SUM( verme ) AS qty
FROM lqua
INTO CORRESPONDING FIELDS OF TABLE lt_bin_sum
WHERE lgnum = '100'
AND lgtyp = '001'
GROUP BY lgpla
HAVING COUNT( * ) > 1.Notes
* VERME is the available quantity in the quant. GESME is the total including stock in movement. * WDATU is the goods receipt date of the quant, used here as stock age. * Bins with more than one quant are mixed stock or multi batch bins, which is useful for checking bin type rules.
Mixed old and new open SQL styles depend on the ABAP release; this code uses classic syntax that works broadly. Verify field names in SE11 for LQUA. On large warehouses the LQUA table can be very big, so always keep the warehouse number and storage type in the WHERE clause.
Aged stock questions answered from SAP
Optional: see how a read-only assistant answers aged stock and mixed bin questions from your WM data.
Optional. The tool and every export work without this. No spam.
How to use the generator
Enter the warehouse number, storage type, plant and the stock age threshold in days. Copy the first block into a report to list quants older than the threshold. Use the second block when you want to find bins holding more than one quant. Paste the output into SE38 or into a class method, adapt the display to ALV, and run it in a test system first.
Understanding the quant fields
A quant is the smallest unit of stock in WM: one material, one batch, one special stock indicator in one bin. VERME is the quantity available for movement, while GESME is the total quantity including stock that is being moved. WDATU is the date of the goods receipt, and in FIFO strategies it drives which stock is removed first. If your aged stock list is long, check whether the FIFO strategy is active in the storage type.
- VERME: available quantity
- GESME: total quantity in the quant
- WDATU: goods receipt date
- BESTQ: stock category such as quality inspection or blocked
Common mistakes
People often sum quant quantities without checking the unit of measure. Quants are stored in the base unit of measure of the material, so mixing materials in a total is meaningless. Another mistake is comparing LQUA totals directly with MARD without allowing for stock in interim storage types and for special stock, which explains many small differences between WM and inventory management.
Frequently Asked Questions
What is the difference between VERME and GESME?
VERME is the quantity available in the quant. GESME is the total quantity, including stock that is already committed to pending removal or being moved. For stock availability use VERME.
How do I find mixed bins?
Use the second block, which groups quants by bin and counts them. Bins with more than one quant may hold different materials or batches. Compare against the bin type or storage type rules to see whether mixed storage is allowed.
Does the code handle special stock?
It selects all quants including special stock. Add a filter on the special stock indicator SOBKZ if you only want regular stock. Remember to include the special stock number in any output where it matters.
Can I use the same logic for EWM?
No. EWM stores quants in its own tables and uses different field names, and access is normally through the warehouse monitor or EWM APIs. Use the EWM table reference to see the equivalents.
If warehouse supervisors keep asking you for new stock cuts, Netray can set up a read-only assistant over your SAP data that answers these questions without writing new reports.
Related Tools
SAP WM Open Transfer Order ABAP SELECT Generator
Fill in the warehouse number, storage types and age and get a ready ABAP report for unconfirmed transfer orders.
SAPSAP WM and EWM Warehouse Tables Reference
A searchable list of the classic WM and EWM tables you query most, with a plain description and typical key fields.
SAPSAP WM and EWM Transaction Codes Reference
Look up the transaction code you need for transfer orders, bins, stock reports, physical inventory and the EWM monitor.
SAPSAP WM to EWM Terminology Map
See what each classic WM object is called in EWM and what changes in behaviour, in one searchable table.
More SAP tools
See all- SAP Sales Document Types Reference
- SAP Pricing Procedure Design Worksheet
- SAP Item Category Determination Reference
- SAP Delivery Block Reasons Template
- SAP Credit Management Checklist
- SAP Output Determination Checklist
- SAP Billing Types Reference
- SAP Incompletion Log Checklist
- SAP SD Tables Reference (VBAK, VBAP, LIKP, VBRK and More)