15: l_organization_id VARCHAR2(10);
16: l_description VARCHAR2(50) := 'Category to Upgrade Item Groups';
17: l_user_id NUMBER;
18:
19: l_new_structure FND_FLEX_KEY_API.structure_type;
20: l_new_segment FND_FLEX_KEY_API.segment_type;
21: l_flexfield FND_FLEX_KEY_API.flexfield_type;
22: l_structure FND_FLEX_KEY_API.structure_type;
23:
16: l_description VARCHAR2(50) := 'Category to Upgrade Item Groups';
17: l_user_id NUMBER;
18:
19: l_new_structure FND_FLEX_KEY_API.structure_type;
20: l_new_segment FND_FLEX_KEY_API.segment_type;
21: l_flexfield FND_FLEX_KEY_API.flexfield_type;
22: l_structure FND_FLEX_KEY_API.structure_type;
23:
24: err_num NUMBER := 0;
17: l_user_id NUMBER;
18:
19: l_new_structure FND_FLEX_KEY_API.structure_type;
20: l_new_segment FND_FLEX_KEY_API.segment_type;
21: l_flexfield FND_FLEX_KEY_API.flexfield_type;
22: l_structure FND_FLEX_KEY_API.structure_type;
23:
24: err_num NUMBER := 0;
25: err_msg VARCHAR2(240) := '';
18:
19: l_new_structure FND_FLEX_KEY_API.structure_type;
20: l_new_segment FND_FLEX_KEY_API.segment_type;
21: l_flexfield FND_FLEX_KEY_API.flexfield_type;
22: l_structure FND_FLEX_KEY_API.structure_type;
23:
24: err_num NUMBER := 0;
25: err_msg VARCHAR2(240) := '';
26:
36: WHERE group_id = p_group_id;
37:
38: BEGIN
39:
40: FND_FLEX_KEY_API.set_session_mode('customer_data');
41:
42: --Find the Item Categories flexfield
43: l_flexfield := FND_FLEX_KEY_API.find_flexfield(appl_short_name => 'INV',
44: flex_code => 'MCAT');
39:
40: FND_FLEX_KEY_API.set_session_mode('customer_data');
41:
42: --Find the Item Categories flexfield
43: l_flexfield := FND_FLEX_KEY_API.find_flexfield(appl_short_name => 'INV',
44: flex_code => 'MCAT');
45:
46:
47: -- Find the structure if it already exists.
45:
46:
47: -- Find the structure if it already exists.
48: BEGIN
49: l_structure := FND_FLEX_KEY_API.find_structure(flexfield => l_flexfield,
50: structure_code => 'PRICELIST_ITEM_CATEGORIES');
51: EXCEPTION
52: WHEN NO_DATA_FOUND THEN
53: NULL;
79:
80: ELSE --If structure does not exist i.e.upgrade script not run before
81:
82: --Create new Structure for the Item Categories FlexField
83: l_new_structure := FND_FLEX_KEY_API.new_structure(flexfield => l_flexfield,
84: structure_code => 'PRICELIST_ITEM_CATEGORIES',
85: structure_title => 'PriceList Item Categories',
86: description =>'Item Categories for PriceLists',
87: view_name => '',
96: shorthand_length => 0
97: );
98:
99: --Add the newly created structure to the Item Categories flexfield
100: FND_FLEX_KEY_API.add_structure(flexfield => l_flexfield,
101: structure => l_new_structure);
102:
103: --Create a new dummy segment for the new structure
104: l_new_segment := FND_FLEX_KEY_API.new_segment(flexfield => l_flexfield,
100: FND_FLEX_KEY_API.add_structure(flexfield => l_flexfield,
101: structure => l_new_structure);
102:
103: --Create a new dummy segment for the new structure
104: l_new_segment := FND_FLEX_KEY_API.new_segment(flexfield => l_flexfield,
105: structure => l_new_structure,
106: segment_name => 'Dummy',
107: description => 'Dummy',
108: column_name => 'SEGMENT1',
122: lov_prompt => 'Dummy',
123: window_prompt => 'Dummy');
124:
125: --Add the newly created dummy segment to the new structure
126: FND_FLEX_KEY_API.add_segment(flexfield => l_flexfield,
127: structure => l_new_structure,
128: segment => l_new_segment);
129:
130: --Fetch Structure id of newly created Structure;
390: EXCEPTION
391: WHEN OTHERS THEN
392: err_msg := substr(sqlerrm, 1, 240);
393: IF err_msg IS NULL THEN
394: err_msg := substr(FND_FLEX_KEY_API.message, 1, 240);
395: END IF;
396: QP_UTIL.Log_Error(
397: p_id1 => 'Category Set Id '||to_char(l_new_category_set_id),
398: p_id2 => 'Category Id '||to_char(l_new_category_id),