You are on page 1of 24

How to Create a Category Set

An Oracle Technical White Paper


March 2007
Revision 1
How to Create a Category Set
Creating a Category Set

Overview Creating and Assigning


Categories are the method or controlling how an item logically and
functionally separated for planning, purchasing and other functions. They
aid in the control of all aspect of inventory management. We shall cover
setting up values, value set and the category key flex field. The use of the
forms and APIs to create a category set.

Prerequisites
The design of categories is of the top down, you build categories in the
application from the bottom up. We will use a simple example, allow of are
inventory item are color coded We need a category with one segment to hold
color .Now we must decide how we want represent color, i.e. red, green.
Orange. Can colors be free form or must the user choose from a list of values.
This determines the type to valueset and the type of validation placed on the
Item.

There are several validation available, Dependant, Independent, None, Pair,


Special, Table, Translatable Dependant, and Translatable Independent.
For the purpose of this document we will use the Independent Validation type.
The validation type for “None” requires the least start up effort for assigning the
categories. It major disadvantage is you do not get List of values (LOV) and for
“Orange”, “ORANGE”, or any spelling, abbreviation, or miss spelling is legal, it
may cause you maintenance after the fact.

For the “Independent “ validation type, you get a LOV for the user to choose only
predetermined values. Required more setup, it will ease the maintenance of
incorrect or Inconstant category types

For Our example we want one value set if a maximum length to 15 character all
Upper case. The starting color values are RED, GREEN, BLUE, BLACK, and
ORANGE. The LOV can be expanded as needed later.

Page 1 of 24
Value Validation Section

Validation type Select: Independent


First we setup our value set
Navigation > Setup: Flexfields: Validation: Sets
Header Section
Enter the Value Set Name: INVENTORY_COLOR
Enter the Description: Color Valueset for Inventory
Set “List type”: List of Values
Set Security Type: No Security

Format Validation Section


Format Type: Select “Char” form the LOV
Maximum Size: 15
Check the box “uppercase Only (A-Z)
Leave the rest so the field Blank.

Close the form.

Page 2 of 24
Adding Value to the Value set

Next we need to enter our values the INVENTORY_COLOR valueset


RED, GREEN, BLUE, BLACK, and ORANGE
Navigation ->
Setup: Flexfields: Validation: Values

In the find screen enter the INVENTORY _COLOR and click the radio button click the find button.

Page 3 of 24
Enter the values

RED, GREEN, BLUE, BLACK, and ORANGE

Save and close the Screen

Creating the Flexfield Structure


Navigation
Setup: Flexfields: Key: Segments

Select the type for key flexfield

Page 4 of 24
Create the structure name
In the “Code” field enter INV_COLORS

Page 5 of 24
The Freeze Flexfield Definition box is uncheck, the Segment can only be edited when the box is
unchecked

