How to Create a Category SetAn 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 Page 2 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. and ORANGE Navigation -> Setup: Flexfields: Validation: Values In the find screen enter the INVENTORY _COLOR and click the radio button click the find button.Adding Value to the Value set Next we need to enter our values the INVENTORY_COLOR valueset RED. GREEN. BLUE. BLACK. Page 3 of 24 . BLACK.Enter the values RED. GREEN. BLUE. 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 . the following warning will appear Click OK. The “Compile” button is now available to be selected Click on the compile button.Check the Freeze flex field Definition. 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 . Having completed the above process. you may be wondering if there is an API for this purpose Unfortunately No.The new structure is ready of use. Page 11 of 24 . 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.Creating Category sets. Costs. Service. Planning. Product Reporting. Engineering. Purchasing. Product Line Accounting. Asset Management. Default Category sets and Categories A category sets is the logical grouping of categories. To created the Category sets. Contracts. 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 . Default category sets are used by application to set a default category when the attribute associated with the functional areas of Inventory. Order Management. 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 .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. and then we decide that ORANGE should not be assigned to items. BLUE. GREEN. BLACK and checked the box “Enforce List of Valid Categories” Page 14 of 24 . Below we added RED. We create all the categories RED. BLACK.Creating a valid list of Categories This is subset of all the categories to create limited list categories that can be assigned. and ORANGE. GREEN. BLUE. This has the affect of eliminating ORANGE as a category that can be assigned: Page 15 of 24 . Purchasing. 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.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. Order Management. Contracts. Planning. and the category set must be controlled at the same level as the attribute. Costs. They must both be master or org level control. Product Line Accounting. Page 16 of 24 . Engineering. Service. Asset Management. Product Reporting. l_msg_data VARCHAR2(80). x_return_status => l_return_status. INV_ITEM_CATEGORY_ PUB.pls. end . p_commit => FND_API.Create_Category ( p_api_version => 1. INV_ITEM_CATEGORY_PUB. x_errorcode => l_error_code. l_category_rec. UPDATE_CATEGORY This api is currently an Enhancement Request and does not work.0. INV_ITEM_CATEGORY_PUB. select f.Category APIs The APIs are defined in the INVPCATS. x_msg_count => l_msg_count.ID_FLEX_STRUCTURE_CODE = 'INV_COLORS'. begin l_category_rec. p_category_rec => l_category_rec.ID_FLEX_NUM into l_category_rec. l_out_category_id NUMBER. x_category_id => l_out_category_id ).G_TRUE. l_error_code NUMBER. p_init_msg_list => FND_API.Create_Category Example declare l_category_rec INV_ITEM_CATEGORY_PUB.segment1 := 'RED'.structure_id from FND_ID_FLEX_STRUCTURES f where f. x_msg_data => l_msg_data. l_return_status VARCHAR2(80). l_msg_count NUMBER. Page 17 of 24 .G_FALSE.description := 'Red'.CATEGORY_REC_TYPE. p_commit => FND_API.CATEGORY_ID into l_category_id from mtl_categories_b mcb where mcb.Delete_Category ( p_api_version => 1. l_error_code NUMBER.CATEGORY_SET_ID = (select mcs_tl. x_msg_count => l_msg_count.STRUCTURE_ID from mtl_category_sets_b mcs_b where mcs_b. Page 18 of 24 . l_category_id NUMBER.SEGMENT1='RED' and mcb. begin select mcb. l_msg_data VARCHAR2(80). x_return_status => l_return_status. p_init_msg_list => FND_API.STRUCTURE_ID = (select mcs_b. INV_ITEM_CATEGORY_PUB.CATEGORY_SET_ID from mtl_category_sets_tl mcs_tl where CATEGORY_SET_NAME ='INV_COLORS_SET')). x_errorcode => l_error_code.0.G_TRUE. l_msg_count NUMBER.INV_ITEM_CATEGORY_PUB. Delete_Category Example declare l_return_status VARCHAR2(80).G_FALSE. end. x_msg_data => l_msg_data. p_category_id => l_category_id). l_description VARCHAR2(80).INV_ITEM_CATEGORY_PUB. INV_ITEM_CATEGORY_PUB. p_commit => FND_API. p_init_msg_list => FND_API. l_error_code NUMBER.SEGMENT1='BLUE' and mcb.CATEGORY_SET_ID = (select mcs_tl. l_msg_count NUMBER.0. l_msg_data VARCHAR2(80). begin select mcb.G_FALSE.Update_Category_Description Updates the category description.STRUCTURE_ID = (select mcs_b. l_description := 'new blue'.CATEGORY_SET_ID from mtl_category_sets_tl mcs_tl where CATEGORY_SET_NAME ='INV_COLORS_SET')). end. p_category_id => l_category_id. x_errorcode => l_error_code. x_msg_data => l_msg_data. Example declare l_return_status VARCHAR2(80). Page 19 of 24 . x_return_status => l_return_status.Update_Category_Description ( p_api_version => 1. x_msg_count => l_msg_count.CATEGORY_ID into l_category_id from mtl_categories_b mcb where mcb.STRUCTURE_ID from mtl_category_sets_b mcs_b where mcs_b.G_TRUE. l_category_id NUMBER. p_description => l_description). SEGMENT1='RED' and mcb. p_category_id => l_category_id. l_msg_data VARCHAR2(80). l_error_code NUMBER. x_return_status => l_return_status.G_FALSE. p_category_set_id => l_category_set_id.0.INV_ITEM_CATEGORY_PUB. l_msg_count NUMBER. l_category_set_id NUMBER. x_errorcode => l_error_code. x_msg_data => l_msg_data.Create_Valid_Category ( p_api_version => 1. select mcb.CATEGORY_SET_ID into l_category_set_id from mtl_category_sets_tl mcs_tl where mcs_tl. begin select mcs_tl.CATEGORY_SET_ID from mtl_category_sets_tl mcs_tl where CATEGORY_SET_NAME ='INV_COLORS_SET')).CATEGORY_SET_ID = (select mcs_tl.G_TRUE. end.CATEGORY_SET_NAME ='INV_COLORS_SET'.CATEGORY_ID into l_category_id from mtl_categories_b mcb where mcb. x_msg_count => l_msg_count. INV_ITEM_CATEGORY_PUB. p_parent_category_id => NULL ). l_category_id NUMBER.Create_Valid_Category Create a record in mtl_category_set_valid_cats.STRUCTURE_ID = (select mcs_b.STRUCTURE_ID from mtl_category_sets_b mcs_b where mcs_b. Page 20 of 24 . p_init_msg_list => FND_API. declare l_return_status VARCHAR2(80). p_commit => FND_API. Page 21 of 24 . STRUCTURE_ID = (select mcs_b. l_category_set_id NUMBER. l_msg_data VARCHAR2(80). x_msg_count => l_msg_count.CATEGORY_SET_NAME ='INV_COLORS_SET'. x_return_status => l_return_status. l_error_code NUMBER. p_init_msg_list => FND_API.G_TRUE.INV_ITEM_CATEGORY_PUB. INV_ITEM_CATEGORY_PUB. x_msg_data => l_msg_data. end. p_category_id => l_category_id).CATEGORY_ID into l_category_id from mtl_categories_b mcb where mcb.0. l_msg_count NUMBER. l_category_id NUMBER. select mcb. begin select mcs_tl.CATEGORY_SET_ID from mtl_category_sets_tl mcs_tl where CATEGORY_SET_NAME ='INV_COLORS_SET')).SEGMENT1='RED' and mcb.CATEGORY_SET_ID into l_category_set_id from mtl_category_sets_tl mcs_tl where mcs_tl.STRUCTURE_ID from mtl_category_sets_b mcs_b where mcs_b. Example declare l_return_status VARCHAR2(80). x_errorcode => l_error_code.CATEGORY_SET_ID = (select mcs_tl.Delete_Valid_Category ( p_api_version => 1.G_FALSE. Page 22 of 24 . p_commit => FND_API.Delete_Valid_Category Delete the record from mtl_category_set_valid_cats. p_category_set_id => l_category_set_id. ID_FLEX_NUM from FND_ID_FLEX_STRUCTURES f where f.FLEX_VALUE_SET_NAME = 'INVENTORY_COLOR' The following will provide a the values for the flexfield select * from FND_FLEX_VALUES ffv where ffv. Page 23 of 24 .FLEX_VALUE_SET_ID = (select ffvs. f. Shows the flexfeild parameters select f. 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.Value Set and Structure data The following is include so you can see where the data is stored.ID_FLEX_STRUCTURE_CODE = 'INV_COLORS').FLEX_VALUE_SET_ID from FND_FLEX_VALUE_SETS ffvs where ffvs.* from FND_ID_FLEX_STRUCTURES f where f.FLEX_VALUE_SET_NAME = 'INVENTORY_COLOR').ID_FLEX_NUM =(select 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.