Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Determining the Batch Class of a Material

Former Member
0 Kudos

Hello,

I'm trying to programmatically determine the batch class name for a given material. I thought the table to use was KSSK. When I query that table with a material number and class type 023, I get an internal class number. From there I query KLAH with the internal class number expecting to see the class name that is showing on the classification view of the material master, but instead I see a different class name.

Does anyone know what I am doing wrong?

Thanks in advance for any help you can provide.

-Jim Sharkey

8 REPLIES 8

Former Member
0 Kudos

Hi,

Did you check the table: AUSP, as this may be relevant for your requirements.

Regards,

Ashok

Former Member
0 Kudos

Thanks for the quick response, but AUSP only holds the characteristics and there values for a given object. It does not contain any reference to the batch class name or it's associated internal number.

0 Kudos

Hi,

AUSP should be the appropriate table and ATINN is the internal class number field which u need to pass to the table KLAH.KLART is the class type here.

Hope that this should be helpful.

Regards

Zarina

Former Member
0 Kudos

Thanks, but ATINN is the internal CHARACTERISTIC number, not the CLASS number. Characteristics are created independently and can be assigned to multiple classes.

0 Kudos

Hi there

KSSK ===> with classtype 023 (batch) as minimum

SWOR using the internal class number from KSSK.

You might need in the KSSK lookup to also set the Object type to restrict search.

Cheers

Jimbo

Former Member
0 Kudos

Hello Jim,

Were you ever able to find out which table stores a Materials batch class assignment?

I've been querying KSSK with which many articles seem to point to using OBJEK = MATNR (material #) and the only results I get are the materials 'Material Class' assignment. No entries whatsoever for KLART (Class Type) 023.

I'm not sure where I can find this, but the Batch Class assignment (023) entry clearly displays on the Material Masters Classification View (MM03-Classification).

Thanks!

Former Member
0 Kudos

Hi all,

The table that I believe that you are looking for is INOB.

Within INOB, specify 023 for field KLART and MARA for field OBTAB. The field OBJEK with contain your material number.

The field CUOBJ will contain a key that can link back to table KSSK to field OBJEK.

From there, table KSSK contains the link to KLAH to get your class name.

I hope this helps.

br,

Richard

Former Member
0 Kudos

Hi - this is a reply to quite an old post, but I figured out a slightly more elegant way to get what you want, using function modules rather than table lookups (puts the onus slightly more on SAP).  Any hoo - here's what I did:

Use FM CLAF_CLASSIFICATION_OF_OBJECTS but I set the arguments in a slightly odd way... and it worked.

CLASSTYPE = "022" (or "023" in your case)

OBJECT = <18-digit Material Number and that is all - nothing else appended or concatenated>

OBJECTABLE = "MARA"

The FM returns a list of the classes in T_CLASS, and a list of characteristics for those classes in T_OBJECTDATA.  The "tabix" field of a given row in T_OBJECTDATA relates to the class row in T_CLASS.

In this case, I suppose because the the ClassType = 022, it is returning the Batch Class to use for the Material.

Soooo... you can either loop through T_CLASS and find your class name, or if you know a characteristic of the class you could find the characteristic in T_OBJECTDATA and work backwards through "tabix" to get the row in T_CLASS.

--------------------------------

If you set

CLASSTYPE = "022"

OBJECT = <Concatenation of 18-digit Material Number, Plant, Batch Number, etc.>

OBJECTTABLE = "MCHA"

It would return the same data for you... AS LONG AS the Batch has already been classified!  But what if the batch has not yet been classified?  In that case, this second approach fails with a hard exception that the object is not yet classified.

---------------------------------

If, on the other hand, you set

CLASSTYPE = "001"

OBJECT = <18-digit Material Number>

OBJECTTABLE = "MARA"

Then it returns the classes for the Material itself.

Hope that helps someone.