Comprehensive Guide to Classification Tables in SAP

Comprehensive Guide to Classification Tables in SAP

SAP’s classification system is a powerful tool that allows you to group and categorize objects such as materials, customers, or batches according to specific characteristics. Understanding the key tables involved in SAP’s classification system is essential for managing and retrieving classification data efficiently. This blog post will explore the critical classification tables in SAP and provide an example SQL query to help you extract relevant information.

Key Classification Tables in SAP: An Overview

  • TCLA (Class Types): Defines the types of objects that can be classified. For example, type 002 is for equipment, while type 023 is for materials and batches. If a type covers multiple objects, see the TCLAO table for more details.
  • KLAH (Class Headers): Contains header information for each class, including the internal class number (CLINT) and class name (CLASS). Crucial for linking objects to their classes.
  • CABN and CABNT (Characteristics):
    • CABN: Stores technical details of characteristics, including internal characteristic numbers (ATINN).
    • CABNT: Holds descriptions for these characteristics, useful for reporting.
  • CAWN and CAWNT (Characteristic Values):
    • CAWN: Contains allowed values for characteristics.
    • CAWNT: Provides descriptions for these values, useful for validation and display.

Detailed Tables for Classification and Characteristics in SAP

  • KSML (Characteristic Assignment to Classes): Links characteristics to classes and lists their positions within each class.
  • INOB (Internal Numbers and Object Links): Maps internal class numbers to classified objects, particularly useful for class types covering multiple object types.
  • KSSK (Object Assignments to Classes): Connects objects (e.g., materials) to classes, allowing you to see which classes are assigned to a specific object.
  • AUSP (Characteristic Values for Objects): Stores the actual characteristic values assigned to objects, providing detailed classification data.
  • TCLAO (Multiple Objects per Class Type): Holds specific object types and details for class types that classify multiple objects, overriding TCLA settings when necessary.
  • CAWNT (Characteristic Value Texts): Provides language-specific texts for characteristic values in CAWN, aiding in user comprehension.

Example SQL Query

To extract classification data for a specific material, you might want to join several of the tables mentioned above. Here’s an example SQL query that retrieves the class name and characteristic values for a given material:

SELECT 
    KLAH.CLASS AS Class_Name,
    CABN.ATNAM AS Characteristic_Name,
    AUSP.ATWRT AS Characteristic_Value
FROM 
    KSSK 
JOIN 
    KLAH ON KSSK.CLINT = KLAH.CLINT
JOIN 
    KSML ON KLAH.CLINT = KSML.CLINT
JOIN 
    CABN ON KSML.IMERK = CABN.ATINN
JOIN 
    AUSP ON AUSP.ATINN = CABN.ATINN AND AUSP.OBJEK = KSSK.OBJEK
WHERE 
    KSSK.OBJEK = 'Your_Material_Number'
    AND KLAH.CLASS = 'Your_Class_Type';

This query retrieves the class name and corresponding characteristic values for a specific material. Replace 'Your_Material_Number' and 'Your_Class_Type' with the relevant material number and class type.

Classification tab of the Material Master (transaction MM03)

To retrieve the “Class” specified in the Classification tab of the Material Master (transaction MM03), along with the Material Number (MATNR), you need to use a combination of SAP tables. Here’s how you can obtain this information:

Relevant Tables:

  1. KLAH (Class Header Data): This table contains the class information. The key fields here include KLART (Class Type) and CLASS (Class Number).
  2. KSSK (Object Assignment Table): This table links the material (or any object) to its class. It includes fields such as OBJEK (which holds the material number, MATNR), CLINT (internal class number), and the CLASS from the KLAH table.

SQL Query Example:

To retrieve the class assigned to a specific material, you can use the following SQL query:

SELECT 
    MARA.MATNR AS Material_Number,
    KLAH.CLASS AS Class_Number,
    KLAH.KLART AS Class_Type
FROM 
    KSSK 
JOIN 
    KLAH ON KSSK.CLINT = KLAH.CLINT
JOIN 
    MARA ON KSSK.OBJEK = MARA.MATNR
WHERE 
    MARA.MATNR = 'Your_Material_Number'
    AND KLAH.KLART = 'Your_Class_Type';

