Professional Documents
Culture Documents
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.
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
Page 2 of 24
Adding Value to the Value set
In the find screen enter the INVENTORY _COLOR and click the radio button click the find button.
Page 3 of 24
Enter the values
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
Page 7 of 24
Check the Freeze flex field Definition, the following warning will appear
Click OK,
Click Ok
Page 8 of 24
Click Ok
Page 9 of 24
Verify the new Category flexfield compiled successfully
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
Page 12 of 24
Next we create our category
Navigation
Setup: Items: Categories: Category Sets
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.
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
Page 23 of 24