Page 6 of 24
Click on the “Segments” button in the right hand corner
Enter the “Number” field: 10
Enter the Name field: Color
Enter the “Window Prompt”: Color (This value will appear on the screen)
Enter the “Column” field: Segment1 (you can choose any column

Save and exit the form

Page 7 of 24
Check the Freeze flex field Definition, the following warning will appear

Click OK,

The “Compile” button is now available to be selected


Click on the compile button.

Click Ok

Page 8 of 24
Click Ok

Close the form.

Page 9 of 24
Verify the new Category flexfield compiled successfully

In the pull down menu at the top of the screen


Select View -> Request
Select the radio button “Specific Requests”
In the “Name” field enter: Flexfield View Generator
Click the find button

Page 10 of 24
The new structure is ready of use. Having completed the above process, you may be wondering if
there is an API for this purpose Unfortunately No.

Page 11 of 24
Creating Category sets, Default Category sets and Categories

A category sets is the logical grouping of categories. Default category sets are used by
application to set a default category when the attribute associated with the functional
areas of Inventory, Purchasing, Planning, Service, Costs, Engineering, Order
Management, Product Line Accounting, Asset Management, Contracts, Product
Reporting.

To created the Category sets, Default Category sets and Categories we must
First start at the bottom and work our way up

Setting up a category
Setup: Items: Categories: Category Codes

Enter the structure name: INV_COLORES


Enter the category: BLACK
(Note the form does not provide an LOV for the categories. You will need to use edit
symbol at the top of the page or “<ctrl> e “ to bring up the lov)
Enter the description

Page 12 of 24
Next we create our category
Navigation
Setup: Items: Categories: Category Sets

Fill in the category set Name: INV_COLORS_SET


The description: Inventory color set
The Flex Structure: INV_COLORS
The Controlled: Org Level
Default Category: BLACK
(Notice we create five in our value set but lonely two are seen here. They have to be add as
category before they can be used _

The flag “Allow Multiple Item Category Assignments” cannot be used for
categories in the default category sets.

Page 13 of 24
Creating a valid list of Categories

This is subset of all the categories to create limited list categories that can be assigned.
We create all the categories RED, GREEN, BLUE, BLACK, and ORANGE, and then we decide
that ORANGE should not be assigned to items.

Below we added RED, GREEN, BLUE, BLACK and checked the box “Enforce List of Valid
Categories”

Page 14 of 24
This has the affect of eliminating ORANGE as a category that can be assigned:

Page 15 of 24
Default Category Sets
Default category sets are used by application to set a default category when the attribute
associated with the functional areas of Inventory, Purchasing, Planning, Service, Costs,
Engineering, Order Management, Product Line Accounting, Asset Management, Contracts,
Product Reporting.

These are associated with the specific functional areas


An item is automatically set to the default category for that category set form the Item attribute for
the category is set, and the category set must be controlled at the same level as the attribute.
They must both be master or org level control.

Page 16 of 24
Category APIs
The APIs are defined in the INVPCATS.pls.

INV_ITEM_CATEGORY_ PUB.Create_Category

Example
declare
l_category_rec INV_ITEM_CATEGORY_PUB.CATEGORY_REC_TYPE;
l_return_status VARCHAR2(80);
l_error_code NUMBER;
l_msg_count NUMBER;
l_msg_data VARCHAR2(80);
l_out_category_id NUMBER;
begin
l_category_rec.segment1 := 'RED';
select f.ID_FLEX_NUM into l_category_rec.structure_id
from FND_ID_FLEX_STRUCTURES f
where f.ID_FLEX_STRUCTURE_CODE = 'INV_COLORS';
l_category_rec.description := 'Red';
INV_ITEM_CATEGORY_PUB.Create_Category (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_TRUE,
x_return_status => l_return_status,
x_errorcode => l_error_code,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_category_rec => l_category_rec,
x_category_id => l_out_category_id
);
end ;

INV_ITEM_CATEGORY_PUB. UPDATE_CATEGORY
This api is currently an Enhancement Request and does not work.

Page 17 of 24
INV_ITEM_CATEGORY_PUB. Delete_Category

Example

declare
l_return_status VARCHAR2(80);
l_error_code NUMBER;
l_msg_count NUMBER;
l_msg_data VARCHAR2(80);
l_category_id NUMBER;
begin
select mcb.CATEGORY_ID into l_category_id
from mtl_categories_b mcb
where mcb.SEGMENT1='RED'
and mcb.STRUCTURE_ID = (select mcs_b.STRUCTURE_ID
from mtl_category_sets_b mcs_b
where mcs_b.CATEGORY_SET_ID = (select
mcs_tl.CATEGORY_SET_ID
from mtl_category_sets_tl mcs_tl
where CATEGORY_SET_NAME ='INV_COLORS_SET'));
INV_ITEM_CATEGORY_PUB.Delete_Category (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_TRUE,
x_return_status => l_return_status,
x_errorcode => l_error_code,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_category_id => l_category_id);
end;

Page 18 of 24
INV_ITEM_CATEGORY_PUB.Update_Category_Description
Updates the category description.

Example

declare
l_return_status VARCHAR2(80);
l_error_code NUMBER;
l_msg_count NUMBER;
l_msg_data VARCHAR2(80);
l_category_id NUMBER;
l_description VARCHAR2(80);
begin
select mcb.CATEGORY_ID into l_category_id
from mtl_categories_b mcb
where mcb.SEGMENT1='BLUE'
and mcb.STRUCTURE_ID = (select mcs_b.STRUCTURE_ID
from mtl_category_sets_b mcs_b
where mcs_b.CATEGORY_SET_ID = (select mcs_tl.CATEGORY_SET_ID
from mtl_category_sets_tl mcs_tl
where CATEGORY_SET_NAME ='INV_COLORS_SET'));
l_description := 'new blue';
INV_ITEM_CATEGORY_PUB.Update_Category_Description (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_TRUE,
x_return_status => l_return_status,
x_errorcode => l_error_code,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_category_id => l_category_id,
p_description => l_description);
end;

Page 19 of 24
INV_ITEM_CATEGORY_PUB.Create_Valid_Category
Create a record in mtl_category_set_valid_cats.

declare
l_return_status VARCHAR2(80);
l_error_code NUMBER;
l_msg_count NUMBER;
l_msg_data VARCHAR2(80);
l_category_set_id NUMBER;
l_category_id NUMBER;
begin
select mcs_tl.CATEGORY_SET_ID into l_category_set_id
from mtl_category_sets_tl mcs_tl
where mcs_tl.CATEGORY_SET_NAME ='INV_COLORS_SET';
select mcb.CATEGORY_ID into l_category_id
from mtl_categories_b mcb
where mcb.SEGMENT1='RED'
and mcb.STRUCTURE_ID = (select mcs_b.STRUCTURE_ID
from mtl_category_sets_b mcs_b
where mcs_b.CATEGORY_SET_ID = (select mcs_tl.CATEGORY_SET_ID
from mtl_category_sets_tl mcs_tl
where CATEGORY_SET_NAME ='INV_COLORS_SET'));
INV_ITEM_CATEGORY_PUB.Create_Valid_Category (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_TRUE,
x_return_status => l_return_status,
x_errorcode => l_error_code,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_category_set_id => l_category_set_id,
p_category_id => l_category_id,
p_parent_category_id => NULL );
end;

Page 20 of 24
Page 21 of 24
INV_ITEM_CATEGORY_PUB.Delete_Valid_Category
Delete the record from mtl_category_set_valid_cats.

Example
declare
l_return_status VARCHAR2(80);
l_error_code NUMBER;
l_msg_count NUMBER;
l_msg_data VARCHAR2(80);
l_category_set_id NUMBER;
l_category_id NUMBER;
begin
select mcs_tl.CATEGORY_SET_ID into l_category_set_id
from mtl_category_sets_tl mcs_tl
where mcs_tl.CATEGORY_SET_NAME ='INV_COLORS_SET';
select mcb.CATEGORY_ID into l_category_id
from mtl_categories_b mcb
where mcb.SEGMENT1='RED'
and mcb.STRUCTURE_ID = (select mcs_b.STRUCTURE_ID
from mtl_category_sets_b mcs_b
where mcs_b.CATEGORY_SET_ID = (select mcs_tl.CATEGORY_SET_ID
from mtl_category_sets_tl mcs_tl
where CATEGORY_SET_NAME ='INV_COLORS_SET'));
INV_ITEM_CATEGORY_PUB.Delete_Valid_Category (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_TRUE,
x_return_status => l_return_status,
x_errorcode => l_error_code,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
p_category_set_id => l_category_set_id,
p_category_id => l_category_id);
end;

Page 22 of 24
Value Set and Structure data
The following is include so you can see where the data is stored. The above are only
pl/sql statement and you will need to generate your own control structure to automate the
process

The Valueset header informantion


select *
from FND_FLEX_VALUE_SETS ffvs
where ffvs.FLEX_VALUE_SET_NAME = 'INVENTORY_COLOR'

The following will provide a the values for the flexfield


select *
from FND_FLEX_VALUES ffv
where ffv.FLEX_VALUE_SET_ID = (select ffvs.FLEX_VALUE_SET_ID
from FND_FLEX_VALUE_SETS ffvs
where ffvs.FLEX_VALUE_SET_NAME =
'INVENTORY_COLOR');

Shows the flexfeild parameters


select f.ID_FLEX_NUM, f.*
from FND_ID_FLEX_STRUCTURES f
where f.ID_FLEX_STRUCTURE_CODE = 'INV_COLORS';

Shows the segment setup information


select *
from FND_ID_FLEX_SEGMENTS f_seg
where f_seg.ID_FLEX_NUM =(select f.ID_FLEX_NUM
from FND_ID_FLEX_STRUCTURES f
where f.ID_FLEX_STRUCTURE_CODE =
'INV_COLORS');

Page 23 of 24

You might also like