Explanation:

  • MARA.MATNR: This is the Material Number from the material master table (MARA).
  • KLAH.CLASS: This is the Class Number from the class header table (KLAH).
  • KLAH.KLART: This is the Class Type, ensuring that you’re pulling the correct type of classification data.
  • KSSK.OBJEK: This field in the KSSK table links the material number to the class.

Replace 'Your_Material_Number' and 'Your_Class_Type' with the specific material number and class type you are querying.

This query will give you the material number along with the associated class in the classification view of the Material Master.

Checking Classification Data for Multiple Materials in SAP

To determine whether a list of materials has a classification tab in MM03, you can check the KSSK table in SAP. This table stores the assignment of objects (such as materials) to classes, which is what populates the classification tab in the Material Master.

Steps to Check if Materials Have a Classification Tab

  1. Table to Check: Use the KSSK table.
  2. Key Fields:
    • OBJEK: This field stores the material number (with leading zeros if needed).
    • CLINT: This is the internal class number.
    • CLASS: This stores the class number from the classification system.
    • KLART: Class type, which you might want to filter on if you are looking for specific types of classifications.

SQL Query to Check for Classification

You can run the following SQL query to determine if the materials in your list have any classifications:

SELECT 
    KSSK.OBJEK AS Material_Number, 
    KSSK.CLASS AS Class_Number, 
    KSSK.KLART AS Class_Type
FROM 
    KSSK
WHERE 
    KSSK.OBJEK IN ('Material_Number_1', 'Material_Number_2', ..., 'Material_Number_N');

Explanation:

  • Replace 'Material_Number_1', 'Material_Number_2', ..., 'Material_Number_N' with your actual material numbers.
  • The KSSK table will return records for each material that has been assigned to a class, indicating that the material has a classification tab in MM03.

Bulk Check:

If you have a large list of materials, you can upload the list into a temporary table in SAP and join it with the KSSK table to efficiently retrieve the information.

Example for Bulk Check:

SELECT 
    tmp.Material_Number, 
    KSSK.CLASS AS Class_Number, 
    KSSK.KLART AS Class_Type
FROM 
    your_temp_table tmp
LEFT JOIN 
    KSSK ON tmp.Material_Number = KSSK.OBJEK
WHERE 
    KSSK.CLASS IS NOT NULL;

This will give you a list of all materials that have classifications. Materials without classifications will not appear in the result set.

Classification and characteristics of a material in SAP

To view the classification and characteristics of a material in SAP, you can use a combination of the following tables:

  1. KSSK (Object to Class Assignment):
    • Purpose: This table links materials to classes.
    • Key Fields:
      • OBJEK: Object key, which for materials is the material number (MATNR).
      • CLINT: Internal class number.
      • CLASS: Class number.
    • Usage: To find out which classes a material is assigned to, you can query this table using the material number.
  2. AUSP (Characteristic Values):
    • Purpose: Stores characteristic values for an object.
    • Key Fields:
      • OBJEK: Object key (material number).
      • ATINN: Characteristic number.
      • ATWRT: Characteristic value.
    • Usage: After identifying the class in KSSK, you can use the AUSP table to retrieve the characteristics and their values associated with the material.
  3. CABN (Characteristic Details):
    • Purpose: Contains details about characteristics.
    • Key Fields:
      • ATINN: Characteristic number.
      • ATNAM: Characteristic name.
    • Usage: Once you have the characteristic number from AUSP, you can use CABN to find out more details about each characteristic, such as its description and properties.

Example SQL Query:

To retrieve the classification and characteristics for a specific material, you can use the following SQL query:

SELECT 
    KSSK.OBJEK AS Material_Number, 
    KSSK.CLASS AS Class_Number, 
    CABN.ATNAM AS Characteristic_Name, 
    AUSP.ATWRT AS Characteristic_Value
FROM 
    KSSK 
JOIN 
    AUSP ON KSSK.OBJEK = AUSP.OBJEK 
JOIN 
    CABN ON AUSP.ATINN = CABN.ATINN
WHERE 
    KSSK.OBJEK = 'Your_Material_Number';

Explanation:

  • KSSK: Used to identify which classes the material is assigned to.
  • AUSP: Fetches the characteristics and their values for the material.
  • CABN: Retrieves the descriptive details of each characteristic.

Replace 'Your_Material_Number' with the actual material number you’re querying.

These tables together allow you to extract all classification and characteristic data for a material in SAP.

Learn about usage of controlling area currency in SAP

Take a look at SAP Fico Tables

Similar Posts