# SAP Classification Values ABAP Generator: Read Material Characteristics Through INOB, AUSP and CABN

> Source: https://netray.co/tools/sap-classification-values-abap-generator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Enter a material and a class type and get an ABAP snippet that resolves the internal object number and lists every assigned characteristic and value.

## Category

sap

## Erp

SAP S/4HANA

## Audience

- ABAP developer
- SAP VC consultant
- Data migration lead

## Tool

**Kind:** template

**Output:** code

**Language:** abap

**Fields:**

#### Material number

**Key:** material

**Type:** text

**Default:** CONF-PUMP-100

**Help:** As stored in MARA. Convert with the MATN1 exit if your material numbers are numeric.

#### Class type (KLART)

**Key:** class_type

**Type:** select

**Options:**

- 001
- 300
- 023
- 017

**Default:** 300

**Help:** 001 material class, 300 variants, 023 batch, 017 document.

#### Report name

**Key:** report_name

**Type:** text

**Default:** ZVC_CLASS_VALUES

**Blocks:**

#### Report

**Body:** REPORT {{report_name}}.

* 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 = '{{material}}'.

SELECT SINGLE cuobj
  FROM inob
  INTO @lv_cuobj
  WHERE klart = '{{class_type}}'
    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

**Body:** 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 = '{{class_type}}'
    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

**Body:** * If you prefer a released API over table reads, test BAPI_OBJCL_GETDETAIL
* with objectkey = '{{material}}', objecttable = 'MARA',
* classnum = <your class>, classtype = '{{class_type}}'.
* It returns allocated values in tables ALLOCVALUESCHAR,
* ALLOCVALUESNUM and ALLOCVALUESCURR.

**Notes:** 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.

## Content

**Intro:** 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.

**Sections:**

#### How to use the generator

**Body:** 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

**Body:** 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.

**Bullets:**

- INOB: material to internal number
- AUSP: values for that internal number
- CABN: characteristic names
- KLART and MAFID narrow the result

#### Mistakes to avoid

**Body:** 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.

**Cta:** 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.

**Faq:**

#### Why does the report find nothing for my material?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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.

## Search terms

sap abap read classification values, abap inob ausp select, sap read characteristic values abap, abap bapi_objcl_getdetail alternative, sap material classification abap code, sap ausp cabn join, sap class type 001 abap, sap characteristic value report

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
