43:
44: ret_code NUMBER := 0;
45: l_err_text VARCHAR2(2000);
46:
47: l_return_status VARCHAR2(1); -- := fnd_api.g_MISS_CHAR
48: l_msg_count NUMBER;
49: l_msg_data VARCHAR2(2000);
50:
51: l_msg_name VARCHAR2(2000);
57: l_item_desc_element_table ITEM_DESC_ELEMENT_TABLE;
58: BEGIN
59:
60: -- Check for call compatibility.
61: IF NOT FND_API.Compatible_API_Call (l_api_version,
62: p_api_version ,
63: l_api_name ,
64: G_PKG_NAME)
65: THEN
62: p_api_version ,
63: l_api_name ,
64: G_PKG_NAME)
65: THEN
66: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
67: END IF;
68:
69: -- Standard Start of API savepoint
70: SAVEPOINT Process_item_descr_elem_PUB;
69: -- Standard Start of API savepoint
70: SAVEPOINT Process_item_descr_elem_PUB;
71:
72: -- Initialize message list if p_init_msg_list is set to TRUE.
73: IF FND_API.to_Boolean( p_init_msg_list ) THEN
74: FND_MSG_PUB.initialize;
75: END IF;
76:
77: INV_ITEM_MSG.set_Message_Mode('PLSQL');
94: INV_ITEM_MSG.g_Prog_appid := FND_GLOBAL.prog_appl_id ;
95: INV_ITEM_MSG.g_Prog_id := FND_GLOBAL.conc_program_id;
96: INV_ITEM_MSG.g_Request_id := FND_GLOBAL.conc_request_id;
97:
98: x_return_status := fnd_api.g_RET_STS_SUCCESS;
99: ------------------------------------------------------------------------------------------
100: -- Process step 1: Loop through item catlog group elements interface records --
101: -- (a) Check for duplicate records in the interface table table --
102: ------------------------------------------------------------------------------------------
113: , p_token1 => 'ELEMENT_NAME'
114: , p_value1 => l_item_desc_element_table(icoi_rec).ELEMENT_NAME
115: );
116: l_item_desc_element_table.DELETE(icoi_rec_dup);
117: x_return_status := fnd_api.g_RET_STS_ERROR;
118: END IF;
119: END IF;
120: END LOOP;--} icoi_csr_dup
121: END LOOP; --} icoi_csr
133: INV_ITEM_MSG.Debug(Mctx, 'starting the main ICatalogOI loop step2');
134:
135: FOR icoi_rec IN l_item_desc_element_table.first .. l_item_desc_element_table.last LOOP --{
136:
137: l_return_status := fnd_api.g_RET_STS_SUCCESS;
138:
139: -- call the API to process item catalog element values
140:
141: IF ( l_item_desc_element_table.EXISTS(icoi_rec) ) THEN
145:
146: INV_ITEM_CATALOG_ELE_PVT.Catalog_Grp_Ele_Val_Assignment
147: (
148: p_api_version => 1.0
149: , p_init_msg_list => fnd_api.g_TRUE
150: , p_commit => fnd_api.g_FALSE
151: , p_validation_level => p_validation_level
152: , p_inventory_item_id => p_inventory_item_id
153: , p_item_number => p_item_number
146: INV_ITEM_CATALOG_ELE_PVT.Catalog_Grp_Ele_Val_Assignment
147: (
148: p_api_version => 1.0
149: , p_init_msg_list => fnd_api.g_TRUE
150: , p_commit => fnd_api.g_FALSE
151: , p_validation_level => p_validation_level
152: , p_inventory_item_id => p_inventory_item_id
153: , p_item_number => p_item_number
154: , p_element_name => l_item_desc_element_table(icoi_rec).ELEMENT_NAME
158: , x_msg_count => l_msg_count
159: , x_msg_data => l_msg_data
160: );
161:
162: IF ( l_return_status = fnd_api.g_RET_STS_SUCCESS ) THEN
163: NULL;
164: ELSE
165: INV_ITEM_MSG.Debug(Mctx, 'error in Catalog_Grp_Ele_Val_Assignment. Msg count=' || TO_CHAR(INV_ITEM_MSG.Count_Msg));
166: x_return_status := l_return_status;
166: x_return_status := l_return_status;
167: END IF; -- l_return_status
168:
169: -- If unexpected error in Catalog_Grp_Ele_Val_Assignment API, stop the processing
170: IF ( l_return_status = fnd_api.g_RET_STS_UNEXP_ERROR ) THEN
171: x_return_status := l_return_status;
172: RAISE Processing_Error;
173: END IF;
174:
187: show_all_delim=>'Y',
188: error_text=>l_error_msg);
189:
190: -- Check of commit
191: IF ( FND_API.To_Boolean(p_commit_flag) ) THEN
192: COMMIT WORK;
193: END IF;
194: --
195: -- Determine request return code
212:
213: WHEN others THEN
214: ROLLBACK TO Process_item_descr_elem_PUB;
215: l_err_text := SUBSTRB(SQLERRM, 1,240);
216: x_return_status := fnd_api.g_RET_STS_UNEXP_ERROR;
217: INV_ITEM_MSG.Add_Message
218: ( p_Msg_Name => 'INV_ITEM_UNEXPECTED_ERROR'
219: , p_token1 => 'PKG_NAME'
220: , p_value1 => G_PKG_NAME
307: ret_code NUMBER := 0;
308: l_err_text VARCHAR2(2000);
309:
310: l_commit VARCHAR2(1);
311: l_return_status VARCHAR2(1); -- := fnd_api.g_MISS_CHAR
312: l_msg_count NUMBER;
313: l_msg_data VARCHAR2(2000);
314:
315: l_msg_name VARCHAR2(2000);
362: INV_ITEM_MSG.g_Prog_id := g_Prog_id;
363: INV_ITEM_MSG.g_Request_id := g_Request_id;
364:
365: IF ( p_commit_flag = 1 ) THEN
366: l_commit := fnd_api.g_TRUE;
367: ELSE
368: l_commit := fnd_api.g_FALSE;
369: END IF;
370:
364:
365: IF ( p_commit_flag = 1 ) THEN
366: l_commit := fnd_api.g_TRUE;
367: ELSE
368: l_commit := fnd_api.g_FALSE;
369: END IF;
370:
371: l_RETCODE := G_SUCCESS;
372:
401: --
402: -- Assign missing inventory_item_id from item_number
403: --
404:
405: l_return_status := fnd_api.g_RET_STS_SUCCESS;
406:
407: item_id := icoi_rec1.inventory_item_id;
408: l_item_number := icoi_rec1.item_number;
409:
415: IF ( ret_code = 0 ) THEN
416: l_inventory_item_id := flex_id;
417: IF ((item_id IS NOT NULL)AND
418: (l_inventory_item_id <> item_id)) THEN
419: l_return_status := fnd_api.g_RET_STS_ERROR;
420: l_msg_name := 'INV_CEOI_ITEM_NUM_ID_MISMATCH';
421: l_token := 'VALUE1';
422: l_token_value := l_item_number;
423: l_column_name := 'ITEM_NUMBER';
425: l_token_value := item_id;
426: l_column_name := 'INVENTORY_ITEM_ID';
427: END IF;
428: ELSE
429: l_return_status := fnd_api.g_RET_STS_ERROR;
430: l_msg_name := 'INV_ICOI_INVALID_ITEM_NUMBER';
431: l_token := 'VALUE';
432: l_token_value := l_item_number;
433: l_column_name := 'ITEM_NUMBER';
433: l_column_name := 'ITEM_NUMBER';
434: END IF;
435:
436: ELSIF ( item_id IS NULL )THEN
437: l_return_status := fnd_api.g_RET_STS_ERROR;
438: l_msg_name := 'INV_CEOI_MISS_ITEM_NUMBER';
439: l_token := fnd_api.g_MISS_CHAR;
440: l_token_value := l_item_number||item_id;
441: l_column_name := 'ITEM_NUMBER';
435:
436: ELSIF ( item_id IS NULL )THEN
437: l_return_status := fnd_api.g_RET_STS_ERROR;
438: l_msg_name := 'INV_CEOI_MISS_ITEM_NUMBER';
439: l_token := fnd_api.g_MISS_CHAR;
440: l_token_value := l_item_number||item_id;
441: l_column_name := 'ITEM_NUMBER';
442: END IF;
443: IF (l_return_status = fnd_api.g_RET_STS_ERROR) THEN
439: l_token := fnd_api.g_MISS_CHAR;
440: l_token_value := l_item_number||item_id;
441: l_column_name := 'ITEM_NUMBER';
442: END IF;
443: IF (l_return_status = fnd_api.g_RET_STS_ERROR) THEN
444: --Bug 14068499
445: SELECT mtl_system_items_interface_s.NEXTVAL
446: INTO l_transaction_id
447: FROM dual;
471:
472: END LOOP; -- icoi_rec1
473:
474: -- Check of commit
475: IF ( FND_API.To_Boolean(l_commit) ) THEN
476: COMMIT WORK;
477: END IF;
478: -- Write all accumulated messages
479: INV_ITEM_MSG.Write_List (p_delete => TRUE);
512:
513: END LOOP; --} icoi_csr_dup
514: END IF; -- Upload Rec Flag is 1
515: -- Check of commit
516: IF ( FND_API.To_Boolean(l_commit) ) THEN
517: COMMIT WORK;
518: END IF;
519: -- Write all accumulated messages
520: INV_ITEM_MSG.Write_List (p_delete => TRUE);
544: --
545: -- Assign missing inventory_item_id from item_number
546: --
547:
548: l_return_status := fnd_api.g_RET_STS_SUCCESS;
549: l_inventory_item_id := icoi_rec.inventory_item_id;
550: l_item_number := icoi_rec.item_number;
551: l_element_value := icoi_rec.element_value;
552: l_element_name := icoi_rec.element_name;
561:
562: INV_ITEM_CATALOG_ELE_PVT.Catalog_Grp_Ele_Val_Assignment
563: (
564: p_api_version => 1.0
565: , p_init_msg_list => fnd_api.g_TRUE
566: , p_commit => fnd_api.g_FALSE
567: , p_validation_level => g_VALIDATE_IDS
568: , p_inventory_item_id => l_inventory_item_id
569: , p_item_number => l_item_number
562: INV_ITEM_CATALOG_ELE_PVT.Catalog_Grp_Ele_Val_Assignment
563: (
564: p_api_version => 1.0
565: , p_init_msg_list => fnd_api.g_TRUE
566: , p_commit => fnd_api.g_FALSE
567: , p_validation_level => g_VALIDATE_IDS
568: , p_inventory_item_id => l_inventory_item_id
569: , p_item_number => l_item_number
570: , p_element_name => l_element_name
575: , x_msg_count => l_msg_count
576: , x_msg_data => l_msg_data
577: );
578:
579: IF ( l_return_status = fnd_api.g_RET_STS_SUCCESS ) THEN
580: l_process_flag := 7;
581: ELSE
582: l_process_flag := 3;
583: INV_ITEM_MSG.Debug(Mctx, 'error in Catalog_Grp_Ele_Val_Assignment. Msg count=' || TO_CHAR(INV_ITEM_MSG.Count_Msg));
584: l_RETCODE := G_WARNING;
585: END IF; -- l_return_status
586:
587: -- If unexpected error in Catalog_Grp_Ele_Val_Assignment API, stop the processing
588: IF ( l_return_status = fnd_api.g_RET_STS_UNEXP_ERROR ) THEN
589: l_RETCODE := G_ERROR;
590: RAISE Processing_Error;
591: END IF;
592:
619:
620: END LOOP; --} icoi_csr
621:
622: -- Check of commit
623: IF ( FND_API.To_Boolean(l_commit) ) THEN
624: COMMIT WORK;
625: END IF;
626:
627: --
639: );
640:
641: INV_ITEM_MSG.Debug(Mctx, 'done delete_OI_records: return_status=' || l_return_status);
642:
643: IF ( l_return_status <> fnd_api.g_RET_STS_SUCCESS ) THEN
644: RAISE Processing_Error;
645: END IF;
646:
647: -- Write all accumulated messages
671: -- Write all accumulated messages
672: INV_ITEM_MSG.Write_List (p_delete => TRUE);
673:
674: -- Check of commit
675: IF ( FND_API.To_Boolean(l_commit) ) THEN
676: COMMIT WORK;
677: END IF;
678:
679: WHEN others THEN
696: -- Write all accumulated messages
697: INV_ITEM_MSG.Write_List (p_delete => TRUE);
698:
699: -- Check of commit
700: IF ( FND_API.To_Boolean(l_commit) ) THEN
701: COMMIT WORK;
702: END IF;
703:
704: END process_Item_Catalog_grp_recs;
724:
725: INV_ITEM_MSG.Debug(Mctx, 'begin');
726:
727: -- Initialize API return status to success
728: x_return_status := FND_API.g_RET_STS_SUCCESS;
729:
730: LOOP
731: DELETE FROM mtl_desc_elem_val_interface
732: WHERE set_process_id = p_rec_set_id
737:
738: INV_ITEM_MSG.Debug(Mctx, 'deleted ' || TO_CHAR(SQL%ROWCOUNT) || ' record(s)');
739:
740: -- Check of commit
741: IF ( FND_API.To_Boolean(p_commit) ) THEN
742: COMMIT WORK;
743: END IF;
744:
745: END LOOP;
746:
747: EXCEPTION
748:
749: WHEN others THEN
750: x_return_status := FND_API.g_RET_STS_UNEXP_ERROR;
751:
752: INV_ITEM_MSG.Add_Unexpected_Error (Mctx, SQLERRM);
753:
754: -- Check of commit
751:
752: INV_ITEM_MSG.Add_Unexpected_Error (Mctx, SQLERRM);
753:
754: -- Check of commit
755: IF ( FND_API.To_Boolean(p_commit) ) THEN
756: COMMIT WORK;
757: END IF;
758:
759: END delete_OI_records;