SAP Classification Values ABAP Generator: Read Material Characteristics Through INOB, AUSP and CABN
Reading a material's characteristic values in ABAP takes two hops: find the internal object number in INOB, then read AUSP and join CABN for the characteristic names. This generator writes the code with your material and class type filled in.
Fill in
As stored in MARA. Convert with the MATN1 exit if your material numbers are numeric.
001 material class, 300 variants, 023 batch, 017 document.
Report
REPORT ZVC_CLASS_VALUES.
* Reads classification values for one material.
* Path: INOB (object link) -> AUSP (values) -> CABN (names).
DATA: lv_objek TYPE inob-objek,
lv_cuobj TYPE inob-cuobj,
lv_ausp TYPE ausp-objek.
lv_objek = 'CONF-PUMP-100'.
SELECT SINGLE cuobj
FROM inob
INTO @lv_cuobj
WHERE klart = '300'
AND obtab = 'MARA'
AND objek = @lv_objek.
IF sy-subrc <> 0.
WRITE: / 'No classification found for', lv_objek.
RETURN.
ENDIF.
lv_ausp = lv_cuobj.Read the values
SELECT a~atinn, c~atnam, a~atwrt, a~atflv
FROM ausp AS a
INNER JOIN cabn AS c
ON c~atinn = a~atinn
AND c~adzhl = '0000'
INTO TABLE @DATA(lt_values)
WHERE a~objek = @lv_ausp
AND a~klart = '300'
AND a~mafid = 'O'
ORDER BY c~atnam.
IF lt_values IS INITIAL.
WRITE: / 'No characteristic values assigned.'.
RETURN.
ENDIF.
LOOP AT lt_values INTO DATA(ls_value).
IF ls_value-atwrt IS NOT INITIAL.
WRITE: / ls_value-atnam, ls_value-atwrt.
ELSE.
WRITE: / ls_value-atnam, ls_value-atflv.
ENDIF.
ENDLOOP.Alternative with a standard function module
* If you prefer a released API over table reads, test BAPI_OBJCL_GETDETAIL * with objectkey = 'CONF-PUMP-100', objecttable = 'MARA', * classnum = <your class>, classtype = '300'. * It returns allocated values in tables ALLOCVALUESCHAR, * ALLOCVALUESNUM and ALLOCVALUESCURR.
Verify on your release: the exact format of INOB-OBJEK for materials (padding and conversion), whether CABN needs a validity filter in your landscape, and that class type 300 is the type your variant classes use. Direct table reads are fine for reporting; use the BAPI or released APIs for anything that writes data.
Need classification data in a report?
Ask for an expert review of your classification reporting approach and ABAP performance.
Optional. The tool and every export work without this. No spam.
How to use the generator
Enter the material number exactly as stored, choose the class type, and optionally rename the report. The first block resolves the internal number CUOBJ from INOB, the second block reads AUSP joined to CABN and prints each characteristic with its value, and the third block names a released API alternative. Copy the code into SE38 or an ABAP class, activate it, and run it in a development system first. Character values come from ATWRT, numeric values from ATFLV.
Why the two-step read is needed
AUSP does not store the material number. It stores an internal object number that comes from INOB, because many object types can be classified, not just materials. That is why OBTAB = MARA matters in the INOB lookup and why KLART appears twice. Filtering MAFID = O limits AUSP to object-level values rather than class-level ones. The join to CABN supplies the readable ATNAM. If the material has several class types, run the report once per class type.
- INOB: material to internal number
- AUSP: values for that internal number
- CABN: characteristic names
- KLART and MAFID narrow the result
Mistakes to avoid
Do not read AUSP in a loop for thousands of materials; build a single join from INOB instead and read the table once. Do not assume a material number matches INOB-OBJEK without checking padding or the conversion exit. Do not write to these tables directly; use BAPI_OBJCL_CHANGE or the classification API so index tables and change documents stay consistent. For configured sales order items the values are not in AUSP of the material, so this report will not show them.
Frequently Asked Questions
Why does the report find nothing for my material?
Usually the material is not classified in the chosen class type, or the object key has a different format than the value you entered. Check CL20N for the material, try the other class type, and compare the stored INOB-OBJEK value in SE16N.
What is MAFID in AUSP?
MAFID tells whether a row belongs to an object (O) or to a class (K). Reading object values means filtering MAFID to O. Class-level rows describe the class itself and are not the values of a particular material.
Can I use this for customer or batch classification?
The pattern is the same but the object table and class type change. For batches the object is built from material and batch and the class type is typically 023. Adjust OBTAB and the object key to match the object you are reading.
Is it safe to run on production?
The code only reads. Even so, AUSP can be large, so run it first in a quality system and avoid wide selections. Make sure you have the authorizations your security team expects for table reads.
If you need classification data explained in a business-friendly view, Netray can build a read-only assistant over your SAP tables that shows the query behind every answer.
Related Tools
SAP Variant Configuration Tables Reference
A searchable lookup of the database tables behind SAP characteristics, classes, object dependencies, variant tables and BOMs, with key fields and what each one holds.
SAPSAP BOM Where-Used SQL Generator
Fill in a component, plant and BOM usage to get SQL that lists every parent BOM using it, plus a query for BOM items with dependencies.
SAPSAP Variant Configuration Transaction Codes
A searchable list of the SAP transaction codes variant configuration and PLM consultants use daily, grouped by characteristic, class, dependency, BOM, routing and change work.
SAPSAP VC Model Design Review Checklist
A 36-item checklist covering characteristic design, classes, dependencies, super BOM, routing and runtime performance, with critical items flagged.