This Article will cover How Sap Classification is handled.
It starts with SAP Characteristics and Classes Customizing to get an overview of Classification.
The second part is more technical and covers the Master Data for Classification (ex: AUSP ).The last part explains how to handle Characteristics in ABAP Coding: How to read and Update Characteristics.
You will find a link to ABAP Program Update characteristic value in Sap: how to update the SAP Customer Classification.
Table of Contents
SAP Characteristics Customizing
Let’s start by the SAP Characteristics Customizing.
The main Tcode for Characteristics Customizing in SAP is CT04 and CL02 for Class Customizing.
Step by Step SAP Class & Characteristic Customizing
The path to customize Characteristics is:
- CT04: Customizing of SAP Characteristics
- CL02: Customizing of SAP Classes
You can access the Customizing Tcodes directly from Standard SAP Menu under:
SAP Men > Cross-Application Components > Classification System > Master Data
Fill a new for the new Characteristic. Then Choose the Data Type.
Characteristic can have the following type:
- Character Format (fill the numbers of characters) ,
- Currency Format,
- Date Format,
- Numeric Format
- or Time Format.
Choose the Value Assignment: Single Value or Multiple Values
Set the list of SAP Characteristic Values depending on your scenario to :
- a fixed list,
- for check table,
- for function module
- or from Catalog Char.
The list of Value can be found in table CAWN.
SAP Classification: Retrieve and Update
Once the Class and its Characteristics are defined in SAP, let’s move how to assign how to assign SAP Classification to SAP object.
In order to illustrate, we will take some real life sample.
The first example deals about handling Customer Classification in SAP. Moreover, it will explain how to assign Customer Classification in SAP. Then how to retrieve and update SAP Customer Classification’s Characteristics values.
The next example will cover SAP Material Classification.
Customer Classification in SAP
To access Customer classification, go to XD02/3, then to Extra and Classification.
Read SAP Customer Classification
To read Classification, you can use this standard BAPI BAPI_OBJCL_GETDETAIL.
The class type and the class number can be read from the XD02/3 classification screen:
Update SAP Classification Characteristic
Classification Update can be managed by the standard bapi BAPI_OBJCL_CHANGE.
Don’t forget to call a BAPI_TRANSACTION_COMMIT after the update.
Material classification in SAP
Material Classification in SAP is the same process and access path for Vendor Classification in SAP.
SAP Material Characteristics Table in sap
In order to retrieve Sap Material classification, make a join between MARA-MATNR and AUSP-OBJEK.
SAP Classification Tables
Main SAP Classification Tables & Fields
The most importing SAP classification Tables are
- AUSP: this table saves the value of characteristic for a single business object ( Customer, material … ).
- The AUSP-OBJEK refers to business object key
- for example Customer ID in table KNA1-KUNNR
- or Material Number from MARA-MATNR).
- The value of the Characteristic can be found in AUSP-ATWRT ( neutral value).
- The AUSP-OBJEK refers to business object key
- CABN: This Table contains the property of the Characteristic. It pilots the type, description … of the characteristic.
- KLAH: The Class of Characteristic are kind of grouping/set of Characteristics.
When working in ABAP Code with Characteristic, the most important fields to help out extract classification values:
|AUSP-OBJEK||key of object for Characteristic ( Material and Customer and … )|
|AUSP-ATWRT||Value of Characteristic|
|CABNT-ATBEZ||Description of Characteristic|
List of related SAP Classification Tables
Find the relevant list for SAP Classification Tables with more information.
The List of Important SAP Classification Tables is:
|KLAH||Class Header Data|
|KLAT||Classes: Long texts|
|KLAH||Class Header Data|
|KLAT||Classes: Long Texts|
|KSML||Characteristics of a Class|
|KSSK||Allocation Table: Object to Class|
|CABNZ||Links between Table Fields and Characteristics|
SAP Classification Query
Useless to try an SQVI for Classification. Actually the AUSP-OBJEK has hardly the same kind and length as the MARA-MATNR or KNA1-KUNNR.
A new view between AUSP and KNA1 or MARA can solved the problem.
To make your life easier, here the join to do in order to retrieve Characteristic data in any ABAP Code.
Join between CABN, AUST and KNA1 can be :
- AUSP-ATINN = CABN-ATINN
- CABNT-ATINN = CABN-ATINN
- KNA1-KUNNR = AUSP-OBJEK
SAP Characteristics Tables and Fields
Characteristic Descriptions can be found at table CABN / CABNT in the field CABNT-ATBEZ
Characteristic Values can be found at table AUSP
in the field AUSP-ATWRT for Characteristic Value and AUSP-ATFLV for Data Values.
The field AUSP-OBJEK is Key of Object for Characteristic ( Material, Customer, … )
Sample SAP Customer Classification Update code
Here a Sample ABAP Program to maintain customer classification in sap.
Please check this link for a sample code to create or update a characteristic.
Recently a colleague encountered the following problem:
His customer tracks perishable products that are bought / inventory managed / sold using the SAP functionality Batch Management (LO-BM). The products have a shelf life and therefore a “Use by/Expiration” date. His problem was that he was able to correctly update the characteristic “Expiration date” of the batch, but was not able to select batches during the delivery stage, based on the “Expiration date” – i.e batches that were still fit for use.
So here is a tutorial on how to select batches during the delivery (but it could be applied to any batch search requirement) for which the shelf life has not expired. It has to be noted that SAP covers all kinds of scenario.
– It might be company practice to ship out the door products with a minimum shelf life of X days
– It might be that a specific customer requires a product with a different, longer minimum remaining shelf life
– It might also be that products that are shipped to a specific country require a yet again different minimum shelf life
It might be that you require all three or a logical combination of all three. SAP will easily cover all those requirements and more.
This tutorial only covers the batch determination process in SD, but once you get the jist of it you should be able to apply this to any other module where that function is covered. I also assume that you have set up your system in such way that you are able to have products batch managed.
Step 1 – Standard SAP characteristics you will import
The first thing you need to do is to check that your SAP client has all the required SAP standard characteristics. To do this go to transaction CT04 and query your system to find all characteristics that are called LOBM*.
If a list of values such as the one below is returned then it means that you are all set to go to Step 2 – Create and assign Batch class to products.
If not it means that you need to copy them from client 000. To do that go to customizing and follow the path indicated: Customizing / Logistics – General / Batch Management / Batch Valuation / Updates Standard Characteristics (or transaction BMSM)
The following messages will be displayed if everything goes well.
Once that is done you might want to go back to transaction CT04 and query for characteristics called LOBM*.
Why do I need to do that do you ask? Well for one thing all the work is done for you. Secondly and more importantly the standard SAP functions that will enable us to dynamically calculate the “Expiration date” based on minimum remaining shelf life, makes use of these standard characteristics – they are hard coded in the ABAP functions.
Moving on to step 2 and getting your basic data right.
Step 2 – Create and assign Batch class to products you will do
In our case we have one product, to which we have assigned one class (of technical type 023 – batches). This class has been conveniently called “EXPIRATION” and contains only one characteristic. That characteristic is one of the standard SAP ones called “LOBM_VFDAT – Expiration date, shelf life”. The system has been set up in such a way that when ever I do a goods receipt on this product, SAP will ask me to input the production date and then based on the shelf life of the product, automatically calculate the expiration date of my batch.
This will update a standard SAP table field (MCHA-VFDAT / MCH1-VFDAT – depending on the validity of your batch across plants). This will in turn update the value of the characteristics LOBM-VFDAT within the batch .
So if we look at the shelf life list report (transaction MB5M) we see that this information concurs with that contained in the classification of our batches.
Step 3 – Create a Batch search class you will do
This is a class that will be used to search and find applicable batches during batch determination. It is not directly assigned to the product – it will be assigned to the batch search strategy of the product.
The question is, what characteristics should we put in this class?
If we go back to basics, what we will want to do, is find batches that have a remaining shelf life of X days. If we view this requirement in a different way, we can say that we will want to find batches that have an expiry date that is equal or greater to “delivery date + X days” . My class will therefore use the following characteristics:
– LOBM-VFDAT : The expiration date of the batch – that value SAP will calculate.
– LOBM-LFDAT : The delivery date – that value will be automatically updated by SAP with the delivery date from the delivery
All we need is a characteristic where we will be able to input the value corresponding to X (minimum remaining shelf life required). Again, we do not need to do anything, SAP provides the characteristic “LOBM_RLZ – Remaining Shelf Life for Batch”, to do just that. We therefore have a class (also of technical type 023 – batches) that looks like this.
Step 4 – Create a sort rule you will do
It’s all good to build a batch search class to find batches, but assuming SAP finds numerous batches, how should they be sorted (i.e which should be the first one used?) ? By batch number? Of course not, we want to sort batches based on the expiration date in ascending order (the batches with the date closest to the present should be the first to go).
To do this, call transaction CU70.
Give your sort sequence a name and in the following screen, give it a description as well.
Then click on the characteristics button and assign the characteristic LOBM-VFDAT to it. Also select/amend the sort order that you want.
Save your sort key.
Step 5 – Create a batch search strategy you will do
We want to create a search strategy during delivery processing, i.e in SD – Sales and distribution. So call transaction VCH1 – to create it. We’ll create a strategy determined based on the customer and the material (standard strategy type SD01 caters for that).
Enter your customer and product (amend the strategy as required).
Click on the “selection Criteria” button to assign the search class. In this case we indicated our search class, which copied across the characteristics associated with it.
We also indicate the value “>=30” in the characteristic “Remaining Shelf Life for Batch” – this means that we will only want to select batches that have an expiration date that is greater or equal to delivery date + 30 days.
Now go back to the previous screen and now click on the “sort” button. There you will assign the sort rule you created in the previous step.
Save your work.
Step 6 – Putting it into practice – the fruit of your efforts you will see
Now that we have created all the required basic data, let’s see how it all hangs together.
We have a sales order for which we create a delivery – batch search will be triggered manually to better follow the process.
In the delivery, we go to the batch determination screen and we see that the system has automatically searched, found and proposed batches that have a remaining shelf life that is greater or equal to 30 days only and it has sorted them according to expiration date – just what we wanted.
The system here proposes 3 batches (yet remember that above, it did indicate that we had 5 batches in the system). To get a better idea of what parameters were calculated/used to determine those three batches, click on the “selection criteria button”.
We see the >=30 that we typed in the batch search strategy. We also see that the system took the delivery date “08.09.2008” added 30 days to it and determined that the batch it was going to search for had to have an expiration date greater or equal to 08.10.2008.
We can also change the search parameters here (this is customizable). We’ll change the value of 30 to 4 right there in the batch determination.
This shows even more batches – logical as we have indicated that batches should only have a remaining shelf life of 4 days or more.