17: is
18:
19: begin
20:
21: FND_FILE.PUT_NAMES('enivalcat.log','enivalcat.out',fnd_profile.value('EDW_LOGFILE_DIR'));
22: g_error := eni_validate_structure;
23:
24: if g_error = true then
25: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Error in Validation ');
21: FND_FILE.PUT_NAMES('enivalcat.log','enivalcat.out',fnd_profile.value('EDW_LOGFILE_DIR'));
22: g_error := eni_validate_structure;
23:
24: if g_error = true then
25: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Error in Validation ');
26: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
27: Errbuf:=g_errbuf;
28: retcode:=2;
29: else
22: g_error := eni_validate_structure;
23:
24: if g_error = true then
25: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Error in Validation ');
26: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
27: Errbuf:=g_errbuf;
28: retcode:=2;
29: else
30: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Validation complete');
26: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
27: Errbuf:=g_errbuf;
28: retcode:=2;
29: else
30: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Validation complete');
31: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
32: eni_populate_category;
33:
34: if g_warn = true then
27: Errbuf:=g_errbuf;
28: retcode:=2;
29: else
30: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Validation complete');
31: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ');
32: eni_populate_category;
33:
34: if g_warn = true then
35: Errbuf:=g_errbuf;
69: WHEN NO_DATA_FOUND THEN
70: l_vbh_catset_id := 1000000006;
71: END;
72:
73: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Category set id is:' || l_vbh_catset_id);
74:
75: -- Check to see if the structure asscociated with the category set is PRODUCT_CATEGORIES --
76: begin
77: select id_flex_num into l_struct_code
79: where a.id_flex_num=b.structure_id
80: and b.category_set_id = l_vbh_catset_id
81: and id_flex_structure_code='PRODUCT_CATEGORIES';
82:
83: fnd_file.put_line(fnd_file.log, 'Structure is: ' || l_struct_code);
84: exception
85: when NO_DATA_FOUND then
86: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: The flex structure associated with this category set is not PRODUCT_CATEGORIES');
87: g_error:=true;
82:
83: fnd_file.put_line(fnd_file.log, 'Structure is: ' || l_struct_code);
84: exception
85: when NO_DATA_FOUND then
86: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: The flex structure associated with this category set is not PRODUCT_CATEGORIES');
87: g_error:=true;
88: goto end_block;
89: end;
90:
98: and id_flex_code = 'MCAT'
99: and enabled_flag = 'Y'
100: and id_flex_num = l_struct_code;
101:
102: fnd_file.put_line(fnd_file.log, 'Flexvalue set id ' || l_flex_value_set_id);
103:
104: if l_application_column <> 'SEGMENT1' then
105: raise invalid_segment;
106: elsif l_flex_value_set_id is null then
115: null;
116:
117: exception
118: when INVALID_SEGMENT then
119: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: The segment associated with this category set is not SEGMENT1');
120: g_error:=true;
121: return g_error;
122: when VALUE_SET_NULL then
123: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: Value set associated with this category set is null');
119: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: The segment associated with this category set is not SEGMENT1');
120: g_error:=true;
121: return g_error;
122: when VALUE_SET_NULL then
123: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: Value set associated with this category set is null');
124: g_error:=true;
125: return g_error;
126: when NO_DATA_FOUND then
127: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: There is no SEGMENT associated with PRODUCT_CATEGORIES category set OR it is disabled');
123: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: Value set associated with this category set is null');
124: g_error:=true;
125: return g_error;
126: when NO_DATA_FOUND then
127: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: There is no SEGMENT associated with PRODUCT_CATEGORIES category set OR it is disabled');
128: g_error:=true;
129: return g_error;
130: when TOO_MANY_ROWS then
131: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: More than 1 SEGMENT is associated with PRODUCT_CATEGORIES category set');
127: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: There is no SEGMENT associated with PRODUCT_CATEGORIES category set OR it is disabled');
128: g_error:=true;
129: return g_error;
130: when TOO_MANY_ROWS then
131: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: More than 1 SEGMENT is associated with PRODUCT_CATEGORIES category set');
132: g_error:=true;
133: return g_error;
134: when OTHERS then
135: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: ' || sqlerrm);
131: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: More than 1 SEGMENT is associated with PRODUCT_CATEGORIES category set');
132: g_error:=true;
133: return g_error;
134: when OTHERS then
135: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: ' || sqlerrm);
136: g_error:=true;
137: return g_error;
138:
139: end; -- Procedure to validate structure
272: and ENABLED_FLAG = 'Y';
273:
274: exception
275: when no_data_found then
276: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error: The segment associated with
277: the default category set is not SEGMENT1');
278: g_error:=true;
279: goto end_block;
280: end;
295:
296: if c1_rec.update_flag = 1 then
297: l_category_rec.category_id := c1_rec.category_id;
298:
299: FND_FILE.PUT_LINE(FND_FILE.LOG,'Selected node for update: '||c1_rec.l_segment1);
300: INV_ITEM_CATEGORY_PUB.Update_Category(
301: p_api_version=>1,
302: x_return_status =>l_return_status,
303: x_errorcode=> l_errorcode ,
306: p_category_rec =>l_category_rec
307: );
308: else
309:
310: FND_FILE.PUT_LINE(FND_FILE.LOG,'Selected node for insert: '|| c1_rec.l_segment1);
311: INV_ITEM_CATEGORY_PUB.Create_Category (p_api_version=>1,
312: x_return_status =>l_return_status,
313: x_errorcode=> l_errorcode ,
314: x_msg_count=> l_msg_count,
318: end if;
319:
320: if l_msg_count > 0 then
321: FND_MSG_PUB.Get(p_msg_index=>fnd_msg_pub.G_LAST,p_encoded=>FND_API.G_FALSE, p_msg_index_out=>l_msg_index_out, p_data=>l_data);
322: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error in insert/update of node' );
323: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1,1000));
324: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1001,1000));
325: FND_FILE.PUT_LINE(FND_FILE.LOG,' ' );
326:
319:
320: if l_msg_count > 0 then
321: FND_MSG_PUB.Get(p_msg_index=>fnd_msg_pub.G_LAST,p_encoded=>FND_API.G_FALSE, p_msg_index_out=>l_msg_index_out, p_data=>l_data);
322: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error in insert/update of node' );
323: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1,1000));
324: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1001,1000));
325: FND_FILE.PUT_LINE(FND_FILE.LOG,' ' );
326:
327: g_warn:=true;
320: if l_msg_count > 0 then
321: FND_MSG_PUB.Get(p_msg_index=>fnd_msg_pub.G_LAST,p_encoded=>FND_API.G_FALSE, p_msg_index_out=>l_msg_index_out, p_data=>l_data);
322: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error in insert/update of node' );
323: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1,1000));
324: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1001,1000));
325: FND_FILE.PUT_LINE(FND_FILE.LOG,' ' );
326:
327: g_warn:=true;
328: else
321: FND_MSG_PUB.Get(p_msg_index=>fnd_msg_pub.G_LAST,p_encoded=>FND_API.G_FALSE, p_msg_index_out=>l_msg_index_out, p_data=>l_data);
322: FND_FILE.PUT_LINE(FND_FILE.LOG,'Error in insert/update of node' );
323: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1,1000));
324: FND_FILE.PUT_LINE(FND_FILE.LOG,substrb(l_data,1001,1000));
325: FND_FILE.PUT_LINE(FND_FILE.LOG,' ' );
326:
327: g_warn:=true;
328: else
329: FND_FILE.PUT_LINE(FND_FILE.LOG,'Node committed to database ' );
325: FND_FILE.PUT_LINE(FND_FILE.LOG,' ' );
326:
327: g_warn:=true;
328: else
329: FND_FILE.PUT_LINE(FND_FILE.LOG,'Node committed to database ' );
330: FND_FILE.PUT_LINE(FND_FILE.LOG,' ' );
331: end if;
332:
333: end loop;
326:
327: g_warn:=true;
328: else
329: FND_FILE.PUT_LINE(FND_FILE.LOG,'Node committed to database ' );
330: FND_FILE.PUT_LINE(FND_FILE.LOG,' ' );
331: end if;
332:
333: end loop;
334:
334:
335: -- If there are no values in the value set then raise exception
336:
337: if l_count =0 then
338: FND_FILE.PUT_LINE(FND_FILE.LOG, 'No nodes were updated or inserted. This could be because there were no changes in the valueset since the last time it was updated or there are no values defined in the hierarchy');
339: g_count := l_count;
340: end if;
341:
342: