assign cat to item[1]

17
How to Assign Categories An Oracle Technical White Paper May 2007 Revision 1

Upload: farida-serry

Post on 17-Oct-2014

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Assign Cat to Item[1]

How to Assign Categories

An Oracle Technical White Paper May 2007 Revision 1

Page 2: Assign Cat to Item[1]

1

How to Assign, Update, and Delete Item Categories, Purpose 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 look at the various methods of assinging categories to items Assumption This note will work with an organization control level category that is not assigned to a functional area. When a item is create and the functional catagories are assigned automaticly. A category assignment must exist for the functional area therefore the category can only be updated . The categories used here we created for note “How to Create a Category Set”. Assigning Categories in the forms This way always works for a small number of items or categories it can be quick and easy. Create your item.

Page 3: Assign Cat to Item[1]

2

After creating the item and saving In the pull down menu at the top of the screen. Select: Tools -> Categories

Page 4: Assign Cat to Item[1]

3

Assign the category

Save and exit the form

Page 5: Assign Cat to Item[1]

4

Cateries can also be assigned in the Category Sets form Setup: Items: Categories: Category Sets Click on assign item

Page 6: Assign Cat to Item[1]

5

In the assignment screen Item : select Category_Item Category : “BLACK”

Save and exit the form.

Page 7: Assign Cat to Item[1]

6

How used the Category interface to create, update and delete item category assignments

Finding the data The following select provides you with the current assignment for all organizations (You will need to limit this by organization when importing items and APIs Select * From mtl_item_categories where inventory_item_id = ( select distinct (INVENTORY_ITEM_ID ) from MTL_SYSTEM_ITEMS_B where segment1 = '&item_name') and category_set_id = (select mcs_tl.CATEGORY_SET_ID from mtl_category_sets_tl mcs_tl where mcs_tl.CATEGORY_SET_NAME ='INV_COLORS_SET'); This sql provide the key columns in the table. select mic.ORGANIZATION_ID, mic.INVENTORY_ITEM_ID , mic.CATEGORY_SET_ID , mic.CATEGORY_ID from mtl_item_categories mic where inventory_item_id = ( select distinct (INVENTORY_ITEM_ID ) from MTL_SYSTEM_ITEMS_B where segment1 = '&item_name') and category_set_id = (select mcs_tl.CATEGORY_SET_ID from mtl_category_sets_tl mcs_tl where mcs_tl.CATEGORY_SET_NAME ='INV_COLORS_SET'); ORGANIZATION_ID INVENTORY_ITEM_ID CATEGORY_SET_ID CATEGORY_ID

204 519940 1100000423 28606 207 519940 1100000423 28606

The data is form a Vision install data Orgainization_id 204 is V1 Vision Operations Orgainization_id 207 is M1 Seatle Manufacuting

Page 8: Assign Cat to Item[1]

7

The example query show now to connect categories to a category set. When looking for the data , the name of the category set os stored in the mtl_category_sets_tl. MTL_CATEGORY_SETS_TL table does not contain the STRUCTURE_ID to link back to the categories in the mtl_categories_b table. When linking these tables it is also important to note, a category structure can be used by more than one category set. select Segment1, mcb.CATEGORY_ID, mcb.STRUCTURE_ID, mcs_b.CATEGORY_SET_ID from mtl_categories_b mcb, mtl_category_sets_b mcs_b where 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')) and mcb.STRUCTURE_ID = mcs_b.STRUCTURE_ID;

SEGMENT1 CATEGORY_ID STRUCTURE_ID CATEGORY_SET_ID GREEN 30606 52670 1100000423

BLUE 30607 52670 1100000423 ORANGE 30608 52670 1100000423

BLACK 28606 52670 1100000423 RED 31606 52670 1100000423

Example of the Category Import Process Since we create Item category records through the forms, we use the order DELETE,CREATE, and UPDATE for the example. For each of the following we will show two examples he first using the names orgs , items and categories. The second the ID internal to the system. You can mix and match as needed. The insert below represents the minimum number of columns that must be populated in order to be succeessful. Examples using character data ( For my example I started with the 'Category_Item' assign to the value 'BLACK') DELETE INSERT INTO MTL_ITEM_CATEGORIES_INTERFACE (ITEM_NUMBER,CATEGORY_SET_NAME,CATEGORY_NAME ,PROCESS_FLAG, ORGANIZATION_CODE , SET_PROCESS_ID, TRANSACTION_TYPE) VALUES ('Category_Item','INV_COLORS_SET','BLACK',1,'V1',1,'DELETE'); COMMIT;

Page 9: Assign Cat to Item[1]

8

CREATE INSERT INTO MTL_ITEM_CATEGORIES_INTERFACE (ITEM_NUMBER,CATEGORY_SET_NAME,CATEGORY_NAME ,PROCESS_FLAG, ORGANIZATION_CODE , SET_PROCESS_ID, TRANSACTION_TYPE) VALUES ('Category_Item','INV_COLORS_SET','BLACK',1,'V1',1,'CREATE'); COMMIT; (Note: the create transaction can be used in combination with the Item Open Interface to creates items with something other than the default category. The SET_PROCESS_ID in both the MTL_ITEM_CATEGORIES_INTERFACE and the MTL_SYSTEM_ITEMS_INTERFACE must be the same AND the when the Item Open interface is run the “Process Set” must equal the The SET_PROCESS_ID. If the Item Open interface is run with the “Null” the categies will not be imported at the same tiem ) FOR THE UPDATE TRANSATION WE NEED TO ADD THE FIELD OLD_CATEGORY_NAME FOR THE RECORD TO PROCESS CORRECTLY . INSERT INTO MTL_ITEM_CATEGORIES_INTERFACE (ITEM_NUMBER,CATEGORY_SET_NAME,CATEGORY_NAME,ORGANIZATION_CODE,PROCESS_FLAG, TRANSACTION_TYPE,SET_PROCESS_ID,OLD_CATEGORY_NAME) VALUES('Category_Item','INV_COLORS_SET','RED','V1',1,'UPDATE',1,'BLACK');

Page 10: Assign Cat to Item[1]

9

Example of using the ID fields. ( For my example I started with the 'Category_Item' assign to the value 'BLACK') INSERT INTO MTL_ITEM_CATEGORIES_INTERFACE (ORGANIZATION_ID,INVENTORY_ITEM_ID,CATEGORY_SET_ID,CATEGORY_ID,PROCESS_FLAG ,SET_PROCESS_ID, TRANSACTION_TYPE) VALUES (204,519940,1100000423,28606,1,1,'DELETE') INSERT INTO MTL_ITEM_CATEGORIES_INTERFACE (ORGANIZATION_ID,INVENTORY_ITEM_ID,CATEGORY_SET_ID,CATEGORY_ID,PROCESS_FLAG ,SET_PROCESS_ID, TRANSACTION_TYPE) VALUES (204,519940,1100000423,28606,1,1,'CREATE') INSERT INTO MTL_ITEM_CATEGORIES_INTERFACE (ORGANIZATION_ID,INVENTORY_ITEM_ID,CATEGORY_SET_ID,CATEGORY_ID,PROCESS_FLAG ,SET_PROCESS_ID, TRANSACTION_TYPE,OLD_CATEGORY_ID ) VALUES (204,519940,1100000423,31606,1,1,'UPDATE',28606 )

Page 11: Assign Cat to Item[1]

10

Using the Import Item Category Assignments The Menu navigation is Items : Import:Import Item Category Assignments

Page 12: Assign Cat to Item[1]

11

from Oracle® Manufacturing APIs and Open Interfaces Manual Release 11i Part No. A95953-05 Item Category Assignment Interface Runtime Options To run the Item Interface, select Import Item Category Assignments from the Import submenu, accessed from the Inventory menu. When you run the Item Category Interface, you are prompted for report parameters. These are runtime options for the Item Category Interface: Record Set Id Enter a set id number for the set of records in the interface table that you want to process. The program picks up the records having that id in the SET_PROCESS_ ID column. This column value cannot be NULL. In order to avoid set id value conflicts between record sets imported by different users, you should use the sequence MTL_SYSTEM_ITEMS_INTF_SETS_S when populating the SET_ PROCESS_ID column. Upload Processed Records Yes All qualifying item category assignment records in the interface table are inserted into Oracle Inventory. No Do not insert item category assignments into Oracle Inventory. Use this option if you want to validate items without any processing. Delete Processed Records Yes

Page 13: Assign Cat to Item[1]

12

Delete successfully processed item category assignment records from the item categories interface table. No Leave all records in the item categories interface table. Determining Batch Size Running the Item Interface in Create Mode The optimum batch size depends upon the amount of data being imported and the power of your system. If you are processing 10,000 items or less, break the 10,000 items into smaller groups. A batch size of 1,000 to 2,000 should be adequate to process these rows efficiently. Load the records for one group, process them, then delete the records from the interface table. If you wish to maintain history, create separate history tables and move processed rows there, instead of deleting them. Leaving large numbers of processed rows in the interface table will degrade performance of the Open Item Interface. For a greater number of records, you may also use a batch size of 2,000 but you may want to try larger batch sizes, up to 5,000 items. The best way to determine your batch size is by benchmarking. First, try loading 2,000 items into interface tables. Note the time the Item Interface takes to process these rows in one batch. If this time is more than 20 minutes, stick with the batch size of 2,000 or less. Otherwise, you may want to try larger batch sizes. If importing a large number of records, you should break down your records into batch size, determined above, and process them in parallel for optimum performance. See: Multi-Thread Capability (Parallel Runs of the Item Interface), for more information.

Page 14: Assign Cat to Item[1]

13

The are are three types of transaction supported for categories CREATE, UPDATE, and DELETE (Note the UPDATE transaction type was not originally supported For 11.5.9 Patch 4088037 Patch recommended for all users. On applying this patch Import Item Category Assignment program will support transaction type 'UPDATE' to update existing Item Category assignments Minimum file version Product Directory File Version

inv patch/115/odf invintf.odf 115.59.11592.2

inv patch/115/sql INVCICIB.pls 115.17.11592.4

inv patch/115/sql INVPCATB.pls 115.24.11590.9

inv patch/115/sql INVPCATS.pls 115.10.11590.5

inv patch/115/sql INVVCATB.pls 115.11.11592.7

inv patch/115/sql INVVCATS.pls 115.9.11592.2 For 11.5.10 Patch 4060373 FP:11I9-11.5.10 - 'UPDATE' FUNCTIONALITY FOR IMPORT ITEM CATEGORY ASSIGNMENT Minimum file version Product Directory File Version

inv patch/115/odf invintf.odf 115.63.115100.3

inv patch/115/sql INVCICIB.pls 115.28.115100.2

inv patch/115/sql INVPCATB.pls 115.31.115100.3

inv patch/115/sql INVPCATS.pls 115.13.115100.2

inv patch/115/sql INVVCATB.pls 115.19.115100.2

inv patch/115/sql INVVCATS.pls 115.9.11592.2 The file INVPCATS.pls contain the definition for all the APIs . The example below show how to select the data via sql . These are only exmaples you will need to verfy they work for you. The control stucture and error handling are not provide, you will need to generate these to meet your needs.

Page 15: Assign Cat to Item[1]

14

APIs declare l_return_status VARCHAR2(80); l_error_code NUMBER; l_msg_count NUMBER; l_msg_data VARCHAR2(80); l_category_id NUMBER; l_category_set_id NUMBER; l_Inventory_item_id NUMBER; l_organization_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')); select distinct (INVENTORY_ITEM_ID ) into l_Inventory_item_id from MTL_SYSTEM_ITEMS_KFV msik where msik.CONCATENATED_SEGMENTS = 'Category_Item'; select organization_id into l_organization_id from mtl_parameters where organization_code ='V1'; INV_ITEM_CATEGORY_PUB.Delete_Category_Assignment ( 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_category_set_id => l_category_set_id, p_inventory_item_id => l_Inventory_item_id, p_organization_id =>l_organization_id ); end;

Page 16: Assign Cat to Item[1]

15

declare l_return_status VARCHAR2(80); l_error_code NUMBER; l_msg_count NUMBER; l_msg_data VARCHAR2(80); l_category_id NUMBER; l_category_set_id NUMBER; l_Inventory_item_id NUMBER; l_organization_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='BLACK' 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')); select distinct (INVENTORY_ITEM_ID ) into l_Inventory_item_id from MTL_SYSTEM_ITEMS_KFV msik where msik.CONCATENATED_SEGMENTS = 'Category_Item'; select organization_id into l_organization_id from mtl_parameters where organization_code ='V1'; INV_ITEM_CATEGORY_PUB.Create_Category_Assignment ( 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_category_set_id => l_category_set_id, p_inventory_item_id => l_Inventory_item_id, p_organization_id =>l_organization_id ); end;

Page 17: Assign Cat to Item[1]

16

declare l_return_status VARCHAR2(80); l_error_code NUMBER; l_msg_count NUMBER; l_msg_data VARCHAR2(80); l_category_id NUMBER; l_category_set_id NUMBER; l_Inventory_item_id NUMBER; l_organization_id NUMBER; l_old_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')); select distinct (INVENTORY_ITEM_ID ) into l_Inventory_item_id from MTL_SYSTEM_ITEMS_KFV msik where msik.CONCATENATED_SEGMENTS = 'Category_Item'; select organization_id into l_organization_id from mtl_parameters where organization_code ='V1'; select mic.CATEGORY_ID into l_old_category_id from mtl_item_categories mic where inventory_item_id = ( select distinct (INVENTORY_ITEM_ID ) from MTL_SYSTEM_ITEMS_B where segment1 = 'Category_Item') and category_set_id = (select mcs_tl.CATEGORY_SET_ID from mtl_category_sets_tl mcs_tl where mcs_tl.CATEGORY_SET_NAME='INV_COLORS_SET') and organization_id = l_organization_id ; INV_ITEM_CATEGORY_PUB.Update_Category_Assignment ( 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_category_set_id => l_category_set_id, p_inventory_item_id => l_Inventory_item_id, p_organization_id =>l_organization_id, p_old_category_id => l_old_category_id ); end;