You are on page 1of 6

Contents

Introduction .................................................................................................................................................. 2
Requirement ................................................................................................................................................. 3
Solution – Enhance item category determination ........................................................................................ 3
Important Technical Notes ........................................................................................................................... 5
Introduction
When you create a sales order in SAP, the item category is determined based on below parameters.

 Sales Document type – From the Sales order header
 Item Category Group – From the Material Master
 Usage – From Customer Material Info record

Based on above 3 fields, system will automatically determine the corresponding item category in the
sales order. This assignment is maintained in the below IMG node.

IMG Path: Sales and Distribution / Sales / Sales Documents / Sales Document Item / Assign Item
Categories

In the same IMG node, SAP has provided an option of having multiple item categories for the same
combination of sales document type and Item category group. But those are categorized as “MItC -
Manual Item Category”.

If any item category is assigned as “MItC”, then user is allowed to change the item category to that in
the sales order item manually. Automatic determination of item category will happen only for the item
category assigned in the field “DfltC – Default Item Category”.
Requirement
But let’s say due to possible user errors, business does not want users to change it manually, but the
system to determine an item category classified as ““MItC - Manual Item Category” automatically based
on a pre-defined criteria.

For example, if the sales organization is “A100” system should determine the item category as “TAN”
(Which is already defined as “DfltC – Default Item Category”) for sales document type “OR”. This is not
an issue as SAP standard will always determine this based on above customizing.

But if the sales organization is “A300”, then system should determine item category as “JMT2”. This has
to be done automatically. (Business does not want users to do it manually due to possible user errors)

Solution – Enhance item category determination

You can use below user exit in SAP to determine item category in the sales order.

 Include - MV45AFZB
 User Exit - FORM USEREXIT_SOURCE_DETERMINATION

What you need to do is, ask your ABAP developer to maintain the required combination (Sales
Organization / Order Type / Item Category) in a “Z” table.
Eg:

In the above user exit, insert an ABAP code to check the table for a valid record with the sales
organization and sales document type. If there is a valid record in the table, switch the VBAP–PSTYV
from the table field – Item Category.

Let’s use the debugger to do same! First I will create a breakpoint in the above mentioned user exit and
then create the sales order with sales document type “OR” and sales organization “A300”

As you see below, the required fields were populated;

I can manually override the item category using the option -> This will switch the VBAP-PSTYV to
“JMT2”

Now if I execute the code, the sales order should get item category as “JMT2”
As mentioned above, you can simply override the default item category in the sales order for a pre-
defined criterion.

Important Technical Notes
Let’s say you want to achieve the same functionality with some characteristics that are coming from the
material master.

Eg: It is possible to create a sales order with multiple division articles. In the sales order header you can
have sales area as A300 / A1 / A1, but you can add materials which has division “A2” to same sales
order. Required functionality is to switch the item category based on below criteria;

 Sales Document type - From sales order header -> If sales order type = OR
 Sales organization – From sales order header -> If sales organization = A300
 Distribution Channel - From sales order header -> If Distribution Channel = A1
 Division - From Material master -> If material division = A2

In that case, you need to have below “Z” table entry in place.

Now let’s try in the debug mode to see which fields we need to check;

As shown below, material master data is not available in the VBAP table yet. It is only available in the
structure “MAAPV”. Therefore you need to check with the field “MAAPV-SPART” and not “VBAP-SPART”.
With this check, now you can override the item category of the sales order item.

Author: Anupa Wijesinghe

E-Mail: anupaw@gmail.com / anupaw@learnsaptips.com

Website: www.learnsaptips.com

View my profile in LinkedIn

Follow me on Twitter

Disclaimer

This article is done based on my research and readings, unless otherwise stated. The views expressed
are my own and not of anyone else.
Author accepts no liability for the content of the articles in this website or for the consequences of any
actions taken on the basis of the information provided. Using this information is at the users own
discretion and responsibility.