[Home] [Help]
PACKAGE BODY: APPS.PO_R12_CAT_UPG_PVT
Source
1 PACKAGE BODY PO_R12_CAT_UPG_PVT AS
2 /* $Header: PO_R12_CAT_UPG_PVT.plb 120.18 2009/07/27 15:15:21 rojain ship $ */
3
4 g_pkg_name CONSTANT VARCHAR2(30) := 'PO_R12_CAT_UPG_PVT';
5 g_module_prefix CONSTANT VARCHAR2(100) := 'po.plsql.' || g_pkg_name || '.';
6
7 g_debug BOOLEAN := PO_R12_CAT_UPG_DEBUG.is_logging_enabled;
8 g_err_num NUMBER := PO_R12_CAT_UPG_PVT.g_application_err_num;
9
10 -- Value of IP_CATEGORY_ID column if no category mappings exist
11 g_NULL_IP_CATEGORY_ID CONSTANT NUMBER := -2;
12
13 PROCEDURE initialize_system_values
14 (
15 p_batch_id IN NUMBER
16 , p_batch_size IN NUMBER default 2500
17 , p_commit IN VARCHAR2 default FND_API.G_FALSE
18 , p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
19 );
20
21 PROCEDURE pre_process
22 (
23 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
24 );
25
26 PROCEDURE migrate_document_headers
27 (
28 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
29 );
30
31 PROCEDURE migrate_document_lines
32 (
33 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
34 );
35
36 PROCEDURE transfer_doc_headers
37 (
38 x_doc_headers_rec IN OUT NOCOPY record_of_headers_type
39 );
40
41 PROCEDURE insert_doc_headers
42 (
43 x_doc_headers_rec IN OUT NOCOPY record_of_headers_type
44 );
45
46 PROCEDURE update_doc_headers
47 (
48 p_doc_headers_rec IN record_of_headers_type
49 );
50
51 PROCEDURE delete_doc_headers
52 (
53 p_doc_headers_rec IN record_of_headers_type
54 );
55
56 PROCEDURE transfer_doc_lines
57 (
58 p_doc_lines_rec IN record_of_lines_type
59 );
60
61 PROCEDURE insert_doc_lines
62 (
63 p_doc_lines_rec IN record_of_lines_type
64 );
65
66 PROCEDURE update_doc_lines
67 (
68 p_doc_lines_rec IN record_of_lines_type
69 );
70
71 PROCEDURE delete_doc_lines
72 (
73 p_doc_lines_rec IN record_of_lines_type
74 );
75
76 PROCEDURE transfer_attributes
77 (
78 p_attrib_values_tbl IN record_of_attr_values_type
79 );
80
81 PROCEDURE insert_attributes
82 (
83 p_attr_values_tbl IN record_of_attr_values_type
84 );
85
86 PROCEDURE update_attributes
87 (
88 p_attr_values_tbl IN record_of_attr_values_type
89 );
90
91 PROCEDURE delete_attributes
92 (
93 p_attr_values_tbl IN record_of_attr_values_type
94 );
95
96 PROCEDURE transfer_attributes_tlp
97 (
98 p_attrib_tlp_values_tbl IN record_of_attr_values_tlp_type
99 );
100
101 PROCEDURE insert_attributes_tlp
102 (
103 p_attr_values_tlp_tbl IN record_of_attr_values_tlp_type
104 );
105
106 PROCEDURE update_attributes_tlp
107 (
108 p_attr_values_tlp_tbl IN record_of_attr_values_tlp_type
109 );
110
111 PROCEDURE delete_attributes_tlp
112 (
113 p_attr_values_tlp_tbl IN record_of_attr_values_tlp_type
114 );
115
116 PROCEDURE update_req_template_batch
117 (
118 p_rt_lines_rec IN record_of_rt_lines_type
119 );
120
121 --Bug 4865553: Start>
122 --------------------------------------------------------------------------------
123 --Start of Comments
124 --Name: update_ip_tables_hdr
125 --Pre-reqs:
126 -- The iP catalog data is populated in PO Interface tables.
127 --Modifies:
128 -- a) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
129 -- failed the migration.
130 -- c) FND_MSG_PUB on unhandled exceptions.
131 --Locks:
132 -- None.
133 --Function:
134 -- If all lines for a header have errors, then delete the header.
135 -- Clean up the header from the txn table.
136 -- This API should be called during the upgrade phase only.
137 --Parameters:
138 --IN:
139 --OUT:
140 --
141 --End of Comments
142 --------------------------------------------------------------------------------
143 PROCEDURE update_ip_tables_hdr
144 (
145 p_doc_headers_table RECORD_OF_HEADERS_TYPE
146 )
147 IS
148 l_api_name CONSTANT VARCHAR2(30) := 'update_ip_tables_hdr';
149 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
150 l_progress VARCHAR2(3) := '000';
151
152 l_return_status VARCHAR2(100);
153 l_intf_hdr_id_list DBMS_SQL.NUMBER_TABLE;
154 l_count NUMBER;
155 BEGIN
156 l_progress := '010';
157 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
158 IF g_debug THEN
159 IF (p_doc_headers_table.interface_header_id IS NOT NULL) THEN
160 PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_headers_table.COUNT='||p_doc_headers_table.interface_header_id.COUNT);
161 ELSE
162 PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_headers_table.interface_header_id IS NULL');
163 END IF;
164 END IF;
165
166 IF ( (p_doc_headers_table.interface_header_id IS NOT NULL) AND
167 (p_doc_headers_table.interface_header_id.COUNT > 0) ) THEN
168
169 -- Filter out the error records
170 l_count := 0;
171 FOR i IN 1..p_doc_headers_table.interface_header_id.COUNT
172 LOOP
173 IF (p_doc_headers_table.has_errors(i) <> 'Y') THEN
174 l_count := l_count + 1;
175 l_intf_hdr_id_list(l_count) := p_doc_headers_table.interface_header_id(i);
176 END IF;
177 END LOOP;
178
179 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of non-errored headers being sent to IP='||l_count); END IF;
180
181 IF (l_intf_hdr_id_list.COUNT > 0) THEN
182 ICX_CAT_R12_UPGRADE_GRP.updatePOHeaderId
183 (
184 p_api_version => 1.0 -- NUMBER IN
185 , p_commit => FND_API.G_TRUE -- VARCHAR2 IN DEFAULT
186 , p_init_msg_list => FND_API.G_TRUE -- VARCHAR2 IN DEFAULT
187 , p_validation_level => FND_API.G_VALID_LEVEL_FULL -- VARCHAR2 IN DEFAULT
188 , x_return_status => l_return_status -- VARCHAR2 OUT
189 , p_interface_header_id => l_intf_hdr_id_list -- TABLE OF NUMBER IN DBMS_SQL.NUMBER_TABLE
190 );
191 END IF;
192 END IF;
193
194 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
195 EXCEPTION
196 WHEN OTHERS THEN
197 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
198 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
199 END update_ip_tables_hdr;
200
201 --------------------------------------------------------------------------------
202 --Start of Comments
203 --Name: update_ip_tables_line
204 --Pre-reqs:
205 -- The iP catalog data is populated in PO Interface tables.
206 --Modifies:
207 -- a) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
208 -- failed the migration.
209 -- c) FND_MSG_PUB on unhandled exceptions.
210 --Locks:
211 -- None.
212 --Function:
213 -- If all lines for a header have errors, then delete the header.
214 -- Clean up the header from the txn table.
215 -- This API should be called during the upgrade phase only.
216 --Parameters:
217 --IN:
218 --OUT:
219 --
220 --End of Comments
221 --------------------------------------------------------------------------------
222 PROCEDURE update_ip_tables_line
223 (
224 p_doc_lines_table RECORD_OF_LINES_TYPE
225 )
226 IS
227 l_api_name CONSTANT VARCHAR2(30) := 'update_ip_tables_line';
228 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
229 l_progress VARCHAR2(3) := '000';
230
231 l_return_status VARCHAR2(100);
232 l_intf_line_id_list DBMS_SQL.NUMBER_TABLE;
233 l_count NUMBER;
234 BEGIN
235 l_progress := '010';
236 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
237 IF g_debug THEN
238 IF (p_doc_lines_table.interface_line_id IS NOT NULL) THEN
239 PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_lines_table.COUNT='||p_doc_lines_table.interface_line_id.COUNT);
240 ELSE
241 PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_lines_table.interface_line_id IS NULL');
242 END IF;
243 END IF;
244
245 IF ( (p_doc_lines_table.interface_line_id IS NOT NULL) AND
246 (p_doc_lines_table.interface_line_id.COUNT > 0) ) THEN
247
248 -- Filter out the error records
249 l_count := 0;
250 FOR i IN 1..p_doc_lines_table.interface_line_id.COUNT
251 LOOP
252 IF (p_doc_lines_table.has_errors(i) <> 'Y') THEN
253 l_count := l_count + 1;
254 l_intf_line_id_list(l_count) := p_doc_lines_table.interface_line_id(i);
255 END IF;
256 END LOOP;
257
258 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of non-errored lines being sent to IP='||l_count); END IF;
259
260 IF (l_intf_line_id_list.COUNT > 0) THEN
261 ICX_CAT_R12_UPGRADE_GRP.updatePOLineId
262 (
263 p_api_version => 1.0 -- NUMBER IN
264 , p_commit => FND_API.G_TRUE -- VARCHAR2 IN DEFAULT
265 , p_init_msg_list => FND_API.G_TRUE -- VARCHAR2 IN DEFAULT
266 , p_validation_level => FND_API.G_VALID_LEVEL_FULL -- VARCHAR2 IN DEFAULT
267 , x_return_status => l_return_status -- VARCHAR2 OUT
268 , p_interface_line_id => l_intf_line_id_list -- TABLE OF NUMBER IN DBMS_SQL.NUMBER_TABLE
269 );
270 END IF;
271 END IF;
272
273 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
274 EXCEPTION
275 WHEN OTHERS THEN
276 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
277 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
278 END update_ip_tables_line;
279 --Bug 4865553: End>
280
281 --------------------------------------------------------------------------------
282 --Start of Comments
283 --Name: cleanup_err_docs
284 --Pre-reqs:
285 -- The iP catalog data is populated in PO Interface tables.
286 --Modifies:
287 -- a) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
288 -- failed the migration.
289 -- c) FND_MSG_PUB on unhandled exceptions.
290 --Locks:
291 -- None.
292 --Function:
293 -- If all lines for a header have errors, then delete the header.
294 -- Clean up the header from the txn table.
295 -- This API should be called during the upgrade phase only.
296 --Parameters:
297 --IN:
298 --OUT:
299 --
300 --End of Comments
301 --------------------------------------------------------------------------------
302 PROCEDURE cleanup_err_docs
303 IS
304 l_api_name CONSTANT VARCHAR2(30) := 'cleanup_err_docs';
305 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
306 l_progress VARCHAR2(3) := '000';
307
308 -- SQL What: Cursor to load headers whose lines have all failed
309 -- SQL Why : To perform cleanup.
310 -- SQL Join: processing_id, process_code, po_header_id
311 CURSOR load_err_headers_csr(request_processing_id NUMBER) IS
312 SELECT intf_headers.interface_header_id,
313 intf_headers.po_header_id
314 FROM PO_HEADERS_INTERFACE intf_headers,
315 PO_HEADERS_ALL POH
316 WHERE intf_headers.processing_id = request_processing_id
317 AND intf_headers.process_code <> g_PROCESS_CODE_REJECTED
318 AND POH.po_header_id = intf_headers.po_header_id
319 AND NOT EXISTS
320 (SELECT 'At least one line in Txn tables'
321 FROM po_lines_all POL
322 WHERE POL.po_header_id = POH.po_header_id);
323
324 -- -- SQL What: Orphan PO Lines: Cursor to load PO lines for which the header
325 -- -- does not exist.
326 -- -- SQL Why : To perform cleanup.
327 -- -- SQL Join: processing_id, process_code, po_header_id
328 -- CURSOR load_orphan_lines_csr IS
329 -- SELECT POL.po_line_id
330 -- FROM PO_LINES_ALL POL
331 -- WHERE POL.created_by = g_R12_UPGRADE_USER
332 -- AND NOT EXISTS
333 -- (SELECT 'Corresponding PO Header exists'
334 -- FROM PO_HEADERS_ALL POH
335 -- WHERE POH.po_header_id = POL.po_header_id);
336 --
337 -- -- SQL What: Orphan PO Attr: Cursor to load PO Attr for which the Line
338 -- -- does not exist.
339 -- -- SQL Why : To perform cleanup.
340 -- -- SQL Join: processing_id, process_code, po_header_id
341 -- CURSOR load_orphan_attr_csr IS
342 -- SELECT POATTR.attribute_values_id
343 -- FROM PO_ATTRIBUTE_VALUES POATTR
344 -- WHERE POATTR.created_by = g_R12_UPGRADE_USER
345 -- AND NOT EXISTS
346 -- (SELECT 'Corresponding PO Line exists'
347 -- FROM PO_LINES_ALL POL
348 -- WHERE POL.po_line_id = POATTR.po_line_id);
349 --
350 -- -- SQL What: Orphan PO Attr TLP: Cursor to load PO Attr TLP for which the
351 -- -- Line does not exist.
352 -- -- SQL Why : To perform cleanup.
353 -- -- SQL Join: processing_id, process_code, po_header_id
354 -- CURSOR load_orphan_tlp_csr IS
355 -- SELECT POTLP.attribute_values_tlp_id
356 -- FROM PO_ATTRIBUTE_VALUES_TLP POTLP
357 -- WHERE POTLP.created_by = g_R12_UPGRADE_USER
358 -- AND NOT EXISTS
359 -- (SELECT 'Corresponding PO Line exists'
360 -- FROM PO_LINES_ALL POL
361 -- WHERE POL.po_line_id = POTLP.po_line_id);
362
363 l_interface_header_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
364 l_err_po_header_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
365 l_return_status VARCHAR2(100);
366 l_intf_hdr_id_list DBMS_SQL.NUMBER_TABLE;
367 BEGIN
368 l_progress := '010';
369 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
370 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'g_processing_id='||g_processing_id); END IF;
371
372 IF ( (g_processing_id IS NULL) OR
373 (g_processing_id <= 0)) THEN
374 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'g_processing_id is invalid. Early return...'); END IF;
375 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
376 RETURN;
377 END IF;
378
379 OPEN load_err_headers_csr(g_processing_id);
380
381 l_progress := '020';
382 LOOP
383 BEGIN -- block to handle SNAPSHOT_TOO_OLD exception
384 l_progress := '025';
385
386 FETCH load_err_headers_csr
387 BULK COLLECT INTO l_interface_header_ids, l_err_po_header_ids
388 LIMIT g_job.batch_size;
389
390 l_progress := '030';
391 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_interface_header_ids.COUNT='||l_interface_header_ids.COUNT); END IF;
392
393 EXIT WHEN l_interface_header_ids.COUNT = 0;
394
395 l_progress := '040';
396 -- Record error message in interface errors table
397 -- Insert record in interface_errors_table
398 FOR i IN 1.. l_interface_header_ids.COUNT
399 LOOP
400 -- Note: Exceptions pages should not show this message (Action for IP IDC).
401 PO_R12_CAT_UPG_UTL.add_fatal_error(
402 p_interface_header_id => l_interface_header_ids(i),
403 --p_error_message_name => 'PO_CAT_UPG_ALL_LINES_FAILED',
404 p_error_message_name => 'ICX_CAT_UPG_ALL_LINES_FAILED',
405 p_table_name => 'PO_HEADERS_INTERFACE',
406 p_column_name => 'PO_HEADER_ID',
407 p_column_value => l_err_po_header_ids(i)
408 );
409 END LOOP;
410
411 l_progress := '050';
412 -- SQL What: Update process_code and processing_id in interface_table
413 -- SQL Why : To mark them as error rows
414 -- SQL Join: interface_header_id
415 FORALL i IN 1.. l_interface_header_ids.COUNT
416 UPDATE po_headers_interface headers
417 SET process_code = g_PROCESS_CODE_REJECTED,
418 processing_id = -processing_id,
419 po_header_id = NULL -- Bug 4865553: Null out the PO_HEADER_ID before calling IP's API
420 WHERE interface_header_id = l_interface_header_ids(i);
421
422 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of records marked as error in headers interface='||SQL%rowcount); END IF;
423
424 l_progress := '060';
425 -- SQL What: Delete header from txn tables
426 -- SQL Why : To cleanup corrupt data
427 -- SQL Join: po_header_id
428 FORALL i IN 1.. l_err_po_header_ids.COUNT
429 DELETE FROM PO_HEADERS_ALL
430 WHERE po_header_id = l_err_po_header_ids(i);
431
432 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of records deleted from txn Headers='||SQL%rowcount); END IF;
433
434 l_progress := '070';
435 COMMIT;
436
437 --<Bug 4865553: Start>
438 IF (l_interface_header_ids.COUNT > 0) THEN
439 -- Copy the list into the DBMS_SQL.NUMBER_TABLE type required by IP
440 FOR i IN 1.. l_interface_header_ids.COUNT LOOP
441 l_intf_hdr_id_list(i) := l_interface_header_ids(i);
442 END LOOP;
443
444 ICX_CAT_R12_UPGRADE_GRP.updatePOHeaderId
445 (
446 p_api_version => 1.0 -- NUMBER IN
447 , p_commit => FND_API.G_TRUE -- VARCHAR2 IN DEFAULT
448 , p_init_msg_list => FND_API.G_TRUE -- VARCHAR2 IN DEFAULT
449 , p_validation_level => FND_API.G_VALID_LEVEL_FULL -- VARCHAR2 IN DEFAULT
450 , x_return_status => l_return_status -- VARCHAR2 OUT
451 , p_interface_header_id => l_intf_hdr_id_list -- TABLE OF NUMBER IN DBMS_SQL.NUMBER_TABLE
452 );
453 END IF;
454 --<Bug 4865553: End>
455
456 IF (l_interface_header_ids.COUNT < g_job.batch_size) THEN
457 EXIT;
458 END IF;
459 EXCEPTION
460 WHEN g_SNAPSHOT_TOO_OLD THEN
461 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'EXCEPTION: SNAPSHOT_TOO_OLD. Now commiting and re-opening the load_err_headers_csr'); END IF;
462
463 -- Commit and re-open the cursor
464 l_progress := '080';
465 COMMIT;
466
467 l_progress := '090';
468 CLOSE load_err_headers_csr;
469
470 l_progress := '100';
471 OPEN load_err_headers_csr(g_processing_id);
472 l_progress := '110';
473 END; -- block to handle SNAPSHOT_TOO_OLD exception
474 END LOOP; -- batch loop
475
476 l_progress := '120';
477
478 IF (load_err_headers_csr%ISOPEN) THEN
479 CLOSE load_err_headers_csr;
480 END IF;
481
482 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
483 EXCEPTION
484 WHEN OTHERS THEN
485 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
486 IF (load_err_headers_csr%ISOPEN) THEN
487 CLOSE load_err_headers_csr;
488 END IF;
489 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
490 END cleanup_err_docs;
491
492 --------------------------------------------------------------------------------
493 --Start of Comments
494 --Name: migrate_documents
495 --Pre-reqs:
496 -- The iP catalog data is populated in PO Interface tables.
497 --Modifies:
498 -- a) PO Interface Tables (inserts new po_header_id for successful rows,
499 -- back to the Interface tables.
500 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
501 -- failed the migration.
502 -- c) FND_MSG_PUB on unhandled exceptions.
503 --Locks:
504 -- None.
505 --Function:
506 -- Migrate the iP Catalog Data related to PO Documents (GBPA, BPA and
507 -- Quotations). This API should be called during the upgrade phase only.
508 --Parameters:
509 --IN:
510 --p_batch_id
511 -- Batch ID to identify the data in interface tables that needs to be
512 -- migrated.
513 --p_batch_size
514 -- The maximum number of rows that should be processed at a time, to avoid
515 -- exceeding rollback segment. The transaction would be committed after
516 -- processing each batch.
517 --p_validate_only_mode
518 -- Indicates if the API is being called in a Validate Only mode or not
519 --OUT:
520 --x_return_status
521 -- Apps API Std
522 -- FND_API.g_ret_sts_success - if the procedure completed successfully
523 -- FND_API.g_ret_sts_error - if an error occurred
524 -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
525 --x_msg_count
526 -- Apps API Std
527 -- The number of error messages returned in the FND error stack in case
528 -- x_return_status returned FND_API.G_RET_STS_ERROR or
529 -- FND_API.G_RET_STS_UNEXP_ERROR
530 --x_msg_data
531 -- Apps API Std
532 -- Contains error msg in case x_return_status returned
533 -- FND_API.G_RET_STS_ERROR or FND_API.G_RET_STS_UNEXP_ERROR
534 --
535 --End of Comments
536 --------------------------------------------------------------------------------
537 PROCEDURE migrate_documents
538 (
539 p_batch_id IN NUMBER
540 , p_batch_size IN NUMBER default 2500
541 , p_commit IN VARCHAR2 default FND_API.G_FALSE
542 , p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
543 , x_return_status OUT NOCOPY VARCHAR2
544 , x_msg_count OUT NOCOPY NUMBER
545 , x_msg_data OUT NOCOPY VARCHAR2
546 )
547 IS
548 l_api_name CONSTANT VARCHAR2(30) := 'migrate_documents';
549 l_api_version CONSTANT NUMBER := 1.0;
550 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
551 l_progress VARCHAR2(3) := '000';
552 l_return_status VARCHAR2(1);
553 BEGIN
554 l_progress := '010';
555 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
556
557 -- Initialize API return status to success
558 x_return_status := FND_API.G_RET_STS_SUCCESS;
559
560 l_progress := '010';
561 -- Initializes the global variables to hold input parameters.
562 -- Initializes startup values by calling PO_CORE_S.get_po_parameters().
563 -- Sets the global variable of g_processing_id from a sequence.
564 initialize_system_values(
565 p_batch_id => p_batch_id
566 , p_commit => p_commit
567 , p_batch_size => p_batch_size
568 , p_validate_only_mode => p_validate_only_mode);
569
570 l_progress := '020';
571 -- Pre-process the interface table data. Assign processing_ids, validates
572 -- ACTION, validate if document already exists (for UPDATE cases), etc. Some
573 -- of it will be rejected in pre-processing itself.
574 pre_process(p_validate_only_mode => p_validate_only_mode);
575
576 l_progress := '030';
577 -- Migrate headers
578 migrate_document_headers(p_validate_only_mode => p_validate_only_mode);
579
580 l_progress := '040';
581 -- Migrate lines
582 migrate_document_lines(p_validate_only_mode => p_validate_only_mode);
583
584 l_progress := '050';
585 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
586 EXCEPTION
587 WHEN OTHERS THEN
588 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
589 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
590 END migrate_documents;
591
592 --------------------------------------------------------------------------------
593 --Start of Comments
594 --Name: initialize_system_values
595 --Pre-reqs:
596 -- The iP catalog data is populated in PO Interface tables.
597 --Modifies:
598 -- a) FND_MSG_PUB on unhandled exceptions.
599 --Locks:
600 -- None.
601 --Function:
602 -- Initializes the PDOI engine:
603 -- * Initializes errors table.
604 -- * Sets the batch_id and batch_size into PDOI global variables
605 -- * Sets startup values (system parameters, profile values, etc.)
606 -- * Initializes the counts to zero (success rows count, failed rows count).
607 -- * Fetches the next processing_id from sequence.
608 -- This API should be called during the upgrade phase only.
609 --Parameters:
610 --IN:
611 --p_batch_id
612 -- Batch ID to identify the data in interface tables that needs to be migrated.
613 --p_batch_size
614 -- The maximum number of rows that should be processed at a time, to avoid
615 -- exceeding rollback segment. The transaction would be committed after
616 -- processing each batch.
617 --p_validate_only_mode
618 -- Indicates if the API is being called in a Validate Only mode or not
619 --OUT:
620 -- None
621 --End of Comments
622 --------------------------------------------------------------------------------
623 PROCEDURE initialize_system_values
624 (
625 p_batch_id IN NUMBER
626 , p_batch_size IN NUMBER default 2500
627 , p_commit IN VARCHAR2 default FND_API.G_FALSE
628 , p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
629 )
630 IS
631 l_api_name CONSTANT VARCHAR2(30) := 'initialize_system_values';
632 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
633 l_progress VARCHAR2(3) := '000';
634 BEGIN
635 l_progress := '010';
636 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
637
638 PO_R12_CAT_UPG_UTL.init_startup_values
639 ( p_commit => p_commit,
640 p_selected_batch_id => p_batch_id,
641 p_batch_size => p_batch_size,
642 p_buyer_id => NULL,
643 p_document_type => NULL,
644 p_document_subtype => NULL,
645 p_create_items => NULL,
646 p_create_sourcing_rules_flag => NULL,
647 p_rel_gen_method => NULL,
648 p_approved_status => NULL,
649 p_process_code => NULL,
650 p_interface_header_id => NULL,
651 p_org_id => NULL, -- TODO: call MOAC API to get the current org id
652 p_ga_flag => NULL,
653 p_role => NULL,
654 p_error_threshold => NULL,
655 p_validate_only_mode => p_validate_only_mode
656 );
657
658 l_progress := '020';
659 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
660 EXCEPTION
661 WHEN OTHERS THEN
662 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
663 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
664 END initialize_system_values;
665
666 --------------------------------------------------------------------------------
667 --Start of Comments
668 --Name: pre_process
669 --Pre-reqs:
670 -- The iP catalog data is populated in PO Interface tables.
671 --Modifies:
672 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
673 -- to the Interface tables.
674 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
675 -- failed the migration.
676 -- c) FND_MSG_PUB on unhandled exceptions.
677 --Locks:
678 -- None.
679 --Function:
680 -- This procedure is a copy of the following PDOI procedure:
681 -- PO_PREPROC_PVT.process
682 -- It executes only a subset of actions that are required for the Catalog Upgrade.
683 --
684 -- Performs some pre-processing tasks on the interface data:
685 -- * Assigns processing ID's to the interface tables.
686 -- * Validates interface data for ORIGINAL or ADD actions (same as CREATE)
687 -- * Validates interface data for UPDATE action
688 -- * Validates interface data for DELETE action
689 -- * Flushes errors table.
690 -- * Commits transaction.
691 --
692 -- This API should be called during the upgrade phase only.
693 --Parameters:
694 --IN:
695 --p_validate_only_mode
696 -- Indicates if the API is being called in a Validate Only mode or not
697 --OUT:
698 -- None
699 --End of Comments
700 --------------------------------------------------------------------------------
701 PROCEDURE pre_process
702 (
703 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
704 )
705 IS
706 l_api_name CONSTANT VARCHAR2(30) := 'pre_process';
707 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
708 l_progress VARCHAR2(3) := '000';
709 BEGIN
710 l_progress := '010';
711 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
712
713 -- Updates all records that will be processed by the current request with a
714 -- single processing_id. Each time PDOI is called, a new processing_id is
715 -- generated. All operations afterwards will only look at records with this
716 -- processing id.
717
718 PO_R12_CAT_UPG_UTL.assign_processing_id;
719
720 l_progress := '020';
721 -- Migration specific validations. Reject invalid rows upfront so that we
722 -- avoid called derive+default+validate on these rows. There procedures
723 -- validate at all levels - header, line, attribute and TLP levels
724
725 -- Bug 5389286: Commented out the 'integration-time-only' validations.
726 -- We dont need them anymore, as we are in xbuild#7 now, and the
727 -- integration flows have all been tested between PO and IP for
728 -- this program.
729 --PO_R12_CAT_UPG_VAL_PVT.validate_create_action
730 -- (p_validate_only_mode => p_validate_only_mode);
731 --
732 --l_progress := '030';
733 --PO_R12_CAT_UPG_VAL_PVT.validate_add_action
734 -- (p_validate_only_mode => p_validate_only_mode);
735 --
736 --l_progress := '040';
737 --PO_R12_CAT_UPG_VAL_PVT.validate_update_action
738 -- (p_validate_only_mode => p_validate_only_mode);
739 --
740 --l_progress := '050';
741 --PO_R12_CAT_UPG_VAL_PVT.validate_delete_action
742 -- (p_validate_only_mode => p_validate_only_mode);
743 -- Bug 5389286: End
744
745 l_progress := '060';
746 COMMIT;
747
748 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
749 EXCEPTION
750 WHEN OTHERS THEN
751 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
752 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
753 END pre_process;
754
755 --------------------------------------------------------------------------------
756 --Start of Comments
757 --Name: migrate_document_headers
758 --Pre-reqs:
759 -- The iP catalog data is populated in PO Interface tables.
760 --Modifies:
761 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
762 -- to the Interface tables.
763 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
764 -- failed the migration.
765 -- c) FND_MSG_PUB on unhandled exceptions.
766 --Locks:
767 -- None.
768 --Function:
769 -- Migrate the document headers for GBPA/BPA/Quotations.
770 -- This API should be called during the upgrade phase only.
771 --Parameters:
772 --IN:
773 --p_validate_only_mode
774 -- Indicates if the API is being called in a Validate Only mode or not
775 --OUT:
776 --
777 --End of Comments
778 --------------------------------------------------------------------------------
779 PROCEDURE migrate_document_headers
780 (
781 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
782 )
783 IS
784 l_api_name CONSTANT VARCHAR2(30) := 'migrate_document_headers';
785 l_api_version CONSTANT NUMBER := 1.0;
786 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
787 l_progress VARCHAR2(3) := '000';
788 l_return_status VARCHAR2(1);
789
790 -- SQL What: Cursor to load headers
791 -- SQL Why : To migrate data to PO txn tables
792 -- SQL Join: processing_id, action
793 CURSOR load_headers_csr(request_processing_id NUMBER) IS
794 SELECT headers.interface_header_id,
795 headers.batch_id,
796 headers.interface_source_code,
797 headers.process_code,
798 headers.action,
799 headers.group_code,
800 headers.org_id,
801 headers.document_type_code,
802 headers.document_subtype,
803 headers.document_num,
804 headers.po_header_id,
805 headers.release_num,
806 headers.po_release_id,
807 headers.release_date,
808 headers.currency_code,
809 headers.rate_type,
810 headers.rate_type_code,
811 headers.rate_date,
812 headers.rate,
813 headers.agent_name,
814 headers.agent_id,
815 headers.vendor_name,
816 headers.vendor_id,
817 headers.vendor_site_code,
818 headers.vendor_site_id,
819 headers.vendor_contact,
820 headers.vendor_contact_id,
821 headers.ship_to_location,
822 headers.ship_to_location_id,
823 headers.bill_to_location,
824 headers.bill_to_location_id,
825 headers.payment_terms,
826 headers.terms_id,
827 headers.freight_carrier,
828 headers.fob,
829 headers.freight_terms,
830 headers.approval_status,
831 headers.approved_date,
832 headers.revised_date,
833 headers.revision_num,
834 headers.note_to_vendor,
835 headers.note_to_receiver,
836 headers.confirming_order_flag,
837 headers.comments,
838 headers.acceptance_required_flag,
839 headers.acceptance_due_date,
840 headers.amount_agreed,
841 headers.amount_limit,
842 headers.min_release_amount,
843 headers.effective_date,
844 headers.expiration_date,
845 headers.print_count,
846 headers.printed_date,
847 headers.firm_flag,
848 headers.frozen_flag,
849 headers.closed_code,
850 headers.closed_date,
851 headers.reply_date,
852 headers.reply_method,
853 headers.rfq_close_date,
854 headers.quote_warning_delay,
855 headers.vendor_doc_num,
856 headers.approval_required_flag,
857 headers.vendor_list,
858 headers.vendor_list_header_id,
859 headers.from_header_id,
860 headers.from_type_lookup_code,
861 headers.ussgl_transaction_code,
862 headers.attribute_category,
863 headers.attribute1,
864 headers.attribute2,
865 headers.attribute3,
866 headers.attribute4,
867 headers.attribute5,
868 headers.attribute6,
869 headers.attribute7,
870 headers.attribute8,
871 headers.attribute9,
872 headers.attribute10,
873 headers.attribute11,
874 headers.attribute12,
875 headers.attribute13,
876 headers.attribute14,
877 headers.attribute15,
878 headers.creation_date,
879 headers.created_by,
880 headers.last_update_date,
881 headers.last_updated_by,
882 headers.last_update_login,
883 headers.request_id,
884 headers.program_application_id,
885 headers.program_id,
886 headers.program_update_date,
887 headers.reference_num,
888 headers.load_sourcing_rules_flag,
889 headers.vendor_num,
890 headers.from_rfq_num,
891 headers.wf_group_id,
892 headers.pcard_id,
893 headers.pay_on_code,
894 headers.global_agreement_flag,
895 headers.consume_req_demand_flag,
896 NULL, --headers.shipping_control, TODO: Not present in 11.5.9
897 NULL, --headers.amount_to_encumber, TODO: Not present in 11.5.9
898 NULL, --headers.change_summary, TODO: Not present in 11.5.9
899 NULL, --headers.budget_account_segment1, TODO: Not present in 11.5.9
900 NULL, --headers.budget_account_segment2, TODO: Not present in 11.5.9
901 NULL, --headers.budget_account_segment3, TODO: Not present in 11.5.9
902 NULL, --headers.budget_account_segment4, TODO: Not present in 11.5.9
903 NULL, --headers.budget_account_segment5, TODO: Not present in 11.5.9
904 NULL, --headers.budget_account_segment6, TODO: Not present in 11.5.9
905 NULL, --headers.budget_account_segment7, TODO: Not present in 11.5.9
906 NULL, --headers.budget_account_segment8, TODO: Not present in 11.5.9
907 NULL, --headers.budget_account_segment9, TODO: Not present in 11.5.9
908 NULL, --headers.budget_account_segment10, TODO: Not present in 11.5.9
909 NULL, --headers.budget_account_segment11, TODO: Not present in 11.5.9
910 NULL, --headers.budget_account_segment12, TODO: Not present in 11.5.9
911 NULL, --headers.budget_account_segment13, TODO: Not present in 11.5.9
912 NULL, --headers.budget_account_segment14, TODO: Not present in 11.5.9
913 NULL, --headers.budget_account_segment15, TODO: Not present in 11.5.9
914 NULL, --headers.budget_account_segment16, TODO: Not present in 11.5.9
915 NULL, --headers.budget_account_segment17, TODO: Not present in 11.5.9
916 NULL, --headers.budget_account_segment18, TODO: Not present in 11.5.9
917 NULL, --headers.budget_account_segment19, TODO: Not present in 11.5.9
918 NULL, --headers.budget_account_segment20, TODO: Not present in 11.5.9
919 NULL, --headers.budget_account_segment21, TODO: Not present in 11.5.9
920 NULL, --headers.budget_account_segment22, TODO: Not present in 11.5.9
921 NULL, --headers.budget_account_segment23, TODO: Not present in 11.5.9
922 NULL, --headers.budget_account_segment24, TODO: Not present in 11.5.9
923 NULL, --headers.budget_account_segment25, TODO: Not present in 11.5.9
924 NULL, --headers.budget_account_segment26, TODO: Not present in 11.5.9
925 NULL, --headers.budget_account_segment27, TODO: Not present in 11.5.9
926 NULL, --headers.budget_account_segment28, TODO: Not present in 11.5.9
927 NULL, --headers.budget_account_segment29, TODO: Not present in 11.5.9
928 NULL, --headers.budget_account_segment30, TODO: Not present in 11.5.9
929 NULL, --headers.budget_account, TODO: Not present in 11.5.9
930 NULL, --headers.budget_account_id, TODO: Not present in 11.5.9
931 NULL, --headers.gl_encumbered_date, TODO: Not present in 11.5.9
932 NULL, --headers.gl_encumbered_period_name, TODO: Not present in 11.5.9
933 NULL, --headers.style_id, TODO: Not present in 11.5.9
934 NULL, --headers.draft_id, TODO: Not present in 11.5.9
935 headers.processing_id,
936 NULL, --headers.processing_round_num, TODO: Not present in 11.5.9
937 NULL, --headers.original_po_header_id, TODO: Not present in 11.5.9
938 headers.created_language,
939 headers.cpa_reference,
940 'N' -- has_errors
941 FROM po_headers_interface headers
942 WHERE headers.processing_id = request_processing_id
943 AND headers.process_code = PO_R12_CAT_UPG_PVT.g_PROCESS_CODE_NEW
944 AND headers.action IN (PO_R12_CAT_UPG_PVT.g_action_header_create, 'UPDATE', 'DELETE');
945
946 l_doc_headers_table record_of_headers_type;
947 l_err_interface_header_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
948 l_count NUMBER := NULL;
949 BEGIN
950 l_progress := '010';
951 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
952
953 -- Algorithm:
954 -- 1. Load Headers batch (batch_size) into pl/sql table.
955 -- 2. Call PDOI modules to process data in batches (default, derive, validate).
956 -- 3. Get the validated pl/sql table for the batch from PDOI.
957 -- 4. Transfer directly to Transaction tables
958
959 OPEN load_headers_csr(g_processing_id);
960
961 l_progress := '020';
962 LOOP
963 BEGIN -- block to handle SNAPSHOT_TOO_OLD exception
964 l_progress := '025';
965 FETCH load_headers_csr BULK COLLECT INTO
966 l_doc_headers_table.interface_header_id,
967 l_doc_headers_table.batch_id,
968 l_doc_headers_table.interface_source_code,
969 l_doc_headers_table.process_code,
970 l_doc_headers_table.action,
971 l_doc_headers_table.group_code,
972 l_doc_headers_table.org_id,
973 l_doc_headers_table.document_type_code,
974 l_doc_headers_table.document_subtype,
975 l_doc_headers_table.document_num,
976 l_doc_headers_table.po_header_id,
977 l_doc_headers_table.release_num,
978 l_doc_headers_table.po_release_id,
979 l_doc_headers_table.release_date,
980 l_doc_headers_table.currency_code,
981 l_doc_headers_table.rate_type,
982 l_doc_headers_table.rate_type_code,
983 l_doc_headers_table.rate_date,
984 l_doc_headers_table.rate,
985 l_doc_headers_table.agent_name,
986 l_doc_headers_table.agent_id,
987 l_doc_headers_table.vendor_name,
988 l_doc_headers_table.vendor_id,
989 l_doc_headers_table.vendor_site_code,
990 l_doc_headers_table.vendor_site_id,
991 l_doc_headers_table.vendor_contact,
992 l_doc_headers_table.vendor_contact_id,
993 l_doc_headers_table.ship_to_location,
994 l_doc_headers_table.ship_to_location_id,
995 l_doc_headers_table.bill_to_location,
996 l_doc_headers_table.bill_to_location_id,
997 l_doc_headers_table.payment_terms,
998 l_doc_headers_table.terms_id,
999 l_doc_headers_table.freight_carrier,
1000 l_doc_headers_table.fob,
1001 l_doc_headers_table.freight_terms,
1002 l_doc_headers_table.approval_status,
1003 l_doc_headers_table.approved_date,
1004 l_doc_headers_table.revised_date,
1005 l_doc_headers_table.revision_num,
1006 l_doc_headers_table.note_to_vendor,
1007 l_doc_headers_table.note_to_receiver,
1008 l_doc_headers_table.confirming_order_flag,
1009 l_doc_headers_table.comments,
1010 l_doc_headers_table.acceptance_required_flag,
1011 l_doc_headers_table.acceptance_due_date,
1012 l_doc_headers_table.amount_agreed,
1013 l_doc_headers_table.amount_limit,
1014 l_doc_headers_table.min_release_amount,
1015 l_doc_headers_table.effective_date,
1016 l_doc_headers_table.expiration_date,
1017 l_doc_headers_table.print_count,
1018 l_doc_headers_table.printed_date,
1019 l_doc_headers_table.firm_flag,
1020 l_doc_headers_table.frozen_flag,
1021 l_doc_headers_table.closed_code,
1022 l_doc_headers_table.closed_date,
1023 l_doc_headers_table.reply_date,
1024 l_doc_headers_table.reply_method,
1025 l_doc_headers_table.rfq_close_date,
1026 l_doc_headers_table.quote_warning_delay,
1027 l_doc_headers_table.vendor_doc_num,
1028 l_doc_headers_table.approval_required_flag,
1029 l_doc_headers_table.vendor_list,
1030 l_doc_headers_table.vendor_list_header_id,
1031 l_doc_headers_table.from_header_id,
1032 l_doc_headers_table.from_type_lookup_code,
1033 l_doc_headers_table.ussgl_transaction_code,
1034 l_doc_headers_table.attribute_category,
1035 l_doc_headers_table.attribute1,
1036 l_doc_headers_table.attribute2,
1037 l_doc_headers_table.attribute3,
1038 l_doc_headers_table.attribute4,
1039 l_doc_headers_table.attribute5,
1040 l_doc_headers_table.attribute6,
1041 l_doc_headers_table.attribute7,
1042 l_doc_headers_table.attribute8,
1043 l_doc_headers_table.attribute9,
1044 l_doc_headers_table.attribute10,
1045 l_doc_headers_table.attribute11,
1046 l_doc_headers_table.attribute12,
1047 l_doc_headers_table.attribute13,
1048 l_doc_headers_table.attribute14,
1049 l_doc_headers_table.attribute15,
1050 l_doc_headers_table.creation_date,
1051 l_doc_headers_table.created_by,
1052 l_doc_headers_table.last_update_date,
1053 l_doc_headers_table.last_updated_by,
1054 l_doc_headers_table.last_update_login,
1055 l_doc_headers_table.request_id,
1056 l_doc_headers_table.program_application_id,
1057 l_doc_headers_table.program_id,
1058 l_doc_headers_table.program_update_date,
1059 l_doc_headers_table.reference_num,
1060 l_doc_headers_table.load_sourcing_rules_flag,
1061 l_doc_headers_table.vendor_num,
1062 l_doc_headers_table.from_rfq_num,
1063 l_doc_headers_table.wf_group_id,
1064 l_doc_headers_table.pcard_id,
1065 l_doc_headers_table.pay_on_code,
1066 l_doc_headers_table.global_agreement_flag,
1067 l_doc_headers_table.consume_req_demand_flag,
1068 l_doc_headers_table.shipping_control, --TODO: Not present in 11.5.9
1069 l_doc_headers_table.amount_to_encumber, --TODO: Not present in 11.5.9
1070 l_doc_headers_table.change_summary, --TODO: Not present in 11.5.9
1071 l_doc_headers_table.budget_account_segment1, --TODO: Not present in 11.5.9
1072 l_doc_headers_table.budget_account_segment2, --TODO: Not present in 11.5.9
1073 l_doc_headers_table.budget_account_segment3, --TODO: Not present in 11.5.9
1074 l_doc_headers_table.budget_account_segment4, --TODO: Not present in 11.5.9
1075 l_doc_headers_table.budget_account_segment5, --TODO: Not present in 11.5.9
1076 l_doc_headers_table.budget_account_segment6, --TODO: Not present in 11.5.9
1077 l_doc_headers_table.budget_account_segment7, --TODO: Not present in 11.5.9
1078 l_doc_headers_table.budget_account_segment8, --TODO: Not present in 11.5.9
1079 l_doc_headers_table.budget_account_segment9, --TODO: Not present in 11.5.9
1080 l_doc_headers_table.budget_account_segment10, --TODO: Not present in 11.5.9
1081 l_doc_headers_table.budget_account_segment11, --TODO: Not present in 11.5.9
1082 l_doc_headers_table.budget_account_segment12, --TODO: Not present in 11.5.9
1083 l_doc_headers_table.budget_account_segment13, --TODO: Not present in 11.5.9
1084 l_doc_headers_table.budget_account_segment14, --TODO: Not present in 11.5.9
1085 l_doc_headers_table.budget_account_segment15, --TODO: Not present in 11.5.9
1086 l_doc_headers_table.budget_account_segment16, --TODO: Not present in 11.5.9
1087 l_doc_headers_table.budget_account_segment17, --TODO: Not present in 11.5.9
1088 l_doc_headers_table.budget_account_segment18, --TODO: Not present in 11.5.9
1089 l_doc_headers_table.budget_account_segment19, --TODO: Not present in 11.5.9
1090 l_doc_headers_table.budget_account_segment20, --TODO: Not present in 11.5.9
1091 l_doc_headers_table.budget_account_segment21, --TODO: Not present in 11.5.9
1092 l_doc_headers_table.budget_account_segment22, --TODO: Not present in 11.5.9
1093 l_doc_headers_table.budget_account_segment23, --TODO: Not present in 11.5.9
1094 l_doc_headers_table.budget_account_segment24, --TODO: Not present in 11.5.9
1095 l_doc_headers_table.budget_account_segment25, --TODO: Not present in 11.5.9
1096 l_doc_headers_table.budget_account_segment26, --TODO: Not present in 11.5.9
1097 l_doc_headers_table.budget_account_segment27, --TODO: Not present in 11.5.9
1098 l_doc_headers_table.budget_account_segment28, --TODO: Not present in 11.5.9
1099 l_doc_headers_table.budget_account_segment29, --TODO: Not present in 11.5.9
1100 l_doc_headers_table.budget_account_segment30, --TODO: Not present in 11.5.9
1101 l_doc_headers_table.budget_account, --TODO: Not present in 11.5.9
1102 l_doc_headers_table.budget_account_id, --TODO: Not present in 11.5.9
1103 l_doc_headers_table.gl_encumbered_date, --TODO: Not present in 11.5.9
1104 l_doc_headers_table.gl_encumbered_period_name, --TODO: Not present in 11.5.9
1105 l_doc_headers_table.style_id, --TODO: Not present in 11.5.9
1106 l_doc_headers_table.draft_id, --TODO: Not present in 11.5.9
1107 l_doc_headers_table.processing_id,
1108 l_doc_headers_table.processing_round_num, --TODO: Not present in 11.5.9
1109 l_doc_headers_table.original_po_header_id, --TODO: Not present in 11.5.9
1110 l_doc_headers_table.created_language,
1111 l_doc_headers_table.cpa_reference,
1112 l_doc_headers_table.has_errors
1113 LIMIT g_job.batch_size;
1114
1115 l_progress := '030';
1116
1117 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_doc_headers_table.interface_header_id.COUNT='||l_doc_headers_table.interface_header_id.COUNT); END IF;
1118
1119 IF (l_doc_headers_table.interface_header_id.COUNT > 0) THEN
1120 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_doc_headers_table.po_header_id(1)='||l_doc_headers_table.po_header_id(1)); END IF;
1121 END IF;
1122
1123 EXIT WHEN l_doc_headers_table.interface_header_id.COUNT = 0;
1124
1125 l_progress := '040';
1126
1127 -- The derive+default+validate modules are being re-used from PDOI
1128 -- derive logic
1129 --PO_PROCESS_HEADER_PVT.derive_headers(l_doc_headers_table);
1130
1131 l_progress := '050';
1132 -- default logic
1133 PO_R12_CAT_UPG_DEF_PVT.default_headers(l_doc_headers_table);
1134
1135 l_progress := '060';
1136 -- validate logic
1137 PO_R12_CAT_UPG_VAL_PVT.validate_headers(l_doc_headers_table);
1138
1139 l_progress := '070';
1140 -- Skip transfer if running in Validate Only mode.
1141 IF (p_validate_only_mode = FND_API.G_FALSE) THEN
1142 -- Transfer Headers
1143 transfer_doc_headers(x_doc_headers_rec => l_doc_headers_table);
1144
1145 l_progress := '080';
1146 -- cascade rejected status to lines and other levels
1147 l_count := 0;
1148 FOR i IN 1..l_doc_headers_table.interface_header_id.COUNT
1149 LOOP
1150 IF (l_doc_headers_table.has_errors(i) = 'Y') THEN
1151 l_count := l_count + 1;
1152 l_err_interface_header_ids(l_count) := l_doc_headers_table.interface_header_id(i);
1153 END IF;
1154 END LOOP;
1155
1156 l_progress := '110';
1157 IF (l_count > 0) THEN
1158 PO_R12_CAT_UPG_UTL.reject_headers_intf
1159 (p_id_param_type => 'INTERFACE_HEADER_ID',
1160 p_id_tbl => l_err_interface_header_ids,
1161 p_cascade => FND_API.G_TRUE);
1162 END IF;
1163
1164 END IF; -- IF (p_validate_only_mode = FND_API.G_FALSE)
1165
1166 l_progress := '120';
1167 COMMIT;
1168
1169 -- Call IP's API to update the header ID in IP's tables
1170 update_ip_tables_hdr
1171 (
1172 p_doc_headers_table => l_doc_headers_table
1173 );
1174
1175 l_progress := '130';
1176 IF (l_doc_headers_table.interface_header_id.COUNT
1177 < g_job.batch_size) THEN
1178 EXIT;
1179 END IF;
1180 l_progress := '140';
1181 EXCEPTION
1182 WHEN g_SNAPSHOT_TOO_OLD THEN
1183 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'EXCEPTION: SNAPSHOT_TOO_OLD. Now commiting and re-opening the load_headers_csr'); END IF;
1184
1185 -- Commit and re-open the cursor
1186 l_progress := '150';
1187 COMMIT;
1188
1189 l_progress := '160';
1190 CLOSE load_headers_csr;
1191
1192 l_progress := '170';
1193 OPEN load_headers_csr(g_processing_id);
1194 l_progress := '180';
1195 END; -- block to handle SNAPSHOT_TOO_OLD exception
1196 END LOOP;
1197
1198 l_progress := '190';
1199 IF (load_headers_csr%ISOPEN) THEN
1200 CLOSE load_headers_csr;
1201 END IF;
1202
1203 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
1204 EXCEPTION
1205 WHEN OTHERS THEN
1206 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
1207 IF (load_headers_csr%ISOPEN) THEN
1208 CLOSE load_headers_csr;
1209 END IF;
1210 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
1211 END migrate_document_headers;
1212
1213 --------------------------------------------------------------------------------
1214 --Start of Comments
1215 --Name: transfer_doc_headers
1216 --Pre-reqs:
1217 -- The iP catalog data is populated in PO Interface tables.
1218 --Modifies:
1219 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
1220 -- to the Interface tables.
1221 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
1222 -- failed the migration.
1223 -- c) FND_MSG_PUB on unhandled exceptions.
1224 --Locks:
1225 -- None.
1226 --Function:
1227 -- Transfers a batch of document headers given in a plsql table, into the
1228 -- transaction tables.
1229 -- This API should be called during the upgrade phase only.
1230 --Parameters:
1231 --IN:
1232 -- p_doc_headers_rec
1233 -- A table of plsql records containing a batch of header information for
1234 -- creating a new header.
1235 --OUT:
1236 --
1237 --End of Comments
1238 --------------------------------------------------------------------------------
1239 PROCEDURE transfer_doc_headers
1240 (
1241 x_doc_headers_rec IN OUT NOCOPY record_of_headers_type
1242 )
1243 IS
1244 l_api_name CONSTANT VARCHAR2(30) := 'transfer_doc_headers';
1245 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
1246 l_progress VARCHAR2(3) := '000';
1247
1248 BEGIN
1249 l_progress := '010';
1250 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
1251
1252 -- Insert Headers
1253 insert_doc_headers(x_doc_headers_rec => x_doc_headers_rec);
1254
1255 l_progress := '020';
1256 -- Update Headers
1257 update_doc_headers(p_doc_headers_rec => x_doc_headers_rec);
1258
1259 l_progress := '030';
1260 -- Delete Headers
1261 delete_doc_headers(p_doc_headers_rec => x_doc_headers_rec);
1262
1263 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
1264 EXCEPTION
1265 WHEN OTHERS THEN
1266 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
1267 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
1268 END transfer_doc_headers;
1269
1270 --------------------------------------------------------------------------------
1271 --Start of Comments
1272 --Name: copy_cpa_attachments
1273 --Pre-reqs:
1274 -- The iP catalog data is populated in PO Interface tables.
1275 --Modifies:
1276 -- a) FND_ATTCHMENTS table: Inserts copied attchments.
1277 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
1278 -- failed the migration.
1279 -- c) FND_MSG_PUB on unhandled exceptions.
1280 --Locks:
1281 -- None.
1282 --Function:
1283 -- Copies the attchments from the CPA Header to the new GBPA header.
1284 --
1285 -- This API should be called during the upgrade phase only.
1286 --Parameters:
1287 --IN:
1288 --p_valid_po_hdr_ids
1289 -- List of valid PO_HEADER_ID's for which attachments may be copied
1290 --p_valid_intf_hdr_ids
1291 -- List of valid INTERFACE_HEADER_ID's for which attachments may be copied
1292 --p_valid_cpa_references
1293 -- The list of CPA references (segment1's) from which the attchment needs
1294 -- to be copied into the new GBPA.
1295 --p_valid_org_ids
1296 -- The org_id's for the CPA (segment1+org_id) will form a unique key for the CPA
1297 --p_valid_vndr_site_ids
1298 -- List of vendor_site_id's for each of the headers
1299 --IN/OUT:
1300 -- x_doc_headers_rec
1301 -- A table of plsql records containing a batch of header information for
1302 -- creating a new GBPA header. If the copy attachment fails, then the record for
1303 -- that header will be marked as errored.
1304 --OUT:
1305 --x_remaining_val_po_hdr_ids
1306 -- List of PO_HEADER_ID for which copy attachment did not fail.
1307 --x_remaining_val_intf_hdr_ids
1308 -- List of INTERFACE_HEADER_ID for which copy attachment did not fail.
1309 --x_remaining_val_vndr_site_ids
1310 -- List of vendor_site_id's for each of the remaining successful headers.
1311 --End of Comments
1312 --------------------------------------------------------------------------------
1313 PROCEDURE copy_cpa_attachments
1314 (
1315 p_valid_po_hdr_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1316 , p_valid_intf_hdr_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1317 , p_valid_cpa_references IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1318 , p_valid_org_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1319 , p_valid_vndr_site_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1320 , x_doc_headers_rec IN OUT NOCOPY record_of_headers_type
1321 , x_remaining_val_po_hdr_ids IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1322 , x_remaining_val_intf_hdr_ids IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1323 , x_remaining_val_vndr_site_ids IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1324 )
1325 IS
1326 l_api_name CONSTANT VARCHAR2(30) := 'copy_cpa_attachments';
1327 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
1328 l_progress VARCHAR2(3) := '000';
1329
1330 i NUMBER;
1331 j NUMBER;
1332 l_count NUMBER := 0;
1333 l_err_count NUMBER;
1334 l_is_attach_err_intf_hdr_id PO_R12_CAT_UPG_TYPES.PO_TBL_VARCHAR1;
1335
1336 BEGIN
1337 l_progress := '010';
1338 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
1339
1340 l_progress := '020';
1341 l_err_count := 0;
1342 FOR i IN 1 .. p_valid_po_hdr_ids.COUNT
1343 LOOP
1344 IF (p_valid_cpa_references(i) IS NOT NULL) THEN
1345 BEGIN
1346 FND_ATTACHED_DOCUMENTS2_PKG.copy_attachments
1347 (
1348 x_from_entity_name => 'PO_HEADERS', -- IN VARCHAR2
1349 x_from_pk1_value => p_valid_cpa_references(i), -- IN VARCHAR2
1350 x_from_pk2_value => '', -- IN VARCHAR2 DEFAULT NULL
1351 x_from_pk3_value => '', -- IN VARCHAR2 DEFAULT NULL
1352 x_from_pk4_value => '', -- IN VARCHAR2 DEFAULT NULL
1353 x_from_pk5_value => '', -- IN VARCHAR2 DEFAULT NULL
1354 x_to_entity_name => 'PO_HEADERS', -- IN VARCHAR2
1355 x_to_pk1_value => p_valid_po_hdr_ids(i), -- IN VARCHAR2
1356 x_to_pk2_value => '', -- IN VARCHAR2 DEFAULT NULL
1357 x_to_pk3_value => '', -- IN VARCHAR2 DEFAULT NULL
1358 x_to_pk4_value => '', -- IN VARCHAR2 DEFAULT NULL
1359 x_to_pk5_value => '', -- IN VARCHAR2 DEFAULT NULL
1360 x_created_by => FND_GLOBAL.user_id, -- IN NUMBER DEFAULT NULL
1361 x_last_update_login => FND_GLOBAL.login_id, -- IN NUMBER DEFAULT NULL
1362 x_program_application_id => '', -- IN NUMBER DEFAULT NULL
1363 x_program_id => '', -- IN NUMBER DEFAULT NULL
1364 x_request_id => '', -- IN NUMBER DEFAULT NULL
1365 x_automatically_added_flag => '', -- IN VARCHAR2 DEFAULT NULL
1366 x_from_category_id => '', -- IN NUMBER DEFAULT NULL
1367 x_to_category_id => '' -- IN NUMBER DEFAULT NULL
1368 );
1369 EXCEPTION
1370 WHEN OTHERS THEN
1371 -- Mark record as Rejected and proceed with other records
1372
1373 l_err_count := l_err_count + 1;
1374 l_is_attach_err_intf_hdr_id(p_valid_intf_hdr_ids(i)) := 'Y'; -- sparse collection
1375
1376 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Copy attachment error for INTF_HDR_ID='||p_valid_intf_hdr_ids(i)||', PO_HEADER_ID='||p_valid_po_hdr_ids(i)); END IF;
1377
1378 FOR j IN 1 .. x_doc_headers_rec.interface_header_id.COUNT
1379 LOOP
1380 l_progress := '140';
1381 IF (x_doc_headers_rec.interface_header_id(j) = p_valid_intf_hdr_ids(i)) THEN
1382 x_doc_headers_rec.has_errors(j) := 'Y';
1383
1384 l_progress := '150';
1385 -- ICX_CAT_ERR_IN_COPY_ATTCHMNTS:
1386 -- "An error occurred in the call to API_NAME while copying attachments."
1387 PO_R12_CAT_UPG_UTL.add_fatal_error(
1388 p_interface_header_id => p_valid_intf_hdr_ids(i),
1389 p_error_message_name => 'ICX_CAT_ERR_IN_COPY_ATTCHMNTS',
1390 p_table_name => 'PO_HEADERS_INTERFACE',
1391 p_column_name => 'INTERFACE_HEADER_ID',
1392 p_column_value => x_doc_headers_rec.interface_header_id(j),
1393 p_token1_name => 'API_NAME',
1394 p_token1_value => 'FND_ATTACHED_DOCUMENTS2_PKG.copy_attachments'
1395 );
1396 END IF;
1397 END LOOP;
1398 END; -- exception block
1399 END IF; -- IF (p_valid_cpa_references(i) IS NOT NULL)
1400 END LOOP; -- copy attachment loop
1401
1402 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of err in copy attach='||l_err_count); END IF;
1403
1404 -- Now subtract the attachment errored records so that Org Assignments are created
1405 -- only for the successfully inserted ones.
1406 l_count := 0;
1407 FOR i IN 1 .. p_valid_po_hdr_ids.COUNT
1408 LOOP
1409 IF (l_is_attach_err_intf_hdr_id.exists(p_valid_intf_hdr_ids(i))) THEN
1410 -- DELETE the attachment copy errored header from txn table
1411 DELETE FROM PO_HEADERS_ALL
1412 WHERE PO_HEADER_ID = p_valid_po_hdr_ids(i);
1413
1414 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'PO Header deleted for '||i); END IF;
1415 ELSE
1416 l_count := l_count + 1;
1417 x_remaining_val_intf_hdr_ids(l_count) := p_valid_intf_hdr_ids(i);
1418 x_remaining_val_po_hdr_ids(l_count) := p_valid_po_hdr_ids(i);
1419 x_remaining_val_vndr_site_ids(l_count) := p_valid_vndr_site_ids(i);
1420 END IF;
1421 END LOOP;
1422
1423 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of success copy attach='||l_count); END IF;
1424
1425 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
1426 EXCEPTION
1427 WHEN OTHERS THEN
1428 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
1429 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
1430 END copy_cpa_attachments;
1431
1432 --------------------------------------------------------------------------------
1433 --Start of Comments
1434 --Name: manage_copy_cpa
1435 --Pre-reqs:
1436 -- The iP catalog data is populated in PO Interface tables.
1437 --Modifies:
1438 -- a) FND_ATTCHMENTS table: Inserts copied attchments.
1439 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
1440 -- failed the migration.
1441 -- c) FND_MSG_PUB on unhandled exceptions.
1442 --Locks:
1443 -- None.
1444 --Function:
1445 -- This procedure manages the flow when a CPA is being copied to become a
1446 -- new GBPA.
1447 -- 1. It copies the attchments from the CPA Header to the new GBPA header.
1448 -- 2. It copies some of the extra attributes from the CPA Header to GBPA
1449 -- header. These are those attributes that are not present in the
1450 -- PO_HEADERS_INTERFACE table. So IP has not mechanism to provide
1451 -- these values during catalog migration. Therefore, we directly copy
1452 -- these values during a CPA-GBPA flow.
1453 --
1454 -- This API should be called during the upgrade phase only.
1455 --Parameters:
1456 --IN:
1457 --p_valid_po_hdr_ids
1458 -- List of valid PO_HEADER_ID's for which attachments may be copied
1459 --p_valid_intf_hdr_ids
1460 -- List of valid INTERFACE_HEADER_ID's for which attachments may be copied
1461 --p_valid_cpa_references
1462 -- The list of CPA references (segment1's) from which the attchment needs
1463 -- to be copied into the new GBPA.
1464 --p_valid_org_ids
1465 -- The org_id's for the CPA (segment1+org_id) will form a unique key for the CPA
1466 --p_valid_vndr_site_ids
1467 -- List of vendor_site_id's for each of the headers
1468 --IN/OUT:
1469 -- x_doc_headers_rec
1470 -- A table of plsql records containing a batch of header information for
1471 -- creating a new GBPA header. If the copy attachment fails, then the record for
1472 -- that header will be marked as errored.
1473 --OUT:
1474 --x_remaining_val_po_hdr_ids
1475 -- List of PO_HEADER_ID for which copy attachment did not fail.
1476 --x_remaining_val_intf_hdr_ids
1477 -- List of INTERFACE_HEADER_ID for which copy attachment did not fail.
1478 --x_remaining_val_vndr_site_ids
1479 -- List of vendor_site_id's for each of the remaining successful headers.
1480 --End of Comments
1481 --------------------------------------------------------------------------------
1482 PROCEDURE manage_copy_cpa
1483 (
1484 p_valid_po_hdr_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1485 , p_valid_intf_hdr_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1486 , p_valid_cpa_references IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1487 , p_valid_org_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1488 , p_valid_vndr_site_ids IN PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1489 , x_doc_headers_rec IN OUT NOCOPY record_of_headers_type
1490 , x_remaining_val_po_hdr_ids IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1491 , x_remaining_val_intf_hdr_ids IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1492 , x_remaining_val_vndr_site_ids IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
1493 )
1494 IS
1495 l_api_name CONSTANT VARCHAR2(30) := 'manage_copy_cpa';
1496 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
1497 l_progress VARCHAR2(3) := '000';
1498
1499 i NUMBER;
1500 j NUMBER;
1501 l_is_valid_cpa VARCHAR2(1);
1502 BEGIN
1503 l_progress := '010';
1504 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
1505
1506 -- First copy the CPA attachments into the new GBPA.
1507 copy_cpa_attachments
1508 (
1509 p_valid_po_hdr_ids => p_valid_po_hdr_ids
1510 , p_valid_intf_hdr_ids => p_valid_intf_hdr_ids
1511 , p_valid_cpa_references => p_valid_cpa_references
1512 , p_valid_org_ids => p_valid_org_ids
1513 , p_valid_vndr_site_ids => p_valid_vndr_site_ids
1514 , x_doc_headers_rec => x_doc_headers_rec
1515 , x_remaining_val_po_hdr_ids => x_remaining_val_po_hdr_ids
1516 , x_remaining_val_intf_hdr_ids => x_remaining_val_intf_hdr_ids
1517 , x_remaining_val_vndr_site_ids => x_remaining_val_vndr_site_ids
1518 );
1519
1520 -- There could have been some exception while copying the attachment.
1521 -- We filter out those records. So process the remaining.
1522
1523 l_progress := '020';
1524 -- ECO bug 4554461:
1525 -- COPY OF CPA ATTRIBUTES TO THE NEW GBPA DURING THE UPGRADE
1526 FOR i IN 1 .. x_remaining_val_po_hdr_ids.COUNT
1527 LOOP
1528 l_progress := '030';
1529 FOR j IN 1 .. x_doc_headers_rec.interface_header_id.COUNT
1530 LOOP
1531 l_progress := '040';
1532 IF (x_doc_headers_rec.interface_header_id(j) = x_remaining_val_intf_hdr_ids(i) AND
1533 x_doc_headers_rec.cpa_reference(j) IS NOT NULL AND
1534 x_remaining_val_po_hdr_ids(i) IS NOT NULL AND
1535 x_doc_headers_rec.has_errors(j) <> 'Y' ) THEN
1536
1537 l_progress := '050';
1538 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'cpa_reference('||j||')='||x_doc_headers_rec.cpa_reference(j)); END IF;
1539
1540 -- Validate the CPA
1541 l_is_valid_cpa := 'N';
1542
1543 l_progress := '055';
1544 BEGIN
1545 SELECT 'Y'
1546 INTO l_is_valid_cpa
1547 FROM PO_HEADERS_ALL
1548 WHERE po_header_id = x_doc_headers_rec.cpa_reference(j)
1549 AND type_lookup_code = 'CONTRACT';
1550 EXCEPTION
1551 WHEN NO_DATA_FOUND THEN
1552 l_is_valid_cpa := 'N';
1553 END;
1554
1555 l_progress := '060';
1556 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_is_valid_cpa='||l_is_valid_cpa); END IF;
1557
1558 IF (l_is_valid_cpa = 'Y') THEN
1559 l_progress := '070';
1560 UPDATE PO_HEADERS_ALL GBPA
1561 SET
1562 (
1563 attribute_category
1564 , attribute1
1565 , attribute2
1566 , attribute3
1567 , attribute4
1568 , attribute5
1569 , attribute6
1570 , attribute7
1571 , attribute8
1572 , attribute9
1573 , attribute10
1574 , attribute11
1575 , attribute12
1576 , attribute13
1577 , attribute14
1578 , attribute15
1579 , global_attribute_category
1580 , global_attribute1
1581 , global_attribute2
1582 , global_attribute3
1583 , global_attribute4
1584 , global_attribute5
1585 , global_attribute6
1586 , global_attribute7
1587 , global_attribute8
1588 , global_attribute9
1589 , global_attribute10
1590 , global_attribute11
1591 , global_attribute12
1592 , global_attribute13
1593 , global_attribute14
1594 , global_attribute15
1595 , global_attribute16
1596 , global_attribute17
1597 , global_attribute18
1598 , global_attribute19
1599 , global_attribute20
1600 , vendor_contact_id
1601 , ship_to_location_id
1602 , bill_to_location_id
1603 , agent_id
1604 , blanket_total_amount
1605 , comments
1606 , rate_type
1607 , rate_date
1608 , rate
1609 , terms_id
1610 , freight_terms_lookup_code
1611 , ship_via_lookup_code
1612 , fob_lookup_code
1613 , pay_on_code
1614 , shipping_control -- transportation_arranged_by: Open Issue: As per Puneet this column is the same
1615 -- as shipping_control. PO will decide if this column is needed or not
1616 , confirming_order_flag
1617 , acceptance_required_flag
1618 , acceptance_due_date
1619 , note_to_vendor
1620 , note_to_receiver
1621 , amount_limit
1622 , min_release_amount
1623 , price_update_tolerance
1624 --, approved_flag -- This will be set in final upgrade
1625 , ussgl_transaction_code
1626 , mrc_rate_type
1627 , mrc_rate_date
1628 , mrc_rate
1629 , summary_flag
1630 , enabled_flag
1631 , start_date_active
1632 , end_date_active
1633 , start_date
1634 , end_date
1635 --, authorization_status -- This will be set in final upgrade
1636 , note_to_authorizer
1637 , vendor_order_num
1638 , approval_required_flag
1639 , firm_status_lookup_code
1640 , firm_date
1641 , government_context
1642 , supply_agreement_flag
1643 , xml_flag
1644 , xml_send_date
1645 , xml_change_send_date
1646 , cbc_accounting_date
1647 ) = ( SELECT
1648 attribute_category
1649 , attribute1
1650 , attribute2
1651 , attribute3
1652 , attribute4
1653 , attribute5
1654 , attribute6
1655 , attribute7
1656 , attribute8
1657 , attribute9
1658 , attribute10
1659 , attribute11
1660 , attribute12
1661 , attribute13
1662 , attribute14
1663 , attribute15
1664 , global_attribute_category
1665 , global_attribute1
1666 , global_attribute2
1667 , global_attribute3
1668 , global_attribute4
1669 , global_attribute5
1670 , global_attribute6
1671 , global_attribute7
1672 , global_attribute8
1673 , global_attribute9
1674 , global_attribute10
1675 , global_attribute11
1676 , global_attribute12
1677 , global_attribute13
1678 , global_attribute14
1679 , global_attribute15
1680 , global_attribute16
1681 , global_attribute17
1682 , global_attribute18
1683 , global_attribute19
1684 , global_attribute20
1685 , vendor_contact_id
1686 , ship_to_location_id
1687 , bill_to_location_id
1688 , agent_id
1689 , blanket_total_amount
1690 , substr(comments,1,210) || ' (CPA #' || segment1 || ')'
1691 , rate_type
1692 , rate_date
1693 , rate
1694 , terms_id
1695 , freight_terms_lookup_code
1696 , ship_via_lookup_code
1697 , fob_lookup_code
1698 , pay_on_code
1699 , shipping_control -- transportation_arranged_by: Open Issue: As per Puneet this column is the same
1700 -- as shipping_control. PO will decide if this column is needed or not
1701 , confirming_order_flag
1702 , acceptance_required_flag
1703 , acceptance_due_date
1704 , note_to_vendor
1705 , note_to_receiver
1706 , amount_limit
1707 , min_release_amount
1708 , price_update_tolerance
1709 --, approved_flag -- This will be set in final upgrade
1710 , ussgl_transaction_code
1711 , mrc_rate_type
1712 , mrc_rate_date
1713 , mrc_rate
1714 , summary_flag
1715 , enabled_flag
1716 , start_date_active
1717 , end_date_active
1718 , start_date
1719 , end_date
1720 --, authorization_status -- This will be set in final upgrade
1721 , note_to_authorizer
1722 , vendor_order_num
1723 , approval_required_flag
1724 , firm_status_lookup_code
1725 , firm_date
1726 , government_context
1727 , supply_agreement_flag
1728 , xml_flag
1729 , xml_send_date
1730 , xml_change_send_date
1731 , cbc_accounting_date
1732 FROM PO_HEADERS_ALL CPA
1733 WHERE CPA.po_header_id = x_doc_headers_rec.cpa_reference(j))
1734 WHERE GBPA.po_header_id = x_remaining_val_po_hdr_ids(i);
1735
1736 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Copied attributes of CPA header_id='||x_doc_headers_rec.cpa_reference(j)||' into GBPA header_id='||x_remaining_val_po_hdr_ids(i)); END IF;
1737 END IF; -- IF (l_is_valid_cpa = 'Y')
1738 END IF;
1739 END LOOP;
1740 END LOOP;
1741
1742 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
1743 EXCEPTION
1744 WHEN OTHERS THEN
1745 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
1746 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
1747 END manage_copy_cpa;
1748
1749 --------------------------------------------------------------------------------
1750 --Start of Comments
1751 --Name: insert_doc_headers
1752 --Pre-reqs:
1753 -- The iP catalog data is populated in PO Interface tables.
1754 --Modifies:
1755 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
1756 -- to the Interface tables.
1757 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
1758 -- failed the migration.
1759 -- c) FND_MSG_PUB on unhandled exceptions.
1760 --Locks:
1761 -- None.
1762 --Function:
1763 -- Inserts a batch of document headers given in a plsql table, into the transaction
1764 -- tables.
1765 -- This API should be called during the upgrade phase only.
1766 --Parameters:
1767 --IN/OUT:
1768 -- x_doc_headers_rec
1769 -- A table of plsql records containing a batch of header information for
1770 -- creating a new GBPA header. If the MRC API fails, then the record for
1771 -- that header will be marked as errored.
1772 --OUT:
1773 --
1774 --End of Comments
1775 --------------------------------------------------------------------------------
1776 PROCEDURE insert_doc_headers
1777 (
1778 x_doc_headers_rec IN OUT NOCOPY record_of_headers_type
1779 )
1780 IS
1781 l_api_name CONSTANT VARCHAR2(30) := 'insert_doc_headers';
1782 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
1783 l_progress VARCHAR2(3) := '000';
1784
1785 i NUMBER;
1786 j NUMBER;
1787 l_valid_headers record_of_headers_type;
1788 l_count NUMBER := 0;
1789 l_num_valid_headers NUMBER;
1790
1791 l_return_status VARCHAR2(1);
1792
1793 l_remaining_val_po_hdr_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
1794 l_remaining_val_intf_hdr_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
1795 l_remaining_val_vndr_site_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
1796 BEGIN
1797 l_progress := '010';
1798 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
1799
1800 l_progress := '020';
1801 -- Find the number of valid headers so that we can initialize the size of
1802 -- the arrays.
1803 l_num_valid_headers := 0;
1804 FOR i IN 1 .. x_doc_headers_rec.interface_header_id.COUNT
1805 LOOP
1806 IF (x_doc_headers_rec.has_errors(i) = 'N' AND
1807 x_doc_headers_rec.action(i) = PO_R12_CAT_UPG_PVT.g_action_header_create) THEN
1808 l_num_valid_headers := l_num_valid_headers + 1;
1809 END IF;
1810 END LOOP;
1811
1812 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_num_valid_headers='||l_num_valid_headers); END IF;
1813
1814 l_progress := '030';
1815 -- Get the valid rows into l_valid_headers array.
1816 l_count := 0;
1817 FOR i IN 1 .. x_doc_headers_rec.interface_header_id.COUNT
1818 LOOP
1819 l_progress := '040';
1820 IF (x_doc_headers_rec.has_errors(i) = 'N'
1821 AND x_doc_headers_rec.action(i) = PO_R12_CAT_UPG_PVT.g_action_header_create) THEN
1822 l_count := l_count + 1;
1823
1824 l_progress := '050';
1825 SELECT PO_HEADERS_S.nextval
1826 INTO l_valid_headers.po_header_id(l_count)
1827 FROM dual;
1828
1829 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'From sequence, next po_header_id='||l_valid_headers.po_header_id(l_count)); END IF;
1830
1831 l_progress := '060';
1832 l_valid_headers.interface_header_id(l_count) := x_doc_headers_rec.interface_header_id(i);
1833 l_progress := '061';
1834 l_valid_headers.batch_id(l_count) := x_doc_headers_rec.batch_id(i);
1835 l_valid_headers.interface_source_code(l_count) := x_doc_headers_rec.interface_source_code(i);
1836 l_valid_headers.process_code(l_count) := x_doc_headers_rec.process_code(i);
1837 l_valid_headers.action(l_count) := x_doc_headers_rec.action(i);
1838 l_valid_headers.group_code(l_count) := x_doc_headers_rec.group_code(i);
1839 l_valid_headers.org_id(l_count) := x_doc_headers_rec.org_id(i);
1840 l_valid_headers.document_type_code(l_count) := x_doc_headers_rec.document_type_code(i);
1841 l_valid_headers.document_subtype(l_count) := x_doc_headers_rec.document_subtype(i);
1842 l_valid_headers.document_num(l_count) := x_doc_headers_rec.document_num(i);
1843 l_valid_headers.release_num(l_count) := x_doc_headers_rec.release_num(i);
1844 l_valid_headers.po_release_id(l_count) := x_doc_headers_rec.po_release_id(i);
1845 l_valid_headers.release_date(l_count) := x_doc_headers_rec.release_date(i);
1846 l_valid_headers.currency_code(l_count) := x_doc_headers_rec.currency_code(i);
1847 l_valid_headers.rate_type(l_count) := x_doc_headers_rec.rate_type(i);
1848 l_progress := '062';
1849 l_valid_headers.rate_type_code(l_count) := x_doc_headers_rec.rate_type_code(i);
1850 l_valid_headers.rate_date(l_count) := x_doc_headers_rec.rate_date(i);
1851 l_valid_headers.rate(l_count) := x_doc_headers_rec.rate(i);
1852 l_valid_headers.agent_name(l_count) := x_doc_headers_rec.agent_name(i);
1853 l_valid_headers.agent_id(l_count) := x_doc_headers_rec.agent_id(i);
1854 l_valid_headers.vendor_name(l_count) := x_doc_headers_rec.vendor_name(i);
1855 l_valid_headers.vendor_id(l_count) := x_doc_headers_rec.vendor_id(i);
1856 l_valid_headers.vendor_site_code(l_count) := x_doc_headers_rec.vendor_site_code(i);
1857 l_valid_headers.vendor_site_id(l_count) := x_doc_headers_rec.vendor_site_id(i);
1858 l_valid_headers.vendor_contact(l_count) := x_doc_headers_rec.vendor_contact(i);
1859 l_valid_headers.vendor_contact_id(l_count) := x_doc_headers_rec.vendor_contact_id(i);
1860 l_progress := '063';
1861 l_valid_headers.ship_to_location(l_count) := x_doc_headers_rec.ship_to_location(i);
1862 l_valid_headers.ship_to_location_id(l_count) := x_doc_headers_rec.ship_to_location_id(i);
1863 l_valid_headers.bill_to_location(l_count) := x_doc_headers_rec.bill_to_location(i);
1864 l_valid_headers.bill_to_location_id(l_count) := x_doc_headers_rec.bill_to_location_id(i);
1865 l_valid_headers.payment_terms(l_count) := x_doc_headers_rec.payment_terms(i);
1866 l_valid_headers.terms_id(l_count) := x_doc_headers_rec.terms_id(i);
1867 l_valid_headers.freight_carrier(l_count) := x_doc_headers_rec.freight_carrier(i);
1868 l_valid_headers.fob(l_count) := x_doc_headers_rec.fob(i);
1869 l_valid_headers.freight_terms(l_count) := x_doc_headers_rec.freight_terms(i);
1870 l_valid_headers.approval_status(l_count) := x_doc_headers_rec.approval_status(i);
1871 l_progress := '064';
1872 l_valid_headers.approved_date(l_count) := x_doc_headers_rec.approved_date(i);
1873 l_valid_headers.revised_date(l_count) := x_doc_headers_rec.revised_date(i);
1874 l_valid_headers.revision_num(l_count) := x_doc_headers_rec.revision_num(i);
1875 l_valid_headers.note_to_vendor(l_count) := x_doc_headers_rec.note_to_vendor(i);
1876 l_valid_headers.note_to_receiver(l_count) := x_doc_headers_rec.note_to_receiver(i);
1877 l_valid_headers.confirming_order_flag(l_count) := x_doc_headers_rec.confirming_order_flag(i);
1878 l_valid_headers.comments(l_count) := x_doc_headers_rec.comments(i);
1879 l_valid_headers.acceptance_required_flag(l_count) := x_doc_headers_rec.acceptance_required_flag(i);
1880 l_valid_headers.acceptance_due_date(l_count) := x_doc_headers_rec.acceptance_due_date(i);
1881 l_valid_headers.amount_agreed(l_count) := x_doc_headers_rec.amount_agreed(i);
1882 l_valid_headers.amount_limit(l_count) := x_doc_headers_rec.amount_limit(i);
1883 l_progress := '065';
1884 l_valid_headers.min_release_amount(l_count) := x_doc_headers_rec.min_release_amount(i);
1885 l_valid_headers.effective_date(l_count) := x_doc_headers_rec.effective_date(i);
1886 l_valid_headers.expiration_date(l_count) := x_doc_headers_rec.expiration_date(i);
1887 l_valid_headers.print_count(l_count) := x_doc_headers_rec.print_count(i);
1888 l_valid_headers.printed_date(l_count) := x_doc_headers_rec.printed_date(i);
1889 l_valid_headers.firm_flag(l_count) := x_doc_headers_rec.firm_flag(i);
1890 l_valid_headers.frozen_flag(l_count) := x_doc_headers_rec.frozen_flag(i);
1891 l_valid_headers.closed_code(l_count) := x_doc_headers_rec.closed_code(i);
1892 l_valid_headers.closed_date(l_count) := x_doc_headers_rec.closed_date(i);
1893 l_valid_headers.reply_date(l_count) := x_doc_headers_rec.reply_date(i);
1894 l_valid_headers.reply_method(l_count) := x_doc_headers_rec.reply_method(i);
1895 l_valid_headers.rfq_close_date(l_count) := x_doc_headers_rec.rfq_close_date(i);
1896 l_valid_headers.quote_warning_delay(l_count) := x_doc_headers_rec.quote_warning_delay(i);
1897 l_valid_headers.vendor_doc_num(l_count) := x_doc_headers_rec.vendor_doc_num(i);
1898 l_valid_headers.approval_required_flag(l_count) := x_doc_headers_rec.approval_required_flag(i);
1899 l_valid_headers.vendor_list(l_count) := x_doc_headers_rec.vendor_list(i);
1900 l_valid_headers.vendor_list_header_id(l_count) := x_doc_headers_rec.vendor_list_header_id(i);
1901 l_valid_headers.from_header_id(l_count) := x_doc_headers_rec.from_header_id(i);
1902 l_valid_headers.from_type_lookup_code(l_count) := x_doc_headers_rec.from_type_lookup_code(i);
1903 l_valid_headers.ussgl_transaction_code(l_count) := x_doc_headers_rec.ussgl_transaction_code(i);
1904 l_progress := '066';
1905 l_valid_headers.attribute_category(l_count) := x_doc_headers_rec.attribute_category(i);
1906 l_valid_headers.attribute1(l_count) := x_doc_headers_rec.attribute1(i);
1907 l_valid_headers.attribute2(l_count) := x_doc_headers_rec.attribute2(i);
1908 l_valid_headers.attribute3(l_count) := x_doc_headers_rec.attribute3(i);
1909 l_valid_headers.attribute4(l_count) := x_doc_headers_rec.attribute4(i);
1910 l_valid_headers.attribute5(l_count) := x_doc_headers_rec.attribute5(i);
1911 l_valid_headers.attribute6(l_count) := x_doc_headers_rec.attribute6(i);
1912 l_valid_headers.attribute7(l_count) := x_doc_headers_rec.attribute7(i);
1913 l_valid_headers.attribute8(l_count) := x_doc_headers_rec.attribute8(i);
1914 l_valid_headers.attribute9(l_count) := x_doc_headers_rec.attribute9(i);
1915 l_valid_headers.attribute10(l_count) := x_doc_headers_rec.attribute10(i);
1916 l_valid_headers.attribute11(l_count) := x_doc_headers_rec.attribute11(i);
1917 l_valid_headers.attribute12(l_count) := x_doc_headers_rec.attribute12(i);
1918 l_valid_headers.attribute13(l_count) := x_doc_headers_rec.attribute13(i);
1919 l_valid_headers.attribute14(l_count) := x_doc_headers_rec.attribute14(i);
1920 l_valid_headers.attribute15(l_count) := x_doc_headers_rec.attribute15(i);
1921 l_valid_headers.creation_date(l_count) := x_doc_headers_rec.creation_date(i);
1922 l_valid_headers.created_by(l_count) := x_doc_headers_rec.created_by(i);
1923 l_valid_headers.last_update_date(l_count) := x_doc_headers_rec.last_update_date(i);
1924 l_valid_headers.last_updated_by(l_count) := x_doc_headers_rec.last_updated_by(i);
1925 l_valid_headers.last_update_login(l_count) := x_doc_headers_rec.last_update_login(i);
1926 l_valid_headers.request_id(l_count) := x_doc_headers_rec.request_id(i);
1927 l_valid_headers.program_application_id(l_count) := x_doc_headers_rec.program_application_id(i);
1928 l_valid_headers.program_id(l_count) := x_doc_headers_rec.program_id(i);
1929 l_valid_headers.program_update_date(l_count) := x_doc_headers_rec.program_update_date(i);
1930 l_progress := '067';
1931 l_valid_headers.reference_num(l_count) := x_doc_headers_rec.reference_num(i);
1932 l_valid_headers.load_sourcing_rules_flag(l_count) := x_doc_headers_rec.load_sourcing_rules_flag(i);
1933 l_valid_headers.vendor_num(l_count) := x_doc_headers_rec.vendor_num(i);
1934 l_valid_headers.from_rfq_num(l_count) := x_doc_headers_rec.from_rfq_num(i);
1935 l_valid_headers.wf_group_id(l_count) := x_doc_headers_rec.wf_group_id(i);
1936 l_valid_headers.pcard_id(l_count) := x_doc_headers_rec.pcard_id(i);
1937 l_valid_headers.pay_on_code(l_count) := x_doc_headers_rec.pay_on_code(i);
1938 l_valid_headers.global_agreement_flag(l_count) := x_doc_headers_rec.global_agreement_flag(i);
1939 l_valid_headers.consume_req_demand_flag(l_count) := x_doc_headers_rec.consume_req_demand_flag(i);
1940 l_valid_headers.shipping_control(l_count) := x_doc_headers_rec.shipping_control(i);
1941 l_valid_headers.encumbrance_required_flag(l_count) := NULL; --x_doc_headers_rec.encumbrance_required_flag(i);
1942 l_valid_headers.amount_to_encumber(l_count) := x_doc_headers_rec.amount_to_encumber(i);
1943 l_valid_headers.change_summary(l_count) := x_doc_headers_rec.change_summary(i);
1944 l_progress := '068';
1945 l_valid_headers.budget_account_segment1(l_count) := x_doc_headers_rec.budget_account_segment1(i);
1946 l_valid_headers.budget_account_segment2(l_count) := x_doc_headers_rec.budget_account_segment2(i);
1947 l_valid_headers.budget_account_segment3(l_count) := x_doc_headers_rec.budget_account_segment3(i);
1948 l_valid_headers.budget_account_segment4(l_count) := x_doc_headers_rec.budget_account_segment4(i);
1949 l_valid_headers.budget_account_segment5(l_count) := x_doc_headers_rec.budget_account_segment5(i);
1950 l_valid_headers.budget_account_segment6(l_count) := x_doc_headers_rec.budget_account_segment6(i);
1951 l_valid_headers.budget_account_segment7(l_count) := x_doc_headers_rec.budget_account_segment7(i);
1952 l_valid_headers.budget_account_segment8(l_count) := x_doc_headers_rec.budget_account_segment8(i);
1953 l_valid_headers.budget_account_segment9(l_count) := x_doc_headers_rec.budget_account_segment9(i);
1954 l_valid_headers.budget_account_segment10(l_count) := x_doc_headers_rec.budget_account_segment10(i);
1955 l_valid_headers.budget_account_segment11(l_count) := x_doc_headers_rec.budget_account_segment11(i);
1956 l_valid_headers.budget_account_segment12(l_count) := x_doc_headers_rec.budget_account_segment12(i);
1957 l_valid_headers.budget_account_segment13(l_count) := x_doc_headers_rec.budget_account_segment13(i);
1958 l_valid_headers.budget_account_segment14(l_count) := x_doc_headers_rec.budget_account_segment14(i);
1959 l_valid_headers.budget_account_segment15(l_count) := x_doc_headers_rec.budget_account_segment15(i);
1960 l_valid_headers.budget_account_segment16(l_count) := x_doc_headers_rec.budget_account_segment16(i);
1961 l_valid_headers.budget_account_segment17(l_count) := x_doc_headers_rec.budget_account_segment17(i);
1962 l_valid_headers.budget_account_segment18(l_count) := x_doc_headers_rec.budget_account_segment18(i);
1963 l_valid_headers.budget_account_segment19(l_count) := x_doc_headers_rec.budget_account_segment19(i);
1964 l_valid_headers.budget_account_segment20(l_count) := x_doc_headers_rec.budget_account_segment20(i);
1965 l_valid_headers.budget_account_segment21(l_count) := x_doc_headers_rec.budget_account_segment21(i);
1966 l_valid_headers.budget_account_segment22(l_count) := x_doc_headers_rec.budget_account_segment22(i);
1967 l_valid_headers.budget_account_segment23(l_count) := x_doc_headers_rec.budget_account_segment23(i);
1968 l_valid_headers.budget_account_segment24(l_count) := x_doc_headers_rec.budget_account_segment24(i);
1969 l_valid_headers.budget_account_segment25(l_count) := x_doc_headers_rec.budget_account_segment25(i);
1970 l_valid_headers.budget_account_segment26(l_count) := x_doc_headers_rec.budget_account_segment26(i);
1971 l_valid_headers.budget_account_segment27(l_count) := x_doc_headers_rec.budget_account_segment27(i);
1972 l_valid_headers.budget_account_segment28(l_count) := x_doc_headers_rec.budget_account_segment28(i);
1973 l_valid_headers.budget_account_segment29(l_count) := x_doc_headers_rec.budget_account_segment29(i);
1974 l_valid_headers.budget_account_segment30(l_count) := x_doc_headers_rec.budget_account_segment30(i);
1975 l_valid_headers.budget_account(l_count) := x_doc_headers_rec.budget_account(i);
1976 l_valid_headers.budget_account_id(l_count) := x_doc_headers_rec.budget_account_id(i);
1977 l_progress := '069';
1978 l_valid_headers.gl_encumbered_date(l_count) := x_doc_headers_rec.gl_encumbered_date(i);
1979 l_valid_headers.gl_encumbered_period_name(l_count) := x_doc_headers_rec.gl_encumbered_period_name(i);
1980 l_valid_headers.style_id(l_count) := x_doc_headers_rec.style_id(i);
1981 l_valid_headers.draft_id(l_count) := x_doc_headers_rec.draft_id(i);
1982 l_valid_headers.processing_id(l_count) := x_doc_headers_rec.processing_id(i);
1983 l_valid_headers.processing_round_num(l_count) := x_doc_headers_rec.processing_round_num(i);
1984 l_valid_headers.original_po_header_id(l_count) := x_doc_headers_rec.original_po_header_id(i);
1985 l_valid_headers.created_language(l_count) := x_doc_headers_rec.created_language(i);
1986 l_valid_headers.cpa_reference(l_count) := x_doc_headers_rec.cpa_reference(i);
1987 l_progress := '269';
1988 END IF;
1989 END LOOP;
1990
1991 l_progress := '070';
1992 -- SQL What: Insert Rows that do not have errors, and where action
1993 -- is PO_R12_CAT_UPG_PVT.g_action_header_create
1994 -- SQL Why : To migrate data to txn tables
1995 -- SQL Join: none
1996 FORALL i IN 1 .. l_valid_headers.po_header_id.COUNT
1997 INSERT INTO po_headers_all POH
1998 (po_header_id,
1999 agent_id,
2000 type_lookup_code,
2001 last_update_date,
2002 last_updated_by,
2003 segment1,
2004 summary_flag,
2005 enabled_flag,
2006 segment2,
2007 segment3,
2008 segment4,
2009 segment5,
2010 start_date_active,
2011 end_date_active,
2012 last_update_login,
2013 creation_date,
2014 created_by,
2015 vendor_id,
2016 vendor_site_id,
2017 vendor_contact_id,
2018 ship_to_location_id,
2019 bill_to_location_id,
2020 terms_id,
2021 ship_via_lookup_code,
2022 fob_lookup_code,
2023 freight_terms_lookup_code,
2024 status_lookup_code,
2025 currency_code,
2026 rate_type,
2027 rate_date,
2028 rate,
2029 from_header_id,
2030 from_type_lookup_code,
2031 start_date,
2032 end_date,
2033 blanket_total_amount,
2034 authorization_status,
2035 revision_num,
2036 revised_date,
2037 approved_flag,
2038 approved_date,
2039 amount_limit,
2040 min_release_amount,
2041 note_to_authorizer,
2042 note_to_vendor,
2043 note_to_receiver,
2044 print_count,
2045 printed_date,
2046 vendor_order_num,
2047 confirming_order_flag,
2048 comments,
2049 reply_date,
2050 reply_method_lookup_code,
2051 rfq_close_date,
2052 quote_type_lookup_code,
2053 quotation_class_code,
2054 quote_warning_delay_unit,
2055 quote_warning_delay,
2056 quote_vendor_quote_number,
2057 acceptance_required_flag,
2058 acceptance_due_date,
2059 closed_date,
2060 user_hold_flag,
2061 approval_required_flag,
2062 cancel_flag,
2063 firm_status_lookup_code,
2064 firm_date,
2065 frozen_flag,
2066 attribute_category,
2067 attribute1,
2068 attribute2,
2069 attribute3,
2070 attribute4,
2071 attribute5,
2072 attribute6,
2073 attribute7,
2074 attribute8,
2075 attribute9,
2076 attribute10,
2077 attribute11,
2078 attribute12,
2079 attribute13,
2080 attribute14,
2081 attribute15,
2082 closed_code,
2083 ussgl_transaction_code,
2084 government_context,
2085 request_id,
2086 program_application_id,
2087 program_id,
2088 program_update_date,
2089 org_id,
2090 supply_agreement_flag,
2091 edi_processed_flag,
2092 edi_processed_status,
2093 global_attribute_category,
2094 global_attribute1,
2095 global_attribute2,
2096 global_attribute3,
2097 global_attribute4,
2098 global_attribute5,
2099 global_attribute6,
2100 global_attribute7,
2101 global_attribute8,
2102 global_attribute9,
2103 global_attribute10,
2104 global_attribute11,
2105 global_attribute12,
2106 global_attribute13,
2107 global_attribute14,
2108 global_attribute15,
2109 global_attribute16,
2110 global_attribute17,
2111 global_attribute18,
2112 global_attribute19,
2113 global_attribute20,
2114 interface_source_code,
2115 reference_num,
2116 wf_item_type,
2117 wf_item_key,
2118 mrc_rate_type,
2119 mrc_rate_date,
2120 mrc_rate,
2121 pcard_id,
2122 price_update_tolerance,
2123 pay_on_code,
2124 xml_flag,
2125 xml_send_date,
2126 xml_change_send_date,
2127 global_agreement_flag,
2128 consigned_consumption_flag,
2129 cbc_accounting_date,
2130 consume_req_demand_flag,
2131 change_requested_by,
2132 --shipping_control,
2133 --conterms_exist_flag, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2134 --conterms_articles_upd_date, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2135 --conterms_deliv_upd_date, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2136 --encumbrance_required_flag, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2137 --pending_signature_flag, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2138 --change_summary, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2139 --document_creation_method, TODO: Not present in 11.5.9. For 11.5.10, default CATALOG_MIGRATION (Open issue)
2140 --submit_date, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2141 --supplier_notif_method, Not present in 11.5.9, 11.5.10
2142 --fax, Not present in 11.5.9, 11.5.10
2143 --email_address, Not present in 11.5.9, 11.5.10
2144 --retro_price_comm_updates_flag, Not present in 11.5.9, 11.5.10
2145 --retro_price_apply_updates_flag, Not present in 11.5.9, 11.5.10
2146 --update_sourcing_rules_flag, Not present in 11.5.9, 11.5.10
2147 --auto_sourcing_flag, Not present in 11.5.9, 11.5.10
2148 created_language,
2149 cpa_reference,
2150 last_updated_program
2151 /*PO_UC12*/
2152 , style_id
2153 /*/PO_UC12*/
2154 --supplier_auth_enabled_flag
2155 )
2156 VALUES
2157 (
2158 l_valid_headers.po_header_id(i),
2159 l_valid_headers.agent_id(i),
2160 'BLANKET',
2161 sysdate, -- last_update_date
2162 FND_GLOBAL.user_id, -- last_updated_by
2163 PO_R12_CAT_UPG_FINAL_GRP.get_next_po_number(l_valid_headers.org_id(i)),
2164 'N', -- summary_flag (Key flexfield related, for future use)
2165 'Y', -- enabled_flag (Key flexfield related, for future use)
2166 NULL, -- segment2,
2167 NULL, -- segment3,
2168 NULL, -- segment4,
2169 NULL, -- segment5,
2170 NULL, -- start_date_active (Key Flexfield start date)
2171 NULL, -- end_date_active (Key Flexfield start date)
2172 FND_GLOBAL.login_id, -- last_update_login
2173 sysdate, -- creation_date
2174 g_R12_UPGRADE_USER, -- created_by = -12
2175 l_valid_headers.vendor_id(i),
2176 l_valid_headers.vendor_site_id(i),
2177 l_valid_headers.vendor_contact_id(i),
2178 l_valid_headers.ship_to_location_id(i),
2179 l_valid_headers.bill_to_location_id(i),
2180 l_valid_headers.terms_id(i),
2181 l_valid_headers.freight_carrier(i), -- ship_via_lookup_code
2182 l_valid_headers.fob(i),
2183 l_valid_headers.freight_terms(i),
2184 NULL, -- status_lookup_code (Only used for Quotations)
2185 l_valid_headers.currency_code(i),
2186 l_valid_headers.rate_type_code(i),
2187 l_valid_headers.rate_date(i),
2188 l_valid_headers.rate(i),
2189 NULL, -- from_header_id,
2190 NULL, -- from_type_lookup_code,
2191 l_valid_headers.effective_date(i), -- start_date
2192 l_valid_headers.expiration_date(i), -- end_date
2193 l_valid_headers.amount_agreed(i), -- blanket_total_amount
2194 'IN PROCESS', -- authorization_status
2195 0, -- revision_num
2196 sysdate, -- revised_date
2197 'N', -- approved_flag
2198 NULL, -- approved_date
2199 l_valid_headers.amount_limit(i),
2200 l_valid_headers.min_release_amount(i),
2201 NULL, -- note_to_authorizer
2202 NULL, -- note_to_vendor
2203 NULL, -- note_to_receiver
2204 0, -- print_count
2205 NULL, -- printed_date
2206 NULL, -- vendor_order_num
2207 'N', -- confirming_order_flag
2208 l_valid_headers.comments(i), -- comments
2209 NULL, -- reply_date
2210 NULL, -- reply_method_lookup_code
2211 NULL, -- rfq_close_date
2212 NULL, -- quote_type_lookup_code
2213 NULL, -- quotation_class_code
2214 NULL, -- quote_warning_delay_unit
2215 NULL, -- quote_warning_delay
2216 NULL, -- quote_vendor_quote_number
2217 'N', -- acceptance_required_flag
2218 NULL, -- acceptance_due_date
2219 NULL, -- closed_date
2220 NULL, -- user_hold_flag
2221 NULL, -- approval_required_flag
2222 'N', -- cancel_flag
2223 'N', -- firm_status_lookup_code
2224 NULL, -- firm_date
2225 'N', -- frozen_flag
2226 NULL, -- attribute_category
2227 NULL, -- attribute1
2228 NULL, -- attribute2
2229 NULL, -- attribute3
2230 NULL, -- attribute4
2231 NULL, -- attribute5
2232 NULL, -- attribute6
2233 NULL, -- attribute7
2234 NULL, -- attribute8
2235 NULL, -- attribute9
2236 NULL, -- attribute10
2237 NULL, -- attribute11
2238 NULL, -- attribute12
2239 NULL, -- attribute13
2240 NULL, -- attribute14
2241 NULL, -- attribute15
2242 NULL, -- closed_code
2243 NULL, -- ussgl_transaction_code
2244 NULL, -- government_context
2245 NULL, -- request_id
2246 NULL, -- program_application_id
2247 NULL, -- program_id
2248 NULL, -- program_update_date
2249 l_valid_headers.org_id(i),
2250 'N', -- supply_agreement_flag
2251 NULL, -- edi_processed_flag
2252 NULL, -- edi_processed_status
2253 NULL, -- global_attribute_category
2254 NULL, -- global_attribute1
2255 NULL, -- global_attribute2
2256 NULL, -- global_attribute3
2257 NULL, -- global_attribute4
2258 NULL, -- global_attribute5
2259 NULL, -- global_attribute6
2260 NULL, -- global_attribute7
2261 NULL, -- global_attribute8
2262 NULL, -- global_attribute9
2263 NULL, -- global_attribute10
2264 NULL, -- global_attribute11
2265 NULL, -- global_attribute12
2266 NULL, -- global_attribute13
2267 NULL, -- global_attribute14
2268 NULL, -- global_attribute15
2269 NULL, -- global_attribute16
2270 NULL, -- global_attribute17
2271 NULL, -- global_attribute18
2272 NULL, -- global_attribute19
2273 NULL, -- global_attribute20
2274 NULL, -- interface_source_code
2275 NULL, -- reference_num
2276 NULL, -- wf_item_type
2277 NULL, -- wf_item_key
2278 NULL, -- mrc_rate_type
2279 NULL, -- mrc_rate_date
2280 NULL, -- mrc_rate
2281 NULL, -- pcard_id
2282 NULL, -- price_update_tolerance
2283 l_valid_headers.pay_on_code(i),
2284 NULL, -- xml_flag,
2285 NULL, -- xml_send_date,
2286 NULL, -- xml_change_send_date,
2287 'Y', -- global_agreement_flag,
2288 NULL, -- consigned_consumption_flag,
2289 NULL, -- cbc_accounting_date,
2290 NULL, -- consume_req_demand_flag,
2291 NULL, -- change_requested_by,
2292 --l_valid_headers.shipping_control(i),
2293 --NULL, -- conterms_exist_flag,
2294 --NULL, -- conterms_articles_upd_date,
2295 --NULL, -- conterms_deliv_upd_date,
2296 --NULL, -- encumbrance_required_flag,
2297 --NULL, -- pending_signature_flag,
2298 --NULL, -- change_summary,
2299 --NULL, -- document_creation_method, TODO: Not present in 11.5.9. For 11.5.10, default CATALOG_MIGRATION
2300 --NULL, -- submit_date, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2301 --NULL, -- supplier_notif_method, -- Not present in 11.5.9, 11.5.10
2302 --NULL, -- fax, -- Not present in 11.5.9, 11.5.10
2303 --NULL, -- email_address, -- Not present in 11.5.9, 11.5.10
2304 --NULL, -- retro_price_comm_updates_flag, -- Not present in 11.5.9, 11.5.10
2305 --NULL, -- retro_price_apply_updates_flag, -- Not present in 11.5.9, 11.5.10
2306 --NULL, -- update_sourcing_rules_flag, -- Not present in 11.5.9, 11.5.10
2307 --NULL, -- auto_sourcing_flag, -- Not present in 11.5.9, 11.5.10
2308 l_valid_headers.created_language(i),
2309 l_valid_headers.cpa_reference(i),
2310 g_R12_MIGRATION_PROGRAM -- last_updated_program,
2311 /*PO_UC12*/
2312 , 1 -- style_id
2313 /*/PO_UC12*/
2314 --NULL, -- supplier_auth_enabled_flag -- Not present in 11.5.9, 11.5.10
2315 );
2316
2317 l_progress := '080';
2318 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of txn headers inserted='||SQL%rowcount); END IF;
2319
2320
2321 manage_copy_cpa
2322 (
2323 p_valid_po_hdr_ids => l_valid_headers.po_header_id
2324 , p_valid_intf_hdr_ids => l_valid_headers.interface_header_id
2325 , p_valid_cpa_references => l_valid_headers.cpa_reference
2326 , p_valid_org_ids => l_valid_headers.org_id
2327 , p_valid_vndr_site_ids => l_valid_headers.vendor_site_id
2328 , x_doc_headers_rec => x_doc_headers_rec
2329 , x_remaining_val_po_hdr_ids => l_remaining_val_po_hdr_ids
2330 , x_remaining_val_intf_hdr_ids => l_remaining_val_intf_hdr_ids
2331 , x_remaining_val_vndr_site_ids => l_remaining_val_vndr_site_ids
2332 );
2333
2334 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'After manage_copy_cpa(), l_remaining_val_po_hdr_ids.COUNT='||l_remaining_val_po_hdr_ids.COUNT); END IF;
2335
2336 -- SQL What: For each GBPA Header inserted above, insert the default
2337 -- Org Assignments Row.
2338 -- SQL Why : To migrate data to txn tables
2339 -- SQL Join: none
2340 FORALL i IN 1 .. l_remaining_val_po_hdr_ids.COUNT
2341 INSERT INTO PO_GA_ORG_ASSIGNMENTS(
2342 /*PO_UC12*/
2343 org_assignment_id,
2344 /*/PO_UC12*/
2345 po_header_id,
2346 organization_id,
2347 --delete_flag,
2348 --change_acceptance_flag,
2349 enabled_flag,
2350 vendor_site_id,
2351 purchasing_org_id,
2352 last_update_date,
2353 last_updated_by,
2354 last_update_login,
2355 creation_date,
2356 created_by)
2357 VALUES(
2358 /*PO_UC12*/
2359 PO_GA_ORG_ASSIGNMENTS_S.nextval,
2360 /*/PO_UC12*/
2361 l_remaining_val_po_hdr_ids(i),
2362 g_job.org_id,
2363 --'N', --g_job.delete_flag,
2364 --'Y', --g_job.change_acceptance_flag,
2365 'Y',
2366 l_remaining_val_vndr_site_ids(i),
2367 g_job.org_id,
2368 sysdate,
2369 FND_GLOBAL.user_id,
2370 FND_GLOBAL.login_id,
2371 sysdate,
2372 g_R12_UPGRADE_USER);
2373
2374 l_progress := '170';
2375 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of txn Org Assignments inserted='||SQL%rowcount); END IF;
2376
2377 l_progress := '180';
2378 -- SQL What: Insert the PO_HEADER_ID back into Interface table for
2379 -- successfull header creation
2380 -- SQL Why : To make it available to the calling program of the migration API.
2381 -- SQL Join: interface_header_id
2382 FORALL i IN 1 .. l_remaining_val_intf_hdr_ids.COUNT
2383 UPDATE PO_HEADERS_INTERFACE
2384 SET PO_HEADER_ID = l_remaining_val_po_hdr_ids(i),
2385 PROCESS_CODE = g_PROCESS_CODE_PROCESSED
2386 WHERE interface_header_id = l_remaining_val_intf_hdr_ids(i);
2387
2388 l_progress := '190';
2389 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of interface headers records updated with po_header_id='||SQL%rowcount); END IF;
2390
2391 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
2392 EXCEPTION
2393 WHEN OTHERS THEN
2394 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
2395 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
2396 END insert_doc_headers;
2397
2398 --------------------------------------------------------------------------------
2399 --Start of Comments
2400 --Name: update_doc_headers
2401 --Pre-reqs:
2402 -- The iP catalog data is populated in PO Interface tables.
2403 --Modifies:
2404 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
2405 -- to the Interface tables.
2406 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
2407 -- failed the migration.
2408 -- c) FND_MSG_PUB on unhandled exceptions.
2409 --Locks:
2410 -- None.
2411 --Function:
2412 -- Updates a batch of document headers given in a plsql table, into the transaction
2413 -- tables.
2414 -- This API should be called during the upgrade phase only.
2415 --Parameters:
2416 --IN:
2417 -- p_doc_headers_rec
2418 -- A table of plsql records containing a batch of header information for
2419 -- creating a new GBPA header.
2420 --OUT:
2421 --End of Comments
2422 --------------------------------------------------------------------------------
2423 PROCEDURE update_doc_headers
2424 (
2425 p_doc_headers_rec IN record_of_headers_type
2426 )
2427 IS
2428 l_api_name CONSTANT VARCHAR2(30) := 'update_doc_headers';
2429 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
2430 l_progress VARCHAR2(3) := '000';
2431
2432 BEGIN
2433 l_progress := '010';
2434 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
2435
2436 -- Update Rows that do not have errors, and action = 'UPDATE'
2437
2438 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_headers_rec.po_header_id.COUNT='||p_doc_headers_rec.po_header_id.COUNT); END IF;
2439
2440 IF (p_doc_headers_rec.po_header_id.COUNT > 0) THEN
2441 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_headers_rec.po_header_id(1)='||p_doc_headers_rec.po_header_id(1)); END IF;
2442 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_headers_rec.has_errors(1)='||p_doc_headers_rec.has_errors(1)); END IF;
2443 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_headers_rec.action(1)='||p_doc_headers_rec.action(1)); END IF;
2444 END IF;
2445
2446 -- SQL What: Update all the headers that were created by the Catalog Upgrade.
2447 -- For these, only the CPA_REFERENCE is allowed to be updated. The
2448 -- other columns, if provided in the interface tables, will be
2449 -- ignored - including the CREATED_LANGUAGE.
2450 -- SQL Why : To update the header columns
2451 -- SQL Join: po_header_id
2452 FORALL i IN 1.. p_doc_headers_rec.po_header_id.COUNT
2453 UPDATE po_headers_all
2454 SET cpa_reference = DECODE(p_doc_headers_rec.cpa_reference(i),
2455 g_NULLIFY_NUM, NULL,
2456 NULL, cpa_reference,
2457 p_doc_headers_rec.cpa_reference(i))
2458 WHERE po_header_id = p_doc_headers_rec.po_header_id(i)
2459 AND p_doc_headers_rec.has_errors(i) = 'N'
2460 AND p_doc_headers_rec.action(i) = 'UPDATE';
2461
2462 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of headers updated with CPA_REFERENCE='||SQL%rowcount); END IF;
2463
2464 l_progress := '020';
2465 -- Update the Headers Interface Table for process_code as 'PROCESSED'
2466 -- SQL What: Update the Headers Interface Table for process_code as 'PROCESSED'
2467 -- for all the headers that were successfully updated.
2468 -- SQL Why : To mark them as successfully processed
2469 -- SQL Join: interface_header_id
2470 FORALL i IN 1.. p_doc_headers_rec.po_header_id.COUNT
2471 UPDATE po_headers_interface
2472 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
2473 WHERE interface_header_id = p_doc_headers_rec.interface_header_id(i)
2474 AND p_doc_headers_rec.has_errors(i) = 'N'
2475 AND p_doc_headers_rec.action(i) = 'UPDATE';
2476
2477 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of interface headers PROCESSED='||SQL%rowcount); END IF;
2478
2479
2480 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
2481 EXCEPTION
2482 WHEN OTHERS THEN
2483 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
2484 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
2485 END update_doc_headers;
2486
2487 --------------------------------------------------------------------------------
2488 --Start of Comments
2489 --Name: delete_doc_headers
2490 --Pre-reqs:
2491 -- The iP catalog data is populated in PO Interface tables.
2492 --Modifies:
2493 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
2494 -- to the Interface tables.
2495 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
2496 -- failed the migration.
2497 -- c) FND_MSG_PUB on unhandled exceptions.
2498 --Locks:
2499 -- None.
2500 --Function:
2501 -- Deletes a batch of document headers given in a plsql table, from the transaction
2502 -- tables:
2503 --Parameters:
2504 --IN:
2505 -- p_doc_headers_rec
2506 -- A table of plsql records containing a batch of header information for
2507 -- creating a new GBPA header.
2508 --OUT:
2509 --
2510 --End of Comments
2511 --------------------------------------------------------------------------------
2512 PROCEDURE delete_doc_headers
2513 (
2514 p_doc_headers_rec IN record_of_headers_type
2515 )
2516 IS
2517 l_api_name CONSTANT VARCHAR2(30) := 'delete_doc_headers';
2518 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
2519 l_progress VARCHAR2(3) := '000';
2520
2521 l_return_status VARCHAR2(1);
2522
2523 l_po_header_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
2524 l_po_line_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
2525 BEGIN
2526 l_progress := '010';
2527 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
2528
2529 -- Delete Rows that do not have errors and action = 'DELETE',
2530 FORALL i IN 1.. p_doc_headers_rec.po_header_id.COUNT
2531 DELETE FROM po_headers_all
2532 WHERE po_header_id = p_doc_headers_rec.po_header_id(i)
2533 AND p_doc_headers_rec.has_errors(i) = 'N'
2534 AND p_doc_headers_rec.action(i) = 'DELETE'
2535 RETURNING po_header_id
2536 BULK COLLECT INTO l_po_header_ids;
2537
2538 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of headers deleted='||SQL%rowcount); END IF;
2539
2540 l_progress := '020';
2541
2542 -- For each of the above GBPA Header, delete the default Org Assignments Row
2543 FORALL i IN 1.. l_po_header_ids.COUNT
2544 DELETE FROM PO_GA_ORG_ASSIGNMENTS
2545 WHERE po_header_id = l_po_header_ids(i);
2546
2547 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Org Assignments deleted='||SQL%rowcount); END IF;
2548
2549 l_progress := '030';
2550
2551 -- Delete from PO Lines
2552 FORALL i IN 1.. l_po_header_ids.COUNT
2553 DELETE FROM PO_LINES_ALL
2554 WHERE po_header_id = l_po_header_ids(i)
2555 RETURNING po_line_id
2556 BULK COLLECT INTO l_po_line_ids;
2557
2558 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of lines deleted='||SQL%rowcount); END IF;
2559
2560 l_progress := '040';
2561
2562 -- Delete from Attribute tables
2563 FORALL i IN 1.. l_po_line_ids.COUNT
2564 DELETE FROM PO_ATTRIBUTE_VALUES
2565 WHERE PO_LINE_ID = l_po_line_ids(i);
2566
2567 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Attr deleted='||SQL%rowcount); END IF;
2568
2569 l_progress := '050';
2570
2571 -- Delete from Attribute TLP tables
2572 FORALL i IN 1.. l_po_line_ids.COUNT
2573 DELETE FROM PO_ATTRIBUTE_VALUES_TLP
2574 WHERE PO_LINE_ID = l_po_line_ids(i);
2575
2576 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of TLP deleted='||SQL%rowcount); END IF;
2577
2578 l_progress := '100';
2579 -- Mark headers interface as PROCESSED
2580 FORALL i IN 1.. p_doc_headers_rec.po_header_id.COUNT
2581 UPDATE po_headers_interface
2582 SET process_code = g_PROCESS_CODE_PROCESSED
2583 WHERE interface_header_id = p_doc_headers_rec.interface_header_id(i)
2584 AND p_doc_headers_rec.has_errors(i) = 'N'
2585 AND p_doc_headers_rec.action(i) = 'DELETE';
2586
2587 l_progress := '110';
2588 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Headers Interface records PROCESSED='||SQL%rowcount); END IF;
2589
2590 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
2591 EXCEPTION
2592 WHEN OTHERS THEN
2593 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
2594 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
2595 END delete_doc_headers;
2596
2597 --------------------------------------------------------------------------------
2598 --Start of Comments
2599 --Name: migrate_document_lines
2600 --Pre-reqs:
2601 -- The iP catalog data is populated in PO Interface tables.
2602 --Modifies:
2603 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
2604 -- to the Interface tables.
2605 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
2606 -- failed the migration.
2607 -- c) FND_MSG_PUB on unhandled exceptions.
2608 --Locks:
2609 -- None.
2610 --Function:
2611 -- Migrate the document lines for GBPA/BPA/Quotations.
2612 -- This API should be called during the upgrade phase only.
2613 --Parameters:
2614 --IN:
2615 --p_validate_only_mode
2616 -- Indicates if the API is being called in a Validate Only mode or not
2617 --OUT:
2618 --
2619 --End of Comments
2620 --------------------------------------------------------------------------------
2621 PROCEDURE migrate_document_lines
2622 (
2623 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
2624 )
2625 IS
2626 l_api_name CONSTANT VARCHAR2(30) := 'migrate_document_lines';
2627 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
2628 l_progress VARCHAR2(3) := '000';
2629
2630 -- SQL What: Cursor to load lines
2631 -- SQL Why : To migrate data to PO txn tables
2632 -- SQL Join: processing_id, action
2633 CURSOR load_lines_csr(request_processing_id NUMBER) IS
2634 SELECT lines.interface_line_id,
2635 lines.interface_header_id,
2636 lines.action,
2637 lines.group_code,
2638 lines.line_num,
2639 lines.po_line_id,
2640 lines.shipment_num,
2641 lines.line_location_id,
2642 lines.shipment_type,
2643 lines.requisition_line_id,
2644 lines.document_num,
2645 lines.release_num,
2646 lines.po_header_id,
2647 lines.po_release_id,
2648 lines.source_shipment_id,
2649 lines.contract_num,
2650 lines.line_type,
2651 lines.line_type_id,
2652 lines.item,
2653 lines.item_id,
2654 lines.item_revision,
2655 lines.category,
2656 lines.category_id,
2657 lines.item_description,
2658 lines.vendor_product_num,
2659 lines.uom_code,
2660 lines.unit_of_measure,
2661 lines.quantity,
2662 lines.committed_amount,
2663 lines.min_order_quantity,
2664 lines.max_order_quantity,
2665 lines.unit_price,
2666 lines.list_price_per_unit,
2667 lines.market_price,
2668 lines.allow_price_override_flag,
2669 lines.not_to_exceed_price,
2670 lines.negotiated_by_preparer_flag,
2671 lines.un_number,
2672 lines.un_number_id,
2673 lines.hazard_class,
2674 lines.hazard_class_id,
2675 lines.note_to_vendor,
2676 lines.transaction_reason_code,
2677 lines.taxable_flag,
2678 lines.tax_name,
2679 lines.type_1099,
2680 lines.capital_expense_flag,
2681 lines.inspection_required_flag,
2682 lines.receipt_required_flag,
2683 lines.payment_terms,
2684 lines.terms_id,
2685 lines.price_type,
2686 lines.min_release_amount,
2687 lines.price_break_lookup_code,
2688 lines.ussgl_transaction_code,
2689 lines.closed_code,
2690 lines.closed_reason,
2691 lines.closed_date,
2692 lines.closed_by,
2693 lines.invoice_close_tolerance,
2694 lines.receive_close_tolerance,
2695 lines.firm_flag,
2696 lines.days_early_receipt_allowed,
2697 lines.days_late_receipt_allowed,
2698 lines.enforce_ship_to_location_code,
2699 lines.allow_substitute_receipts_flag,
2700 lines.receiving_routing,
2701 lines.receiving_routing_id,
2702 lines.qty_rcv_tolerance,
2703 lines.over_tolerance_error_flag,
2704 lines.qty_rcv_exception_code,
2705 lines.receipt_days_exception_code,
2706 lines.ship_to_organization_code,
2707 lines.ship_to_organization_id,
2708 lines.ship_to_location,
2709 lines.ship_to_location_id,
2710 lines.need_by_date,
2711 lines.promised_date,
2712 lines.accrue_on_receipt_flag,
2713 lines.lead_time,
2714 lines.lead_time_unit,
2715 lines.price_discount,
2716 lines.freight_carrier,
2717 lines.fob,
2718 lines.freight_terms,
2719 lines.effective_date,
2720 lines.expiration_date,
2721 lines.from_header_id,
2722 lines.from_line_id,
2723 lines.from_line_location_id,
2724 lines.line_attribute_category_lines,
2725 lines.line_attribute1,
2726 lines.line_attribute2,
2727 lines.line_attribute3,
2728 lines.line_attribute4,
2729 lines.line_attribute5,
2730 lines.line_attribute6,
2731 lines.line_attribute7,
2732 lines.line_attribute8,
2733 lines.line_attribute9,
2734 lines.line_attribute10,
2735 lines.line_attribute11,
2736 lines.line_attribute12,
2737 lines.line_attribute13,
2738 lines.line_attribute14,
2739 lines.line_attribute15,
2740 lines.shipment_attribute_category,
2741 lines.shipment_attribute1,
2742 lines.shipment_attribute2,
2743 lines.shipment_attribute3,
2744 lines.shipment_attribute4,
2745 lines.shipment_attribute5,
2746 lines.shipment_attribute6,
2747 lines.shipment_attribute7,
2748 lines.shipment_attribute8,
2749 lines.shipment_attribute9,
2750 lines.shipment_attribute10,
2751 lines.shipment_attribute11,
2752 lines.shipment_attribute12,
2753 lines.shipment_attribute13,
2754 lines.shipment_attribute14,
2755 lines.shipment_attribute15,
2756 lines.last_update_date,
2757 lines.last_updated_by,
2758 lines.last_update_login,
2759 lines.creation_date,
2760 lines.created_by,
2761 lines.request_id,
2762 lines.program_application_id,
2763 lines.program_id,
2764 lines.program_update_date,
2765 lines.invoice_close_tolerance,
2766 lines.organization_id,
2767 lines.item_attribute_category,
2768 lines.item_attribute1,
2769 lines.item_attribute2,
2770 lines.item_attribute3,
2771 lines.item_attribute4,
2772 lines.item_attribute5,
2773 lines.item_attribute6,
2774 lines.item_attribute7,
2775 lines.item_attribute8,
2776 lines.item_attribute9,
2777 lines.item_attribute10,
2778 lines.item_attribute11,
2779 lines.item_attribute12,
2780 lines.item_attribute13,
2781 lines.item_attribute14,
2782 lines.item_attribute15,
2783 lines.unit_weight,
2784 lines.weight_uom_code,
2785 lines.volume_uom_code,
2786 lines.unit_volume,
2787 lines.template_id,
2788 lines.template_name,
2789 lines.line_reference_num,
2790 lines.sourcing_rule_name,
2791 lines.tax_status_indicator,
2792 lines.process_code,
2793 lines.price_chg_accept_flag,
2794 lines.price_break_flag,
2795 lines.price_update_tolerance,
2796 lines.tax_user_override_flag,
2797 lines.tax_code_id,
2798 lines.note_to_receiver,
2799 lines.oke_contract_header_id,
2800 lines.oke_contract_header_num,
2801 lines.oke_contract_version_id,
2802 lines.secondary_unit_of_measure,
2803 lines.secondary_uom_code,
2804 lines.secondary_quantity,
2805 lines.preferred_grade,
2806 lines.vmi_flag,
2807 lines.auction_header_id,
2808 lines.auction_line_number,
2809 lines.auction_display_number,
2810 lines.bid_number,
2811 lines.bid_line_number,
2812 lines.orig_from_req_flag,
2813 lines.consigned_flag,
2814 NULL, --lines.supplier_ref_number, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2815 NULL, --lines.contract_id, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2816 NULL, --lines.job_id, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2817 NULL, --lines.amount, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2818 NULL, --lines.job_name, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2819 NULL, --lines.contractor_first_name, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2820 NULL, --lines.contractor_last_name, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2821 NULL, --lines.drop_ship_flag, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2822 NULL, --lines.base_unit_price, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2823 NULL, --lines.transaction_flow_header_id, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2824 NULL, --lines.job_business_group_id, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2825 NULL, --lines.job_business_group_name, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2826 NULL, --lines.tracking_quantity_ind, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2827 NULL, --lines.secondary_default_ind, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2828 NULL, --lines.dual_uom_deviation_high, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2829 NULL, --lines.dual_uom_deviation_low, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2830 lines.processing_id,
2831 NULL, --lines.line_loc_populated_flag, TODO: Not present in 11.5.9. For 11.5.10, default NULL
2832 lines.catalog_name,
2833 lines.supplier_part_auxid,
2834 lines.ip_category_id,
2835 NULL, --lines.ip_category_name
2836 'N', -- has_errors
2837 NULL, -- org_id: Not present in interface tables. Just initialize the collection
2838 NULL, -- order_type_lookup_code: Not present in interface tables. Just initialize the collection
2839 NULL, -- purchase_basis: Not present in interface tables. Just initialize the collection
2840 NULL -- matching_basis: Not present in interface tables. Just initialize the collection
2841 FROM po_lines_interface lines
2842 WHERE lines.processing_id = request_processing_id
2843 AND lines.process_code = PO_R12_CAT_UPG_PVT.g_PROCESS_CODE_NEW
2844 AND lines.action IN (PO_R12_CAT_UPG_PVT.g_action_line_create, 'UPDATE', 'DELETE');
2845
2846 l_doc_lines_table record_of_lines_type;
2847 l_err_interface_line_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
2848 l_count NUMBER := NULL;
2849 BEGIN
2850 l_progress := '010';
2851 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
2852
2853 -- Algorithm:
2854 -- 1. Load Lines batch (batch_size) into pl/sql table.
2855 -- 2. Call PDOI modules to process data in batches (default, derive, validate).
2856 -- 3. Get the validated pl/sql table for the batch from PDOI.
2857 -- 4. Transfer directly to Transaction tables
2858
2859 OPEN load_lines_csr(g_processing_id);
2860
2861 l_progress := '020';
2862 LOOP
2863 BEGIN -- block to handle SNAPSHOT_TOO_OLD exception
2864 l_progress := '025';
2865 FETCH load_lines_csr BULK COLLECT INTO
2866 l_doc_lines_table.interface_line_id,
2867 l_doc_lines_table.interface_header_id,
2868 l_doc_lines_table.action,
2869 l_doc_lines_table.group_code,
2870 l_doc_lines_table.line_num,
2871 l_doc_lines_table.po_line_id,
2872 l_doc_lines_table.shipment_num,
2873 l_doc_lines_table.line_location_id,
2874 l_doc_lines_table.shipment_type,
2875 l_doc_lines_table.requisition_line_id,
2876 l_doc_lines_table.document_num,
2877 l_doc_lines_table.release_num,
2878 l_doc_lines_table.po_header_id,
2879 l_doc_lines_table.po_release_id,
2880 l_doc_lines_table.source_shipment_id,
2881 l_doc_lines_table.contract_num,
2882 l_doc_lines_table.line_type,
2883 l_doc_lines_table.line_type_id,
2884 l_doc_lines_table.item,
2885 l_doc_lines_table.item_id,
2886 l_doc_lines_table.item_revision,
2887 l_doc_lines_table.category,
2888 l_doc_lines_table.category_id,
2889 l_doc_lines_table.item_description,
2890 l_doc_lines_table.vendor_product_num,
2891 l_doc_lines_table.uom_code,
2892 l_doc_lines_table.unit_of_measure,
2893 l_doc_lines_table.quantity,
2894 l_doc_lines_table.committed_amount,
2895 l_doc_lines_table.min_order_quantity,
2896 l_doc_lines_table.max_order_quantity,
2897 l_doc_lines_table.unit_price,
2898 l_doc_lines_table.list_price_per_unit,
2899 l_doc_lines_table.market_price,
2900 l_doc_lines_table.allow_price_override_flag,
2901 l_doc_lines_table.not_to_exceed_price,
2902 l_doc_lines_table.negotiated_by_preparer_flag,
2903 l_doc_lines_table.un_number,
2904 l_doc_lines_table.un_number_id,
2905 l_doc_lines_table.hazard_class,
2906 l_doc_lines_table.hazard_class_id,
2907 l_doc_lines_table.note_to_vendor,
2908 l_doc_lines_table.transaction_reason_code,
2909 l_doc_lines_table.taxable_flag,
2910 l_doc_lines_table.tax_name,
2911 l_doc_lines_table.type_1099,
2912 l_doc_lines_table.capital_expense_flag,
2913 l_doc_lines_table.inspection_required_flag,
2914 l_doc_lines_table.receipt_required_flag,
2915 l_doc_lines_table.payment_terms,
2916 l_doc_lines_table.terms_id,
2917 l_doc_lines_table.price_type,
2918 l_doc_lines_table.min_release_amount,
2919 l_doc_lines_table.price_break_lookup_code,
2920 l_doc_lines_table.ussgl_transaction_code,
2921 l_doc_lines_table.closed_code,
2922 l_doc_lines_table.closed_reason,
2923 l_doc_lines_table.closed_date,
2924 l_doc_lines_table.closed_by,
2925 l_doc_lines_table.invoice_close_tolerance,
2926 l_doc_lines_table.receive_close_tolerance,
2927 l_doc_lines_table.firm_flag,
2928 l_doc_lines_table.days_early_receipt_allowed,
2929 l_doc_lines_table.days_late_receipt_allowed,
2930 l_doc_lines_table.enforce_ship_to_location_code,
2931 l_doc_lines_table.allow_substitute_receipts_flag,
2932 l_doc_lines_table.receiving_routing,
2933 l_doc_lines_table.receiving_routing_id,
2934 l_doc_lines_table.qty_rcv_tolerance,
2935 l_doc_lines_table.over_tolerance_error_flag,
2936 l_doc_lines_table.qty_rcv_exception_code,
2937 l_doc_lines_table.receipt_days_exception_code,
2938 l_doc_lines_table.ship_to_organization_code,
2939 l_doc_lines_table.ship_to_organization_id,
2940 l_doc_lines_table.ship_to_location,
2941 l_doc_lines_table.ship_to_location_id,
2942 l_doc_lines_table.need_by_date,
2943 l_doc_lines_table.promised_date,
2944 l_doc_lines_table.accrue_on_receipt_flag,
2945 l_doc_lines_table.lead_time,
2946 l_doc_lines_table.lead_time_unit,
2947 l_doc_lines_table.price_discount,
2948 l_doc_lines_table.freight_carrier,
2949 l_doc_lines_table.fob,
2950 l_doc_lines_table.freight_terms,
2951 l_doc_lines_table.effective_date,
2952 l_doc_lines_table.expiration_date,
2953 l_doc_lines_table.from_header_id,
2954 l_doc_lines_table.from_line_id,
2955 l_doc_lines_table.from_line_location_id,
2956 l_doc_lines_table.line_attribute_category_lines,
2957 l_doc_lines_table.line_attribute1,
2958 l_doc_lines_table.line_attribute2,
2959 l_doc_lines_table.line_attribute3,
2960 l_doc_lines_table.line_attribute4,
2961 l_doc_lines_table.line_attribute5,
2962 l_doc_lines_table.line_attribute6,
2963 l_doc_lines_table.line_attribute7,
2964 l_doc_lines_table.line_attribute8,
2965 l_doc_lines_table.line_attribute9,
2966 l_doc_lines_table.line_attribute10,
2967 l_doc_lines_table.line_attribute11,
2968 l_doc_lines_table.line_attribute12,
2969 l_doc_lines_table.line_attribute13,
2970 l_doc_lines_table.line_attribute14,
2971 l_doc_lines_table.line_attribute15,
2972 l_doc_lines_table.shipment_attribute_category,
2973 l_doc_lines_table.shipment_attribute1,
2974 l_doc_lines_table.shipment_attribute2,
2975 l_doc_lines_table.shipment_attribute3,
2976 l_doc_lines_table.shipment_attribute4,
2977 l_doc_lines_table.shipment_attribute5,
2978 l_doc_lines_table.shipment_attribute6,
2979 l_doc_lines_table.shipment_attribute7,
2980 l_doc_lines_table.shipment_attribute8,
2981 l_doc_lines_table.shipment_attribute9,
2982 l_doc_lines_table.shipment_attribute10,
2983 l_doc_lines_table.shipment_attribute11,
2984 l_doc_lines_table.shipment_attribute12,
2985 l_doc_lines_table.shipment_attribute13,
2986 l_doc_lines_table.shipment_attribute14,
2987 l_doc_lines_table.shipment_attribute15,
2988 l_doc_lines_table.last_update_date,
2989 l_doc_lines_table.last_updated_by,
2990 l_doc_lines_table.last_update_login,
2991 l_doc_lines_table.creation_date,
2992 l_doc_lines_table.created_by,
2993 l_doc_lines_table.request_id,
2994 l_doc_lines_table.program_application_id,
2995 l_doc_lines_table.program_id,
2996 l_doc_lines_table.program_update_date,
2997 l_doc_lines_table.invoice_close_tolerance,
2998 l_doc_lines_table.organization_id,
2999 l_doc_lines_table.item_attribute_category,
3000 l_doc_lines_table.item_attribute1,
3001 l_doc_lines_table.item_attribute2,
3002 l_doc_lines_table.item_attribute3,
3003 l_doc_lines_table.item_attribute4,
3004 l_doc_lines_table.item_attribute5,
3005 l_doc_lines_table.item_attribute6,
3006 l_doc_lines_table.item_attribute7,
3007 l_doc_lines_table.item_attribute8,
3008 l_doc_lines_table.item_attribute9,
3009 l_doc_lines_table.item_attribute10,
3010 l_doc_lines_table.item_attribute11,
3011 l_doc_lines_table.item_attribute12,
3012 l_doc_lines_table.item_attribute13,
3013 l_doc_lines_table.item_attribute14,
3014 l_doc_lines_table.item_attribute15,
3015 l_doc_lines_table.unit_weight,
3016 l_doc_lines_table.weight_uom_code,
3017 l_doc_lines_table.volume_uom_code,
3018 l_doc_lines_table.unit_volume,
3019 l_doc_lines_table.template_id,
3020 l_doc_lines_table.template_name,
3021 l_doc_lines_table.line_reference_num,
3022 l_doc_lines_table.sourcing_rule_name,
3023 l_doc_lines_table.tax_status_indicator,
3024 l_doc_lines_table.process_code,
3025 l_doc_lines_table.price_chg_accept_flag,
3026 l_doc_lines_table.price_break_flag,
3027 l_doc_lines_table.price_update_tolerance,
3028 l_doc_lines_table.tax_user_override_flag,
3029 l_doc_lines_table.tax_code_id,
3030 l_doc_lines_table.note_to_receiver,
3031 l_doc_lines_table.oke_contract_header_id,
3032 l_doc_lines_table.oke_contract_header_num,
3033 l_doc_lines_table.oke_contract_version_id,
3034 l_doc_lines_table.secondary_unit_of_measure,
3035 l_doc_lines_table.secondary_uom_code,
3036 l_doc_lines_table.secondary_quantity,
3037 l_doc_lines_table.preferred_grade,
3038 l_doc_lines_table.vmi_flag,
3039 l_doc_lines_table.auction_header_id,
3040 l_doc_lines_table.auction_line_number,
3041 l_doc_lines_table.auction_display_number,
3042 l_doc_lines_table.bid_number,
3043 l_doc_lines_table.bid_line_number,
3044 l_doc_lines_table.orig_from_req_flag,
3045 l_doc_lines_table.consigned_flag,
3046 l_doc_lines_table.supplier_ref_number,
3047 l_doc_lines_table.contract_id,
3048 l_doc_lines_table.job_id,
3049 l_doc_lines_table.amount,
3050 l_doc_lines_table.job_name,
3051 l_doc_lines_table.contractor_first_name,
3052 l_doc_lines_table.contractor_last_name,
3053 l_doc_lines_table.drop_ship_flag,
3054 l_doc_lines_table.base_unit_price,
3055 l_doc_lines_table.transaction_flow_header_id,
3056 l_doc_lines_table.job_business_group_id,
3057 l_doc_lines_table.job_business_group_name,
3058 l_doc_lines_table.tracking_quantity_ind,
3059 l_doc_lines_table.secondary_default_ind,
3060 l_doc_lines_table.dual_uom_deviation_high,
3061 l_doc_lines_table.dual_uom_deviation_low,
3062 l_doc_lines_table.processing_id,
3063 l_doc_lines_table.line_loc_populated_flag,
3064 l_doc_lines_table.catalog_name,
3065 l_doc_lines_table.supplier_part_auxid,
3066 l_doc_lines_table.ip_category_id,
3067 l_doc_lines_table.ip_category_name,
3068 l_doc_lines_table.has_errors,
3069 l_doc_lines_table.org_id,
3070 l_doc_lines_table.order_type_lookup_code,
3071 l_doc_lines_table.purchase_basis,
3072 l_doc_lines_table.matching_basis
3073 LIMIT g_job.batch_size;
3074
3075 l_progress := '030';
3076
3077 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_doc_lines_table.interface_line_id.COUNT='||l_doc_lines_table.interface_line_id.COUNT); END IF;
3078
3079 EXIT WHEN l_doc_lines_table.interface_line_id.COUNT = 0;
3080
3081 l_progress := '040';
3082 -- derive logic
3083 --PO_PROCESS_LINES_PVT.derive_lines(l_doc_lines_table);
3084
3085 l_progress := '050';
3086 -- default logic
3087 PO_R12_CAT_UPG_DEF_PVT.default_lines(l_doc_lines_table);
3088
3089 l_progress := '060';
3090 -- validate logic
3091 PO_R12_CAT_UPG_VAL_PVT.validate_lines(l_doc_lines_table);
3092
3093 l_progress := '070';
3094 -- Skip transfer if running in Validate Only mode.
3095 IF (p_validate_only_mode = FND_API.G_FALSE) THEN
3096 -- Transfer Lines
3097 transfer_doc_lines(p_doc_lines_rec => l_doc_lines_table);
3098
3099 l_progress := '080';
3100 -- cascade rejected status to attribute and other levels
3101 l_count := 0;
3102 FOR i IN 1..l_doc_lines_table.interface_line_id.COUNT
3103 LOOP
3104 IF (l_doc_lines_table.has_errors(i) = 'Y') THEN
3105 l_count := l_count + 1;
3106 l_err_interface_line_ids(l_count) := l_doc_lines_table.interface_line_id(i);
3107 END IF;
3108 END LOOP;
3109
3110 l_progress := '090';
3111 IF (l_count > 0) THEN
3112 PO_R12_CAT_UPG_UTL.reject_lines_intf('INTERFACE_LINE_ID',
3113 l_err_interface_line_ids,
3114 FND_API.G_TRUE);
3115 END IF;
3116
3117 END IF; -- IF (p_validate_only_mode = FND_API.G_FALSE)
3118
3119 l_progress := '100';
3120 COMMIT;
3121
3122 -- Call IP's API to update the line ID in IP's tables
3123 update_ip_tables_line
3124 (
3125 p_doc_lines_table => l_doc_lines_table
3126 );
3127
3128 l_progress := '110';
3129 IF (l_doc_lines_table.interface_line_id.COUNT
3130 < g_job.batch_size) THEN
3131 EXIT;
3132 END IF;
3133 l_progress := '120';
3134 EXCEPTION
3135 WHEN g_SNAPSHOT_TOO_OLD THEN
3136 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'EXCEPTION: SNAPSHOT_TOO_OLD. Now commiting and re-opening the load_lines_csr'); END IF;
3137
3138 -- Commit and re-open the cursor
3139 l_progress := '130';
3140 COMMIT;
3141
3142 l_progress := '140';
3143 CLOSE load_lines_csr;
3144
3145 l_progress := '150';
3146 OPEN load_lines_csr(g_processing_id);
3147 l_progress := '160';
3148 END; -- block to handle SNAPSHOT_TOO_OLD exception
3149 END LOOP;
3150
3151 l_progress := '170';
3152 IF (load_lines_csr%ISOPEN) THEN
3153 CLOSE load_lines_csr;
3154 END IF;
3155
3156 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
3157 EXCEPTION
3158 WHEN OTHERS THEN
3159 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
3160 IF (load_lines_csr%ISOPEN) THEN
3161 CLOSE load_lines_csr;
3162 END IF;
3163 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
3164 END migrate_document_lines;
3165
3166 --------------------------------------------------------------------------------
3167 --Start of Comments
3168 --Name: transfer_doc_lines
3169 --Pre-reqs:
3170 -- The iP catalog data is populated in PO Interface tables.
3171 --Modifies:
3172 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
3173 -- to the Interface tables.
3174 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
3175 -- failed the migration.
3176 -- c) FND_MSG_PUB on unhandled exceptions.
3177 --Locks:
3178 -- None.
3179 --Function:
3180 -- Transfers a batch of document lines given in a plsql table, into the
3181 -- transaction tables.
3182 -- This API should be called during the upgrade phase only.
3183 --Parameters:
3184 --IN:
3185 -- p_doc_lines_rec
3186 -- A table of plsql records containing a batch of line information for
3187 -- creating a new line.
3188 --OUT:
3189 --End of Comments
3190 --------------------------------------------------------------------------------
3191 PROCEDURE transfer_doc_lines
3192 (
3193 p_doc_lines_rec IN record_of_lines_type
3194 )
3195 IS
3196 l_api_name CONSTANT VARCHAR2(30) := 'transfer_doc_lines';
3197 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
3198 l_progress VARCHAR2(3) := '000';
3199
3200 BEGIN
3201 l_progress := '010';
3202 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
3203
3204 -- Insert Lines
3205 insert_doc_lines(p_doc_lines_rec => p_doc_lines_rec);
3206
3207 l_progress := '020';
3208 -- Update Lines
3209 update_doc_lines(p_doc_lines_rec => p_doc_lines_rec);
3210
3211 l_progress := '030';
3212 -- Delete Lines
3213 delete_doc_lines(p_doc_lines_rec => p_doc_lines_rec);
3214
3215 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
3216 EXCEPTION
3217 WHEN OTHERS THEN
3218 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
3219 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
3220 END transfer_doc_lines;
3221
3222 --------------------------------------------------------------------------------
3223 --Start of Comments
3224 --Name: get_hdr_process_code_list
3225 --Pre-reqs:
3226 -- The iP catalog data is populated in PO Interface tables.
3227 --Modifies:
3228 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
3229 -- to the Interface tables.
3230 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
3231 -- failed the migration.
3232 -- c) FND_MSG_PUB on unhandled exceptions.
3233 --Locks:
3234 -- None.
3235 --Function:
3236 -- Inserts a batch of document lines given in a plsql table, into the transaction
3237 -- tables.
3238 -- This API should be called during the upgrade phase only.
3239 --Parameters:
3240 --IN:
3241 -- p_doc_lines_rec
3242 -- A table of plsql records containing a batch of line information for
3243 -- creating a new GBPA line.
3244 --OUT:
3245 --End of Comments
3246 --------------------------------------------------------------------------------
3247 PROCEDURE get_hdr_process_code_list
3248 (
3249 p_doc_lines_rec IN record_of_lines_type
3250 , x_process_code_list IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_VARCHAR25
3251 )
3252 IS
3253 l_api_name CONSTANT VARCHAR2(30) := 'get_hdr_process_code_list';
3254 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
3255 l_progress VARCHAR2(3) := '000';
3256
3257 l_key PO_SESSION_GT.key%TYPE;
3258 i NUMBER;
3259 l_subscript_array PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
3260 l_indexes PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
3261 l_process_code_list PO_R12_CAT_UPG_TYPES.PO_TBL_VARCHAR25;
3262 l_index NUMBER;
3263 BEGIN
3264 l_progress := '010';
3265 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
3266
3267 IF (p_doc_lines_rec.interface_line_id IS NULL OR
3268 p_doc_lines_rec.interface_line_id.COUNT = 0) THEN
3269 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Early return because there are no records to process.'); END IF;
3270 RETURN;
3271 END IF;
3272
3273 -- pick a new key from temp table which will be used in all validate logic
3274 SELECT PO_SESSION_GT_S.nextval
3275 INTO l_key
3276 FROM DUAL;
3277
3278 l_progress := '020';
3279 l_subscript_array := PO_R12_CAT_UPG_UTL.construct_subscript_array(p_doc_lines_rec.interface_line_id.COUNT);
3280
3281 -- Check if the header had any errors. If yes, we need to skip the insert of the line
3282 l_progress := '030';
3283 FORALL i IN 1 .. p_doc_lines_rec.interface_line_id.COUNT
3284 INSERT INTO PO_SESSION_GT(key,
3285 num1,
3286 char1)
3287 SELECT l_key,
3288 l_subscript_array(i),
3289 POHI.process_code
3290 FROM PO_HEADERS_INTERFACE POHI
3291 WHERE interface_header_id = p_doc_lines_rec.interface_header_id(i);
3292
3293 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of rows insert into GT table='||SQL%rowcount); END IF;
3294
3295 l_progress := '040';
3296 -- SQL What: Transfer from session GT table to local arrays
3297 -- SQL Why : It will be used to get the process_codes
3298 -- SQL Join: key
3299 DELETE FROM PO_SESSION_GT
3300 WHERE key = l_key
3301 RETURNING num1, char1
3302 BULK COLLECT INTO l_indexes, l_process_code_list;
3303
3304 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of rows deleted from GT table='||SQL%rowcount); END IF;
3305
3306 -- Rearrange the indexes properly
3307 l_progress := '050';
3308 FOR i IN 1 .. l_indexes.COUNT
3309 LOOP
3310 x_process_code_list(i) := NULL;
3311 END LOOP;
3312
3313 l_progress := '060';
3314 -- Mark the error records
3315 FOR i IN 1 .. l_indexes.COUNT
3316 LOOP
3317 l_index := l_indexes(i);
3318 x_process_code_list(l_index) := l_process_code_list(i);
3319 END LOOP;
3320
3321 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'x_process_code_list(1)='||x_process_code_list(1)); END IF;
3322
3323 l_progress := '070';
3324 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
3325 EXCEPTION
3326 WHEN OTHERS THEN
3327 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
3328 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
3329 END get_hdr_process_code_list;
3330
3331 --------------------------------------------------------------------------------
3332 --Start of Comments
3333 --Name: insert_doc_lines
3334 --Pre-reqs:
3335 -- The iP catalog data is populated in PO Interface tables.
3336 --Modifies:
3337 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
3338 -- to the Interface tables.
3339 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
3340 -- failed the migration.
3341 -- c) FND_MSG_PUB on unhandled exceptions.
3342 --Locks:
3343 -- None.
3344 --Function:
3345 -- Inserts a batch of document lines given in a plsql table, into the transaction
3346 -- tables.
3347 -- This API should be called during the upgrade phase only.
3348 --Parameters:
3349 --IN:
3350 -- p_doc_lines_rec
3351 -- A table of plsql records containing a batch of line information for
3352 -- creating a new GBPA line.
3353 --OUT:
3354 --End of Comments
3355 --------------------------------------------------------------------------------
3356 PROCEDURE insert_doc_lines
3357 (
3358 p_doc_lines_rec IN record_of_lines_type
3359 )
3360 IS
3361 l_api_name CONSTANT VARCHAR2(30) := 'insert_doc_lines';
3362 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
3363 l_progress VARCHAR2(3) := '000';
3364
3365 l_max_po_line_num PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
3366
3367 l_valid_lines record_of_lines_type;
3368 l_count NUMBER;
3369 l_key PO_SESSION_GT.key%TYPE;
3370 i NUMBER;
3371 l_process_code_list PO_R12_CAT_UPG_TYPES.PO_TBL_VARCHAR25;
3372 BEGIN
3373 l_progress := '010';
3374 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
3375
3376 get_hdr_process_code_list
3377 (
3378 p_doc_lines_rec => p_doc_lines_rec
3379 , x_process_code_list => l_process_code_list
3380 );
3381
3382 -- Get the valid rows into l_valid_headers array.
3383 l_count := 0;
3384 FOR i IN 1 .. p_doc_lines_rec.interface_line_id.COUNT
3385 LOOP
3386 l_progress := '020';
3387
3388 IF (p_doc_lines_rec.has_errors(i) = 'N'
3389 AND l_process_code_list(i) = PO_R12_CAT_UPG_PVT.g_PROCESS_CODE_PROCESSED
3390 AND p_doc_lines_rec.action(i) = PO_R12_CAT_UPG_PVT.g_action_line_create) THEN
3391 l_progress := '030';
3392
3393 l_count := l_count + 1;
3394
3395 l_progress := '040';
3396 -- Get the next po_line_id from the sequence
3397 SELECT PO_LINES_S.nextval
3398 INTO l_valid_lines.po_line_id(l_count)
3399 FROM dual;
3400
3401 l_progress := '050';
3402 -- Assign Line Numbers.
3403 -- For each PO Header, assign a value in l_max_line_num array.
3404 -- If an entry does not exist in the array, query the max(line_num) from
3405 -- the tables and assign max(line_num)+1 to l_max_line_num of that Header.
3406 -- If an entry already exists, then increment max_line_num.
3407 IF (l_max_po_line_num.exists(p_doc_lines_rec.po_header_id(i))) THEN
3408 l_progress := '060';
3409 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_max_po_line_num(p_doc_lines_rec.po_header_id(i))='||l_max_po_line_num(p_doc_lines_rec.po_header_id(i))); END IF;
3410
3411 l_max_po_line_num(p_doc_lines_rec.po_header_id(i)) :=
3412 l_max_po_line_num(p_doc_lines_rec.po_header_id(i)) + 1;
3413 ELSE
3414 l_progress := '070';
3415 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'max_line_num for po_header_id['||p_doc_lines_rec.po_header_id(i)||'] does not exist'); END IF;
3416
3417 SELECT (NVL(max(line_num), 0) + 1)
3418 INTO l_max_po_line_num(p_doc_lines_rec.po_header_id(i))
3419 FROM PO_LINES_ALL
3420 WHERE po_header_id = p_doc_lines_rec.po_header_id(i);
3421
3422 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Queried max_line_num for po_header_id['||p_doc_lines_rec.po_header_id(i)||'] from tables='||l_max_po_line_num(p_doc_lines_rec.po_header_id(i))); END IF;
3423 END IF;
3424
3425 l_progress := '080';
3426 -- Finally, copy the value of l_max_po_line_num into the structure
3427 l_valid_lines.line_num(l_count) := l_max_po_line_num(p_doc_lines_rec.po_header_id(i));
3428
3429 l_valid_lines.interface_line_id(l_count) := p_doc_lines_rec.interface_line_id(i);
3430 l_valid_lines.interface_header_id(l_count) := p_doc_lines_rec.interface_header_id(i);
3431 l_valid_lines.action(l_count) := p_doc_lines_rec.action(i);
3432 l_valid_lines.group_code(l_count) := p_doc_lines_rec.group_code(i);
3433 l_valid_lines.shipment_num(l_count) := p_doc_lines_rec.shipment_num(i);
3434 l_valid_lines.line_location_id(l_count) := p_doc_lines_rec.line_location_id(i);
3435 l_valid_lines.shipment_type(l_count) := p_doc_lines_rec.shipment_type(i);
3436 l_valid_lines.requisition_line_id(l_count) := p_doc_lines_rec.requisition_line_id(i);
3437 l_valid_lines.document_num(l_count) := p_doc_lines_rec.document_num(i);
3438 l_valid_lines.release_num(l_count) := p_doc_lines_rec.release_num(i);
3439 l_valid_lines.po_header_id(l_count) := p_doc_lines_rec.po_header_id(i);
3440 l_valid_lines.po_release_id(l_count) := p_doc_lines_rec.po_release_id(i);
3441 l_valid_lines.source_shipment_id(l_count) := p_doc_lines_rec.source_shipment_id(i);
3442 l_valid_lines.contract_num(l_count) := p_doc_lines_rec.contract_num(i);
3443 l_valid_lines.line_type(l_count) := p_doc_lines_rec.line_type(i);
3444 l_valid_lines.line_type_id(l_count) := p_doc_lines_rec.line_type_id(i);
3445 l_valid_lines.item(l_count) := p_doc_lines_rec.item(i);
3446 l_valid_lines.item_id(l_count) := p_doc_lines_rec.item_id(i);
3447 l_valid_lines.item_revision(l_count) := p_doc_lines_rec.item_revision(i);
3448 l_valid_lines.category(l_count) := p_doc_lines_rec.category(i);
3449 l_valid_lines.category_id(l_count) := p_doc_lines_rec.category_id(i);
3450 l_valid_lines.item_description(l_count) := p_doc_lines_rec.item_description(i);
3451 l_valid_lines.vendor_product_num(l_count) := p_doc_lines_rec.vendor_product_num(i);
3452 l_valid_lines.uom_code(l_count) := p_doc_lines_rec.uom_code(i);
3453 l_valid_lines.unit_of_measure(l_count) := p_doc_lines_rec.unit_of_measure(i);
3454 l_valid_lines.quantity(l_count) := p_doc_lines_rec.quantity(i);
3455 l_valid_lines.committed_amount(l_count) := p_doc_lines_rec.committed_amount(i);
3456 l_valid_lines.min_order_quantity(l_count) := p_doc_lines_rec.min_order_quantity(i);
3457 l_valid_lines.max_order_quantity(l_count) := p_doc_lines_rec.max_order_quantity(i);
3458 l_valid_lines.unit_price(l_count) := p_doc_lines_rec.unit_price(i);
3459 l_valid_lines.list_price_per_unit(l_count) := p_doc_lines_rec.list_price_per_unit(i);
3460 l_valid_lines.market_price(l_count) := p_doc_lines_rec.market_price(i);
3461 l_valid_lines.allow_price_override_flag(l_count) := p_doc_lines_rec.allow_price_override_flag(i);
3462 l_valid_lines.not_to_exceed_price(l_count) := p_doc_lines_rec.not_to_exceed_price(i);
3463 l_valid_lines.negotiated_by_preparer_flag(l_count) := p_doc_lines_rec.negotiated_by_preparer_flag(i);
3464 l_valid_lines.un_number(l_count) := p_doc_lines_rec.un_number(i);
3465 l_valid_lines.un_number_id(l_count) := p_doc_lines_rec.un_number_id(i);
3466 l_valid_lines.hazard_class(l_count) := p_doc_lines_rec.hazard_class(i);
3467 l_valid_lines.hazard_class_id(l_count) := p_doc_lines_rec.hazard_class_id(i);
3468 l_valid_lines.note_to_vendor(l_count) := p_doc_lines_rec.note_to_vendor(i);
3469 l_valid_lines.transaction_reason_code(l_count) := p_doc_lines_rec.transaction_reason_code(i);
3470 l_valid_lines.taxable_flag(l_count) := p_doc_lines_rec.taxable_flag(i);
3471 l_valid_lines.tax_name(l_count) := p_doc_lines_rec.tax_name(i);
3472 l_valid_lines.type_1099(l_count) := p_doc_lines_rec.type_1099(i);
3473 l_valid_lines.capital_expense_flag(l_count) := p_doc_lines_rec.capital_expense_flag(i);
3474 l_valid_lines.inspection_required_flag(l_count) := p_doc_lines_rec.inspection_required_flag(i);
3475 l_valid_lines.receipt_required_flag(l_count) := p_doc_lines_rec.receipt_required_flag(i);
3476 l_valid_lines.payment_terms(l_count) := p_doc_lines_rec.payment_terms(i);
3477 l_valid_lines.terms_id(l_count) := p_doc_lines_rec.terms_id(i);
3478 l_valid_lines.price_type(l_count) := p_doc_lines_rec.price_type(i);
3479 l_valid_lines.min_release_amount(l_count) := p_doc_lines_rec.min_release_amount(i);
3480 l_valid_lines.price_break_lookup_code(l_count) := p_doc_lines_rec.price_break_lookup_code(i);
3481 l_valid_lines.ussgl_transaction_code(l_count) := p_doc_lines_rec.ussgl_transaction_code(i);
3482 l_valid_lines.closed_code(l_count) := p_doc_lines_rec.closed_code(i);
3483 l_valid_lines.closed_reason(l_count) := p_doc_lines_rec.closed_reason(i);
3484 l_valid_lines.closed_date(l_count) := p_doc_lines_rec.closed_date(i);
3485 l_valid_lines.closed_by(l_count) := p_doc_lines_rec.closed_by(i);
3486 l_valid_lines.invoice_close_tolerance(l_count) := p_doc_lines_rec.invoice_close_tolerance(i);
3487 l_valid_lines.receive_close_tolerance(l_count) := p_doc_lines_rec.receive_close_tolerance(i);
3488 l_valid_lines.firm_flag(l_count) := p_doc_lines_rec.firm_flag(i);
3489 l_valid_lines.days_early_receipt_allowed(l_count) := p_doc_lines_rec.days_early_receipt_allowed(i);
3490 l_valid_lines.days_late_receipt_allowed(l_count) := p_doc_lines_rec.days_late_receipt_allowed(i);
3491 l_valid_lines.enforce_ship_to_location_code(l_count) := p_doc_lines_rec.enforce_ship_to_location_code(i);
3492 l_valid_lines.allow_substitute_receipts_flag(l_count) := p_doc_lines_rec.allow_substitute_receipts_flag(i);
3493 l_valid_lines.receiving_routing(l_count) := p_doc_lines_rec.receiving_routing(i);
3494 l_valid_lines.receiving_routing_id(l_count) := p_doc_lines_rec.receiving_routing_id(i);
3495 l_valid_lines.qty_rcv_tolerance(l_count) := p_doc_lines_rec.qty_rcv_tolerance(i);
3496 l_valid_lines.over_tolerance_error_flag(l_count) := p_doc_lines_rec.over_tolerance_error_flag(i);
3497 l_valid_lines.qty_rcv_exception_code(l_count) := p_doc_lines_rec.qty_rcv_exception_code(i);
3498 l_valid_lines.receipt_days_exception_code(l_count) := p_doc_lines_rec.receipt_days_exception_code(i);
3499 l_valid_lines.ship_to_organization_code(l_count) := p_doc_lines_rec.ship_to_organization_code(i);
3500 l_valid_lines.ship_to_organization_id(l_count) := p_doc_lines_rec.ship_to_organization_id(i);
3501 l_valid_lines.ship_to_location(l_count) := p_doc_lines_rec.ship_to_location(i);
3502 l_valid_lines.ship_to_location_id(l_count) := p_doc_lines_rec.ship_to_location_id(i);
3503 l_valid_lines.need_by_date(l_count) := p_doc_lines_rec.need_by_date(i);
3504 l_valid_lines.promised_date(l_count) := p_doc_lines_rec.promised_date(i);
3505 l_valid_lines.accrue_on_receipt_flag(l_count) := p_doc_lines_rec.accrue_on_receipt_flag(i);
3506 l_valid_lines.lead_time(l_count) := p_doc_lines_rec.lead_time(i);
3507 l_valid_lines.lead_time_unit(l_count) := p_doc_lines_rec.lead_time_unit(i);
3508 l_valid_lines.price_discount(l_count) := p_doc_lines_rec.price_discount(i);
3509 l_valid_lines.freight_carrier(l_count) := p_doc_lines_rec.freight_carrier(i);
3510 l_valid_lines.fob(l_count) := p_doc_lines_rec.fob(i);
3511 l_valid_lines.freight_terms(l_count) := p_doc_lines_rec.freight_terms(i);
3512 l_valid_lines.effective_date(l_count) := p_doc_lines_rec.effective_date(i);
3513 l_valid_lines.expiration_date(l_count) := p_doc_lines_rec.expiration_date(i);
3514 l_valid_lines.from_header_id(l_count) := p_doc_lines_rec.from_header_id(i);
3515 l_valid_lines.from_line_id(l_count) := p_doc_lines_rec.from_line_id(i);
3516 l_valid_lines.from_line_location_id(l_count) := p_doc_lines_rec.from_line_location_id(i);
3517 l_valid_lines.line_attribute_category_lines(l_count) := p_doc_lines_rec.line_attribute_category_lines(i);
3518 l_valid_lines.line_attribute1(l_count) := p_doc_lines_rec.line_attribute1(i);
3519 l_valid_lines.line_attribute2(l_count) := p_doc_lines_rec.line_attribute2(i);
3520 l_valid_lines.line_attribute3(l_count) := p_doc_lines_rec.line_attribute3(i);
3521 l_valid_lines.line_attribute4(l_count) := p_doc_lines_rec.line_attribute4(i);
3522 l_valid_lines.line_attribute5(l_count) := p_doc_lines_rec.line_attribute5(i);
3523 l_valid_lines.line_attribute6(l_count) := p_doc_lines_rec.line_attribute6(i);
3524 l_valid_lines.line_attribute7(l_count) := p_doc_lines_rec.line_attribute7(i);
3525 l_valid_lines.line_attribute8(l_count) := p_doc_lines_rec.line_attribute8(i);
3526 l_valid_lines.line_attribute9(l_count) := p_doc_lines_rec.line_attribute9(i);
3527 l_valid_lines.line_attribute10(l_count) := p_doc_lines_rec.line_attribute10(i);
3528 l_valid_lines.line_attribute11(l_count) := p_doc_lines_rec.line_attribute11(i);
3529 l_valid_lines.line_attribute12(l_count) := p_doc_lines_rec.line_attribute12(i);
3530 l_valid_lines.line_attribute13(l_count) := p_doc_lines_rec.line_attribute13(i);
3531 l_valid_lines.line_attribute14(l_count) := p_doc_lines_rec.line_attribute14(i);
3532 l_valid_lines.line_attribute15(l_count) := p_doc_lines_rec.line_attribute15(i);
3533 l_valid_lines.shipment_attribute_category(l_count) := p_doc_lines_rec.shipment_attribute_category(i);
3534 l_valid_lines.shipment_attribute1(l_count) := p_doc_lines_rec.shipment_attribute1(i);
3535 l_valid_lines.shipment_attribute2(l_count) := p_doc_lines_rec.shipment_attribute2(i);
3536 l_valid_lines.shipment_attribute3(l_count) := p_doc_lines_rec.shipment_attribute3(i);
3537 l_valid_lines.shipment_attribute4(l_count) := p_doc_lines_rec.shipment_attribute4(i);
3538 l_valid_lines.shipment_attribute5(l_count) := p_doc_lines_rec.shipment_attribute5(i);
3539 l_valid_lines.shipment_attribute6(l_count) := p_doc_lines_rec.shipment_attribute6(i);
3540 l_valid_lines.shipment_attribute7(l_count) := p_doc_lines_rec.shipment_attribute7(i);
3541 l_valid_lines.shipment_attribute8(l_count) := p_doc_lines_rec.shipment_attribute8(i);
3542 l_valid_lines.shipment_attribute9(l_count) := p_doc_lines_rec.shipment_attribute9(i);
3543 l_valid_lines.shipment_attribute10(l_count) := p_doc_lines_rec.shipment_attribute10(i);
3544 l_valid_lines.shipment_attribute11(l_count) := p_doc_lines_rec.shipment_attribute11(i);
3545 l_valid_lines.shipment_attribute12(l_count) := p_doc_lines_rec.shipment_attribute12(i);
3546 l_valid_lines.shipment_attribute13(l_count) := p_doc_lines_rec.shipment_attribute13(i);
3547 l_valid_lines.shipment_attribute14(l_count) := p_doc_lines_rec.shipment_attribute14(i);
3548 l_valid_lines.shipment_attribute15(l_count) := p_doc_lines_rec.shipment_attribute15(i);
3549 l_valid_lines.last_update_date(l_count) := p_doc_lines_rec.last_update_date(i);
3550 l_valid_lines.last_updated_by(l_count) := p_doc_lines_rec.last_updated_by(i);
3551 l_valid_lines.last_update_login(l_count) := p_doc_lines_rec.last_update_login(i);
3552 l_valid_lines.creation_date(l_count) := p_doc_lines_rec.creation_date(i);
3553 l_valid_lines.created_by(l_count) := p_doc_lines_rec.created_by(i);
3554 l_valid_lines.request_id(l_count) := p_doc_lines_rec.request_id(i);
3555 l_valid_lines.program_application_id(l_count) := p_doc_lines_rec.program_application_id(i);
3556 l_valid_lines.program_id(l_count) := p_doc_lines_rec.program_id(i);
3557 l_valid_lines.program_update_date(l_count) := p_doc_lines_rec.program_update_date(i);
3558 l_valid_lines.invoice_close_tolerance(l_count) := p_doc_lines_rec.invoice_close_tolerance(i);
3559 l_valid_lines.organization_id(l_count) := p_doc_lines_rec.organization_id(i);
3560 l_valid_lines.item_attribute_category(l_count) := p_doc_lines_rec.item_attribute_category(i);
3561 l_valid_lines.item_attribute1(l_count) := p_doc_lines_rec.item_attribute1(i);
3562 l_valid_lines.item_attribute2(l_count) := p_doc_lines_rec.item_attribute2(i);
3563 l_valid_lines.item_attribute3(l_count) := p_doc_lines_rec.item_attribute3(i);
3564 l_valid_lines.item_attribute4(l_count) := p_doc_lines_rec.item_attribute4(i);
3565 l_valid_lines.item_attribute5(l_count) := p_doc_lines_rec.item_attribute5(i);
3566 l_valid_lines.item_attribute6(l_count) := p_doc_lines_rec.item_attribute6(i);
3567 l_valid_lines.item_attribute7(l_count) := p_doc_lines_rec.item_attribute7(i);
3568 l_valid_lines.item_attribute8(l_count) := p_doc_lines_rec.item_attribute8(i);
3569 l_valid_lines.item_attribute9(l_count) := p_doc_lines_rec.item_attribute9(i);
3570 l_valid_lines.item_attribute10(l_count) := p_doc_lines_rec.item_attribute10(i);
3571 l_valid_lines.item_attribute11(l_count) := p_doc_lines_rec.item_attribute11(i);
3572 l_valid_lines.item_attribute12(l_count) := p_doc_lines_rec.item_attribute12(i);
3573 l_valid_lines.item_attribute13(l_count) := p_doc_lines_rec.item_attribute13(i);
3574 l_valid_lines.item_attribute14(l_count) := p_doc_lines_rec.item_attribute14(i);
3575 l_valid_lines.item_attribute15(l_count) := p_doc_lines_rec.item_attribute15(i);
3576 l_valid_lines.unit_weight(l_count) := p_doc_lines_rec.unit_weight(i);
3577 l_valid_lines.weight_uom_code(l_count) := p_doc_lines_rec.weight_uom_code(i);
3578 l_valid_lines.volume_uom_code(l_count) := p_doc_lines_rec.volume_uom_code(i);
3579 l_valid_lines.unit_volume(l_count) := p_doc_lines_rec.unit_volume(i);
3580 l_valid_lines.template_id(l_count) := p_doc_lines_rec.template_id(i);
3581 l_valid_lines.template_name(l_count) := p_doc_lines_rec.template_name(i);
3582 l_valid_lines.line_reference_num(l_count) := p_doc_lines_rec.line_reference_num(i);
3583 l_valid_lines.sourcing_rule_name(l_count) := p_doc_lines_rec.sourcing_rule_name(i);
3584 l_valid_lines.tax_status_indicator(l_count) := p_doc_lines_rec.tax_status_indicator(i);
3585 l_valid_lines.process_code(l_count) := p_doc_lines_rec.process_code(i);
3586 l_valid_lines.price_chg_accept_flag(l_count) := p_doc_lines_rec.price_chg_accept_flag(i);
3587 l_valid_lines.price_break_flag(l_count) := p_doc_lines_rec.price_break_flag(i);
3588 l_valid_lines.price_update_tolerance(l_count) := p_doc_lines_rec.price_update_tolerance(i);
3589 l_valid_lines.tax_user_override_flag(l_count) := p_doc_lines_rec.tax_user_override_flag(i);
3590 l_valid_lines.tax_code_id(l_count) := p_doc_lines_rec.tax_code_id(i);
3591 l_valid_lines.note_to_receiver(l_count) := p_doc_lines_rec.note_to_receiver(i);
3592 l_valid_lines.oke_contract_header_id(l_count) := p_doc_lines_rec.oke_contract_header_id(i);
3593 l_valid_lines.oke_contract_header_num(l_count) := p_doc_lines_rec.oke_contract_header_num(i);
3594 l_valid_lines.oke_contract_version_id(l_count) := p_doc_lines_rec.oke_contract_version_id(i);
3595 l_valid_lines.secondary_unit_of_measure(l_count) := p_doc_lines_rec.secondary_unit_of_measure(i);
3596 l_valid_lines.secondary_uom_code(l_count) := p_doc_lines_rec.secondary_uom_code(i);
3597 l_valid_lines.secondary_quantity(l_count) := p_doc_lines_rec.secondary_quantity(i);
3598 l_valid_lines.preferred_grade(l_count) := p_doc_lines_rec.preferred_grade(i);
3599 l_valid_lines.vmi_flag(l_count) := p_doc_lines_rec.vmi_flag(i);
3600 l_valid_lines.auction_header_id(l_count) := p_doc_lines_rec.auction_header_id(i);
3601 l_valid_lines.auction_line_number(l_count) := p_doc_lines_rec.auction_line_number(i);
3602 l_valid_lines.auction_display_number(l_count) := p_doc_lines_rec.auction_display_number(i);
3603 l_valid_lines.bid_number(l_count) := p_doc_lines_rec.bid_number(i);
3604 l_valid_lines.bid_line_number(l_count) := p_doc_lines_rec.bid_line_number(i);
3605 l_valid_lines.orig_from_req_flag(l_count) := p_doc_lines_rec.orig_from_req_flag(i);
3606 l_valid_lines.consigned_flag(l_count) := p_doc_lines_rec.consigned_flag(i);
3607 l_valid_lines.supplier_ref_number(l_count) := p_doc_lines_rec.supplier_ref_number(i);
3608 l_valid_lines.contract_id(l_count) := p_doc_lines_rec.contract_id(i);
3609 l_valid_lines.job_id(l_count) := p_doc_lines_rec.job_id(i);
3610 l_valid_lines.amount(l_count) := p_doc_lines_rec.amount(i);
3611 l_valid_lines.job_name(l_count) := p_doc_lines_rec.job_name(i);
3612 l_valid_lines.contractor_first_name(l_count) := p_doc_lines_rec.contractor_first_name(i);
3613 l_valid_lines.contractor_last_name(l_count) := p_doc_lines_rec.contractor_last_name(i);
3614 l_valid_lines.drop_ship_flag(l_count) := p_doc_lines_rec.drop_ship_flag(i);
3615 l_valid_lines.base_unit_price(l_count) := p_doc_lines_rec.base_unit_price(i);
3616 l_valid_lines.transaction_flow_header_id(l_count) := p_doc_lines_rec.transaction_flow_header_id(i);
3617 l_valid_lines.job_business_group_id(l_count) := p_doc_lines_rec.job_business_group_id(i);
3618 l_valid_lines.job_business_group_name(l_count) := p_doc_lines_rec.job_business_group_name(i);
3619 l_valid_lines.tracking_quantity_ind(l_count) := p_doc_lines_rec.tracking_quantity_ind(i);
3620 l_valid_lines.secondary_default_ind(l_count) := p_doc_lines_rec.secondary_default_ind(i);
3621 l_valid_lines.dual_uom_deviation_high(l_count) := p_doc_lines_rec.dual_uom_deviation_high(i);
3622 l_valid_lines.dual_uom_deviation_low(l_count) := p_doc_lines_rec.dual_uom_deviation_low(i);
3623 l_valid_lines.processing_id(l_count) := p_doc_lines_rec.processing_id(i);
3624 l_valid_lines.line_loc_populated_flag(l_count) := p_doc_lines_rec.line_loc_populated_flag(i);
3625 l_valid_lines.catalog_name(l_count) := p_doc_lines_rec.catalog_name(i);
3626 l_valid_lines.supplier_part_auxid(l_count) := p_doc_lines_rec.supplier_part_auxid(i);
3627 l_valid_lines.ip_category_id(l_count) := p_doc_lines_rec.ip_category_id(i);
3628 l_valid_lines.ip_category_name(l_count) := p_doc_lines_rec.ip_category_name(i);
3629 l_valid_lines.order_type_lookup_code(l_count) := p_doc_lines_rec.order_type_lookup_code(i);
3630 l_valid_lines.purchase_basis(l_count) := p_doc_lines_rec.purchase_basis(i);
3631 l_valid_lines.matching_basis(l_count) := p_doc_lines_rec.matching_basis(i);
3632 l_valid_lines.org_id(l_count) := p_doc_lines_rec.org_id(i); -- Not present in interface tables
3633 END IF;
3634 END LOOP;
3635
3636 l_progress := '090';
3637 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_count='||l_count); END IF;
3638
3639 -- SQL What: Insert rows that have no errors, and action = PO_R12_CAT_UPG_PVT.g_action_line_create
3640 -- SQL Why : To migrate data to txn tables
3641 -- SQL Join: none
3642 FORALL i IN 1 .. l_valid_lines.po_line_id.COUNT
3643 INSERT INTO po_lines_all POL
3644 (po_line_id,
3645 last_update_date,
3646 last_updated_by,
3647 po_header_id,
3648 line_type_id,
3649 line_num,
3650 last_update_login,
3651 creation_date,
3652 created_by,
3653 item_id,
3654 item_revision,
3655 category_id,
3656 item_description,
3657 unit_meas_lookup_code,
3658 quantity_committed,
3659 committed_amount,
3660 allow_price_override_flag,
3661 not_to_exceed_price,
3662 list_price_per_unit,
3663 unit_price,
3664 quantity,
3665 un_number_id,
3666 hazard_class_id,
3667 note_to_vendor,
3668 from_header_id,
3669 from_line_id,
3670 min_order_quantity,
3671 max_order_quantity,
3672 qty_rcv_tolerance,
3673 over_tolerance_error_flag,
3674 market_price,
3675 unordered_flag,
3676 closed_flag,
3677 user_hold_flag,
3678 cancel_flag,
3679 cancelled_by,
3680 cancel_date,
3681 cancel_reason,
3682 firm_status_lookup_code,
3683 firm_date,
3684 vendor_product_num,
3685 contract_num,
3686 taxable_flag,
3687 tax_name,
3688 type_1099,
3689 capital_expense_flag,
3690 negotiated_by_preparer_flag,
3691 attribute_category,
3692 attribute1,
3693 attribute2,
3694 attribute3,
3695 attribute4,
3696 attribute5,
3697 attribute6,
3698 attribute7,
3699 attribute8,
3700 attribute9,
3701 attribute10,
3702 reference_num,
3703 attribute11,
3704 attribute12,
3705 attribute13,
3706 attribute14,
3707 attribute15,
3708 min_release_amount,
3709 price_type_lookup_code,
3710 closed_code,
3711 price_break_lookup_code,
3712 ussgl_transaction_code,
3713 government_context,
3714 request_id,
3715 program_application_id,
3716 program_id,
3717 program_update_date,
3718 closed_date,
3719 closed_reason,
3720 closed_by,
3721 transaction_reason_code,
3722 org_id,
3723 qc_grade,
3724 base_uom,
3725 base_qty,
3726 secondary_uom,
3727 secondary_qty,
3728 global_attribute_category,
3729 global_attribute1,
3730 global_attribute2,
3731 global_attribute3,
3732 global_attribute4,
3733 global_attribute5,
3734 global_attribute6,
3735 global_attribute7,
3736 global_attribute8,
3737 global_attribute9,
3738 global_attribute10,
3739 global_attribute11,
3740 global_attribute12,
3741 global_attribute13,
3742 global_attribute14,
3743 global_attribute15,
3744 global_attribute16,
3745 global_attribute17,
3746 global_attribute18,
3747 global_attribute19,
3748 global_attribute20,
3749 line_reference_num,
3750 project_id,
3751 task_id,
3752 expiration_date,
3753 tax_code_id,
3754 oke_contract_header_id,
3755 oke_contract_version_id,
3756 secondary_quantity,
3757 secondary_unit_of_measure,
3758 preferred_grade,
3759 auction_header_id,
3760 auction_display_number,
3761 auction_line_number,
3762 bid_number,
3763 bid_line_number,
3764 retroactive_date,
3765 --supplier_ref_number, TODO: Not present in 11.5.9
3766 --contract_id, TODO: Not present in 11.5.9
3767 --start_date, TODO: Not present in 11.5.9
3768 --amount, TODO: Not present in 11.5.9
3769 --job_id, TODO: Not present in 11.5.9
3770 --contractor_first_name, TODO: Not present in 11.5.9. For 11.5.10, default NULL
3771 --contractor_last_name, TODO: Not present in 11.5.9. For 11.5.10, default NULL
3772 --from_line_location_id, TODO: Not present in 11.5.9. For 11.5.10, default NULL
3773 order_type_lookup_code, -- Not present in 11.5.9. For 11.5.10, default as in PDOI (iP will not provide)
3774 purchase_basis, -- Not present in 11.5.9. For 11.5.10, default as in PDOI (iP will not provide)
3775 matching_basis, -- Not present in 11.5.9. For 11.5.10, default as in PDOI (iP will not provide)
3776 --svc_amount_notif_sent, Not present in 11.5.9. For 11.5.10, default NULL
3777 --svc_completion_notif_sent, Not present in 11.5.9. For 11.5.10, default NULL
3778 --base_unit_price, Not present in 11.5.9. For 11.5.10, default as in PDOI (iP will not provide)
3779 manual_price_change_flag,
3780 --retainage_rate, Not present in 11.5.9, 11.5.10
3781 --max_retainage_amount, Not present in 11.5.9, 11.5.10
3782 --progress_payment_rate, Not present in 11.5.9, 11.5.10
3783 --recoupment_rate, Not present in 11.5.9, 11.5.10
3784 catalog_name,
3785 supplier_part_auxid,
3786 ip_category_id,
3787 last_updated_program
3788 --advance_amount Not present in 11.5.9, 11.5.10
3789 )
3790 VALUES
3791 (
3792 l_valid_lines.po_line_id(i), -- From sequence PO_LINES_S
3793 sysdate, -- last_update_date
3794 FND_GLOBAL.user_id, -- last_updated_by
3795 l_valid_lines.po_header_id(i),
3796 l_valid_lines.line_type_id(i),
3797 l_valid_lines.line_num(i), -- TODO: double check the defaulting
3798 FND_GLOBAL.login_id, -- last_update_login
3799 sysdate, -- creation_date
3800 g_R12_UPGRADE_USER, -- created_by = -12
3801 l_valid_lines.item_id(i),
3802 l_valid_lines.item_revision(i),
3803 l_valid_lines.category_id(i),
3804 l_valid_lines.item_description(i),
3805 l_valid_lines.unit_of_measure(i), -- unit_meas_lookup_code
3806 NULL, -- quantity_committed
3807 NULL, -- committed_amount
3808 l_valid_lines.allow_price_override_flag(i),
3809 NULL, -- not_to_exceed_price
3810 l_valid_lines.list_price_per_unit(i),
3811 l_valid_lines.unit_price(i),
3812 1, -- quantity
3813 l_valid_lines.un_number_id(i),
3814 l_valid_lines.hazard_class_id(i),
3815 NULL, -- note_to_vendor
3816 NULL, -- from_header_id
3817 NULL, -- from_line_id
3818 NULL, -- min_order_quantity
3819 NULL, -- max_order_quantity
3820 l_valid_lines.qty_rcv_tolerance(i),
3821 NULL, -- over_tolerance_error_flag
3822 l_valid_lines.market_price(i),
3823 'N', -- unordered_flag,
3824 'N', -- closed_flag,
3825 'N', -- user_hold_flag,
3826 'N', -- cancel_flag,
3827 NULL, -- cancelled_by,
3828 NULL, -- cancel_date,
3829 NULL, -- cancel_reason,
3830 NULL, -- firm_status_lookup_code,
3831 NULL, -- firm_date,
3832 l_valid_lines.vendor_product_num(i),
3833 NULL, -- contract_num
3834 l_valid_lines.taxable_flag(i),
3835 l_valid_lines.tax_name(i),
3836 l_valid_lines.type_1099(i),
3837 'N', -- capital_expense_flag
3838 l_valid_lines.negotiated_by_preparer_flag(i),
3839 NULL, -- attribute_category
3840 NULL, -- attribute1
3841 NULL, -- attribute2
3842 NULL, -- attribute3
3843 NULL, -- attribute4
3844 NULL, -- attribute5
3845 NULL, -- attribute6
3846 NULL, -- attribute7
3847 NULL, -- attribute8
3848 NULL, -- attribute9
3849 NULL, -- attribute10
3850 NULL, -- reference_num
3851 NULL, -- attribute11
3852 NULL, -- attribute12
3853 NULL, -- attribute13
3854 NULL, -- attribute14
3855 NULL, -- attribute15
3856 l_valid_lines.min_release_amount(i),
3857 l_valid_lines.price_type(i),
3858 'OPEN', -- closed_code
3859 NULL, -- price_break_lookup_code
3860 NULL, -- ussgl_transaction_code
3861 NULL, -- government_context
3862 FND_GLOBAL.conc_request_id, -- request_id: iPs conc program request id
3863 NULL, -- program_application_id
3864 NULL, -- program_id
3865 NULL, -- program_update_date
3866 NULL, -- closed_date
3867 NULL, -- closed_reason
3868 NULL, -- closed_by
3869 NULL, -- transaction_reason_code
3870 l_valid_lines.org_id(i),
3871 NULL, -- qc_grade (Obsolete)
3872 NULL, -- base_uom (Obsolete)
3873 NULL, -- base_qty (Obsolete)
3874 NULL, -- secondary_uom (Obsolete)
3875 NULL, -- secondary_qty (Obsolete)
3876 NULL, -- global_attribute_category
3877 NULL, -- global_attribute1
3878 NULL, -- global_attribute2
3879 NULL, -- global_attribute3
3880 NULL, -- global_attribute4
3881 NULL, -- global_attribute5
3882 NULL, -- global_attribute6
3883 NULL, -- global_attribute7
3884 NULL, -- global_attribute8
3885 NULL, -- global_attribute9
3886 NULL, -- global_attribute10
3887 NULL, -- global_attribute11
3888 NULL, -- global_attribute12
3889 NULL, -- global_attribute13
3890 NULL, -- global_attribute14
3891 NULL, -- global_attribute15
3892 NULL, -- global_attribute16
3893 NULL, -- global_attribute17
3894 NULL, -- global_attribute18
3895 NULL, -- global_attribute19
3896 NULL, -- global_attribute20
3897 NULL, -- line_reference_num
3898 NULL, -- project_id
3899 NULL, -- task_id
3900 NULL, -- expiration_date
3901 l_valid_lines.tax_code_id(i),
3902 NULL, -- oke_contract_header_id
3903 NULL, -- oke_contract_version_id
3904 NULL, -- secondary_quantity
3905 NULL, -- secondary_unit_of_measure
3906 NULL, -- preferred_grade
3907 NULL, -- auction_header_id
3908 NULL, -- auction_display_number
3909 NULL, -- auction_line_number
3910 NULL, -- bid_number
3911 NULL, -- bid_line_number
3912 NULL, -- retroactive_date
3913 --NULL, -- supplier_ref_number, Not present in 11.5.9. For 11.5.10, default NULL
3914 --NULL, -- contract_id, Not present in 11.5.9. For 11.5.10, default NULL
3915 --NULL, -- start_date, Not present in 11.5.9. For 11.5.10, default NULL
3916 --NULL, -- amount, Not present in 11.5.9. For 11.5.10, default NULL
3917 --NULL, -- job_id, Not present in 11.5.9. For 11.5.10, default NULL
3918 --NULL, -- contractor_first_name, Not present in 11.5.9. For 11.5.10, default NULL
3919 --NULL, -- contractor_last_name, Not present in 11.5.9. For 11.5.10, default NULL
3920 --NULL, -- from_line_location_id, Not present in 11.5.9. For 11.5.10, default NULL
3921 l_valid_lines.order_type_lookup_code(i),
3922 l_valid_lines.purchase_basis(i),
3923 l_valid_lines.matching_basis(i),
3924 --NULL, -- svc_amount_notif_sent, Not present in 11.5.9. For 11.5.10, default NULL
3925 --NULL, -- svc_completion_notif_sent, Not present in 11.5.9. For 11.5.10, default NULL
3926 --l_valid_lines.base_unit_price(i), Not present in 11.5.9. For 11.5.10, default as in PDOI (iP will not provide)
3927 NULL, -- manual_price_change_flag,
3928 --NULL, -- retainage_rate, Not present in 11.5.9, 11.5.10
3929 --NULL, -- max_retainage_amount, Not present in 11.5.9, 11.5.10
3930 --NULL, -- progress_payment_rate, Not present in 11.5.9, 11.5.10
3931 --NULL, -- recoupment_rate, Not present in 11.5.9, 11.5.10
3932 l_valid_lines.catalog_name(i),
3933 l_valid_lines.supplier_part_auxid(i),
3934 l_valid_lines.ip_category_id(i),
3935 g_R12_MIGRATION_PROGRAM -- last_updated_program
3936 --NULL, -- advance_amount, Not present in 11.5.9, 11.5.10
3937 );
3938
3939 l_progress := '100';
3940 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of lines inserted='||SQL%rowcount); END IF;
3941
3942 l_progress := '110';
3943 -- SQL What: Insert the PO_LINE_ID back into Interface table for successfull
3944 -- line creation.
3945 -- SQL Why : To make it available to the calling program of the migration API.
3946 -- SQL Join: interface_line_id
3947 FORALL i IN 1 .. l_valid_lines.po_line_id.COUNT
3948 UPDATE PO_LINES_INTERFACE
3949 SET PO_LINE_ID = l_valid_lines.po_line_id(i),
3950 PROCESS_CODE = g_PROCESS_CODE_PROCESSED
3951 WHERE interface_line_id = l_valid_lines.interface_line_id(i);
3952
3953 l_progress := '120';
3954 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of interface_line recs updated='||SQL%rowcount); END IF;
3955
3956 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
3957 EXCEPTION
3958 WHEN OTHERS THEN
3959 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
3960 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
3961 END insert_doc_lines;
3962
3963 --------------------------------------------------------------------------------
3964 --Start of Comments
3965 --Name: update_doc_lines
3966 --Pre-reqs:
3967 -- The iP catalog data is populated in PO Interface tables.
3968 --Modifies:
3969 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
3970 -- to the Interface tables.
3971 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
3972 -- failed the migration.
3973 -- c) FND_MSG_PUB on unhandled exceptions.
3974 --Locks:
3975 -- None.
3976 --Function:
3977 -- Updates a batch of document lines given in a plsql table, into the transaction
3978 -- tables.
3979 -- This API should be called during the upgrade phase only.
3980 --Parameters:
3981 --IN:
3982 -- p_doc_lines_rec
3983 -- A table of plsql records containing a batch of line information for
3984 -- creating a new GBPA line.
3985 --OUT:
3986 --End of Comments
3987 --------------------------------------------------------------------------------
3988 PROCEDURE update_doc_lines
3989 (
3990 p_doc_lines_rec IN record_of_lines_type
3991 )
3992 IS
3993 l_api_name CONSTANT VARCHAR2(30) := 'update_doc_lines';
3994 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
3995 l_progress VARCHAR2(3) := '000';
3996 l_po_line_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER; --Bug#4731494
3997 BEGIN
3998 l_progress := '010';
3999 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
4000
4001 IF (p_doc_lines_rec.po_line_id.COUNT > 0) THEN
4002 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_lines_rec.po_line_id(1)='||p_doc_lines_rec.po_line_id(1)); END IF;
4003 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_lines_rec.has_errors(1)='||p_doc_lines_rec.has_errors(1)); END IF;
4004 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_lines_rec.action(1)='||p_doc_lines_rec.action(1)); END IF;
4005 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_lines_rec.ip_category_id(1)='||p_doc_lines_rec.ip_category_id(1)); END IF;
4006 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_doc_lines_rec.item_description(1)='||p_doc_lines_rec.item_description(1)); END IF;
4007 END IF;
4008
4009 l_progress := '020';
4010 -- SQL What: Update all the lines that were NOT created by the Catalog Upgrade
4011 -- and don't have any errors.
4012 -- SQL Why : To update the line level columns
4013 -- SQL Join: po_line_id
4014 FORALL i IN 1..p_doc_lines_rec.po_line_id.COUNT
4015 UPDATE po_lines_all
4016 SET
4017 -- Only the following 3 columns are allowed to be updated on a line,
4018 -- when it was not created by the migration program. Rest of them will
4019 -- be ignored. But for lines that were created by the migration program,
4020 -- many more column may be updated (see next statement).
4021 ip_category_id = DECODE(p_doc_lines_rec.ip_category_id(i),
4022 NULL, ip_category_id,
4023 g_NULLIFY_NUM, NULL,
4024 p_doc_lines_rec.ip_category_id(i)),
4025 catalog_name = DECODE(p_doc_lines_rec.catalog_name(i),
4026 NULL, catalog_name,
4027 g_NULLIFY_VARCHAR, NULL,
4028 p_doc_lines_rec.catalog_name(i)),
4029 supplier_part_auxid = DECODE(p_doc_lines_rec.supplier_part_auxid(i),
4030 NULL, supplier_part_auxid,
4031 g_NULLIFY_NUM, NULL,
4032 p_doc_lines_rec.supplier_part_auxid(i))
4033 WHERE po_line_id = p_doc_lines_rec.po_line_id(i)
4034 AND p_doc_lines_rec.has_errors(i) = 'N'
4035 AND p_doc_lines_rec.action(i) = 'UPDATE'
4036 AND created_by <> g_R12_UPGRADE_USER; --Bug#4865568
4037
4038 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of lines updated for exiting docs='||SQL%rowcount); END IF;
4039
4040 l_progress := '030';
4041 -- SQL What: Update all the lines that were created by the Catalog Upgrade
4042 -- and don't have any errors.
4043 -- SQL Why : To update the line level columns
4044 -- SQL Join: po_line_id
4045 FORALL i IN 1..p_doc_lines_rec.po_line_id.COUNT
4046 UPDATE po_lines_all
4047 SET
4048 -- Only the following 9 columns are allowed to be updated on a line,
4049 -- when it was created by the migration program. Rest of them will
4050 -- be ignored.
4051 unit_price = DECODE(p_doc_lines_rec.unit_price(i),
4052 NULL, unit_price,
4053 g_NULLIFY_NUM, NULL,
4054 p_doc_lines_rec.unit_price(i)),
4055 item_description = DECODE(p_doc_lines_rec.item_description(i),
4056 NULL, item_description,
4057 g_NULLIFY_VARCHAR, NULL,
4058 p_doc_lines_rec.item_description(i)),
4059 catalog_name = DECODE(p_doc_lines_rec.catalog_name(i),
4060 NULL, catalog_name,
4061 g_NULLIFY_VARCHAR, NULL,
4062 p_doc_lines_rec.catalog_name(i)),
4063 supplier_part_auxid = DECODE(p_doc_lines_rec.supplier_part_auxid(i),
4064 NULL, supplier_part_auxid,
4065 g_NULLIFY_NUM, NULL,
4066 p_doc_lines_rec.supplier_part_auxid(i)),
4067 unit_meas_lookup_code = DECODE(p_doc_lines_rec.unit_of_measure(i),
4068 NULL, unit_meas_lookup_code,
4069 g_NULLIFY_VARCHAR, NULL,
4070 p_doc_lines_rec.unit_of_measure(i)),
4071 negotiated_by_preparer_flag = DECODE(p_doc_lines_rec.negotiated_by_preparer_flag(i),
4072 NULL, negotiated_by_preparer_flag,
4073 g_NULLIFY_VARCHAR, NULL,
4074 p_doc_lines_rec.negotiated_by_preparer_flag(i)),
4075 ip_category_id = DECODE(p_doc_lines_rec.ip_category_id(i),
4076 NULL, ip_category_id,
4077 g_NULLIFY_NUM, NULL,
4078 p_doc_lines_rec.ip_category_id(i)),
4079 category_id = DECODE(p_doc_lines_rec.category_id(i),
4080 NULL, category_id,
4081 g_NULLIFY_NUM, NULL,
4082 p_doc_lines_rec.category_id(i)),
4083 vendor_product_num = DECODE(p_doc_lines_rec.vendor_product_num (i),
4084 NULL, vendor_product_num ,
4085 g_NULLIFY_VARCHAR, NULL,
4086 p_doc_lines_rec.vendor_product_num (i))
4087 WHERE po_line_id = p_doc_lines_rec.po_line_id(i)
4088 AND p_doc_lines_rec.has_errors(i) = 'N'
4089 AND p_doc_lines_rec.action(i) = 'UPDATE'
4090 AND created_by = g_R12_UPGRADE_USER --Bug#4865568
4091 RETURNING po_line_id BULK COLLECT into l_po_line_ids; --Bug#4731494
4092
4093 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of lines updated for docs created by migration program='||SQL%rowcount); END IF;
4094
4095 l_progress := '035';
4096
4097 -- Bug#4731494
4098 -- SQL What: Update last_update_date for the rows that are updated and was
4099 -- originally created by upgrade/migration program
4100 -- SQL Why : To mark them as successfully updated
4101 -- SQL Join: interface_line_id
4102 FORALL i in 1..l_po_line_ids.COUNT
4103 UPDATE PO_LINES_ALL
4104 SET LAST_UPDATED_BY = g_R12_UPGRADE_USER,
4105 LAST_UPDATE_LOGIN = g_R12_UPGRADE_USER,
4106 LAST_UPDATED_PROGRAM = g_R12_MIGRATION_PROGRAM,
4107 LAST_UPDATE_DATE = sysdate
4108 WHERE PO_LINE_ID = l_po_line_ids(i);
4109
4110 l_progress := '040';
4111 -- SQL What: Update the process_code of lines interface rows with PROCESSED
4112 -- SQL Why : To mark them as successfully updated
4113 -- SQL Join: interface_line_id
4114 FORALL i IN 1..p_doc_lines_rec.po_line_id.COUNT
4115 UPDATE po_lines_interface
4116 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
4117 WHERE interface_line_id = p_doc_lines_rec.interface_line_id(i)
4118 AND p_doc_lines_rec.has_errors(i) = 'N'
4119 AND p_doc_lines_rec.action(i) = 'UPDATE';
4120
4121 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of interface lines PROCESSED='||SQL%rowcount); END IF;
4122
4123 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
4124 EXCEPTION
4125 WHEN OTHERS THEN
4126 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
4127 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
4128 END update_doc_lines;
4129
4130 --------------------------------------------------------------------------------
4131 --Start of Comments
4132 --Name: delete_doc_lines
4133 --Pre-reqs:
4134 -- The iP catalog data is populated in PO Interface tables.
4135 --Modifies:
4136 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
4137 -- to the Interface tables.
4138 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
4139 -- failed the migration.
4140 -- c) FND_MSG_PUB on unhandled exceptions.
4141 --Locks:
4142 -- None.
4143 --Function:
4144 -- Deletes a batch of document lines given in a plsql table, from the transaction
4145 -- tables:
4146 --Parameters:
4147 --IN:
4148 -- p_doc_lines_rec
4149 -- A table of plsql records containing a batch of line information for
4150 -- creating a new GBPA line.
4151 --OUT:
4152 --End of Comments
4153 --------------------------------------------------------------------------------
4154 PROCEDURE delete_doc_lines
4155 (
4156 p_doc_lines_rec IN record_of_lines_type
4157 )
4158 IS
4159 l_api_name CONSTANT VARCHAR2(30) := 'delete_doc_lines';
4160 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
4161 l_progress VARCHAR2(3) := '000';
4162
4163 l_po_line_ids PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER;
4164
4165 BEGIN
4166 l_progress := '010';
4167 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
4168
4169 -- Delete Rows that do not have errors
4170 FORALL i IN 1..p_doc_lines_rec.po_line_id.COUNT
4171 DELETE FROM po_lines_all
4172 WHERE po_line_id = p_doc_lines_rec.po_line_id(i)
4173 AND p_doc_lines_rec.has_errors(i) = 'N'
4174 AND p_doc_lines_rec.action(i) = 'DELETE'
4175 RETURNING po_line_id
4176 BULK COLLECT INTO l_po_line_ids;
4177
4178 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of lines deleted='||SQL%rowcount); END IF;
4179
4180 l_progress := '020';
4181
4182 -- Delete from Attribute tables
4183 FORALL i IN 1.. l_po_line_ids.COUNT
4184 DELETE FROM PO_ATTRIBUTE_VALUES
4185 WHERE PO_LINE_ID = l_po_line_ids(i);
4186
4187 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of attr deleted='||SQL%rowcount); END IF;
4188
4189 l_progress := '030';
4190
4191 -- Delete from Attribute TLP tables
4192 FORALL i IN 1.. l_po_line_ids.COUNT
4193 DELETE FROM PO_ATTRIBUTE_VALUES_TLP
4194 WHERE PO_LINE_ID = l_po_line_ids(i);
4195
4196 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of TLP deleted='||SQL%rowcount); END IF;
4197
4198 l_progress := '040';
4199 -- Mark interface lines as PROCESSED
4200 FORALL i IN 1..p_doc_lines_rec.po_line_id.COUNT
4201 UPDATE po_lines_interface
4202 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
4203 WHERE interface_line_id = p_doc_lines_rec.interface_line_id(i)
4204 AND p_doc_lines_rec.has_errors(i) = 'N'
4205 AND p_doc_lines_rec.action(i) = 'DELETE';
4206
4207 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of lines PROCESSED='||SQL%rowcount); END IF;
4208
4209 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
4210 EXCEPTION
4211 WHEN OTHERS THEN
4212 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
4213 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
4214 END delete_doc_lines;
4215
4216 --------------------------------------------------------------------------------
4217 --Start of Comments
4218 --Name: migrate_attributes
4219 --Pre-reqs:
4220 -- The iP catalog data is populated in PO Interface tables.
4221 --Modifies:
4222 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
4223 -- to the Interface tables.
4224 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
4225 -- failed the migration.
4226 -- c) FND_MSG_PUB on unhandled exceptions.
4227 --Locks:
4228 -- None.
4229 --Function:
4230 -- Migrate the attribute values from interface to draft tables.
4231 -- This API should be called during the upgrade phase only.
4232 --Parameters:
4233 --IN:
4234 --p_validate_only_mode
4235 -- Indicates if the API is being called in a Validate Only mode or not
4236 --OUT:
4237 --
4238 --End of Comments
4239 --------------------------------------------------------------------------------
4240 PROCEDURE migrate_attributes
4241 (
4242 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
4243 )
4244 IS
4245 l_api_name CONSTANT VARCHAR2(30) := 'migrate_attributes';
4246 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
4247 l_progress VARCHAR2(3) := '000';
4248
4249 -- SQL What: Cursor to load attribute values
4250 -- SQL Why : To migrate data to PO txn tables
4251 -- SQL Join: processing_id, action
4252 -- Bug 5677911: Added the hint for performance reason.
4253 CURSOR load_attrib_csr(request_processing_id NUMBER) IS
4254 SELECT /*+ INDEX(attrib, PO_ATTR_VALUES_INT_N2)*/
4255 attrib.interface_attr_values_id,
4256 attrib.interface_header_id,
4257 attrib.interface_line_id,
4258 attrib.action,
4259 attrib.process_code,
4260 -- The po_line_id would be stamped on PO_LINES_INTERFACE for successfully migrated lines
4261 NVL(DECODE(attrib.po_line_id,
4262 g_NOT_REQUIRED_ID, POLI.po_line_id,
4263 NULL, POLI.po_line_id,
4264 attrib.po_line_id),
4265 g_NOT_REQUIRED_ID),
4266 attrib.req_template_name,
4267 attrib.req_template_line_num,
4268 attrib.ip_category_id,
4269 attrib.inventory_item_id,
4270 attrib.org_id,
4271 attrib.manufacturer_part_num,
4272 attrib.thumbnail_image,
4273 attrib.supplier_url,
4274 attrib.manufacturer_url,
4275 attrib.attachment_url,
4276 attrib.unspsc,
4277 attrib.availability,
4278 attrib.lead_time,
4279 attrib.text_base_attribute1,
4280 attrib.text_base_attribute2,
4281 attrib.text_base_attribute3,
4282 attrib.text_base_attribute4,
4283 attrib.text_base_attribute5,
4284 attrib.text_base_attribute6,
4285 attrib.text_base_attribute7,
4286 attrib.text_base_attribute8,
4287 attrib.text_base_attribute9,
4288 attrib.text_base_attribute10,
4289 attrib.text_base_attribute11,
4290 attrib.text_base_attribute12,
4291 attrib.text_base_attribute13,
4292 attrib.text_base_attribute14,
4293 attrib.text_base_attribute15,
4294 attrib.text_base_attribute16,
4295 attrib.text_base_attribute17,
4296 attrib.text_base_attribute18,
4297 attrib.text_base_attribute19,
4298 attrib.text_base_attribute20,
4299 attrib.text_base_attribute21,
4300 attrib.text_base_attribute22,
4301 attrib.text_base_attribute23,
4302 attrib.text_base_attribute24,
4303 attrib.text_base_attribute25,
4304 attrib.text_base_attribute26,
4305 attrib.text_base_attribute27,
4306 attrib.text_base_attribute28,
4307 attrib.text_base_attribute29,
4308 attrib.text_base_attribute30,
4309 attrib.text_base_attribute31,
4310 attrib.text_base_attribute32,
4311 attrib.text_base_attribute33,
4312 attrib.text_base_attribute34,
4313 attrib.text_base_attribute35,
4314 attrib.text_base_attribute36,
4315 attrib.text_base_attribute37,
4316 attrib.text_base_attribute38,
4317 attrib.text_base_attribute39,
4318 attrib.text_base_attribute40,
4319 attrib.text_base_attribute41,
4320 attrib.text_base_attribute42,
4321 attrib.text_base_attribute43,
4322 attrib.text_base_attribute44,
4323 attrib.text_base_attribute45,
4324 attrib.text_base_attribute46,
4325 attrib.text_base_attribute47,
4326 attrib.text_base_attribute48,
4327 attrib.text_base_attribute49,
4328 attrib.text_base_attribute50,
4329 attrib.text_base_attribute51,
4330 attrib.text_base_attribute52,
4331 attrib.text_base_attribute53,
4332 attrib.text_base_attribute54,
4333 attrib.text_base_attribute55,
4334 attrib.text_base_attribute56,
4335 attrib.text_base_attribute57,
4336 attrib.text_base_attribute58,
4337 attrib.text_base_attribute59,
4338 attrib.text_base_attribute60,
4339 attrib.text_base_attribute61,
4340 attrib.text_base_attribute62,
4341 attrib.text_base_attribute63,
4342 attrib.text_base_attribute64,
4343 attrib.text_base_attribute65,
4344 attrib.text_base_attribute66,
4345 attrib.text_base_attribute67,
4346 attrib.text_base_attribute68,
4347 attrib.text_base_attribute69,
4348 attrib.text_base_attribute70,
4349 attrib.text_base_attribute71,
4350 attrib.text_base_attribute72,
4351 attrib.text_base_attribute73,
4352 attrib.text_base_attribute74,
4353 attrib.text_base_attribute75,
4354 attrib.text_base_attribute76,
4355 attrib.text_base_attribute77,
4356 attrib.text_base_attribute78,
4357 attrib.text_base_attribute79,
4358 attrib.text_base_attribute80,
4359 attrib.text_base_attribute81,
4360 attrib.text_base_attribute82,
4361 attrib.text_base_attribute83,
4362 attrib.text_base_attribute84,
4363 attrib.text_base_attribute85,
4364 attrib.text_base_attribute86,
4365 attrib.text_base_attribute87,
4366 attrib.text_base_attribute88,
4367 attrib.text_base_attribute89,
4368 attrib.text_base_attribute90,
4369 attrib.text_base_attribute91,
4370 attrib.text_base_attribute92,
4371 attrib.text_base_attribute93,
4372 attrib.text_base_attribute94,
4373 attrib.text_base_attribute95,
4374 attrib.text_base_attribute96,
4375 attrib.text_base_attribute97,
4376 attrib.text_base_attribute98,
4377 attrib.text_base_attribute99,
4378 attrib.text_base_attribute100,
4379 attrib.num_base_attribute1,
4380 attrib.num_base_attribute2,
4381 attrib.num_base_attribute3,
4382 attrib.num_base_attribute4,
4383 attrib.num_base_attribute5,
4384 attrib.num_base_attribute6,
4385 attrib.num_base_attribute7,
4386 attrib.num_base_attribute8,
4387 attrib.num_base_attribute9,
4388 attrib.num_base_attribute10,
4389 attrib.num_base_attribute11,
4390 attrib.num_base_attribute12,
4391 attrib.num_base_attribute13,
4392 attrib.num_base_attribute14,
4393 attrib.num_base_attribute15,
4394 attrib.num_base_attribute16,
4395 attrib.num_base_attribute17,
4396 attrib.num_base_attribute18,
4397 attrib.num_base_attribute19,
4398 attrib.num_base_attribute20,
4399 attrib.num_base_attribute21,
4400 attrib.num_base_attribute22,
4401 attrib.num_base_attribute23,
4402 attrib.num_base_attribute24,
4403 attrib.num_base_attribute25,
4404 attrib.num_base_attribute26,
4405 attrib.num_base_attribute27,
4406 attrib.num_base_attribute28,
4407 attrib.num_base_attribute29,
4408 attrib.num_base_attribute30,
4409 attrib.num_base_attribute31,
4410 attrib.num_base_attribute32,
4411 attrib.num_base_attribute33,
4412 attrib.num_base_attribute34,
4413 attrib.num_base_attribute35,
4414 attrib.num_base_attribute36,
4415 attrib.num_base_attribute37,
4416 attrib.num_base_attribute38,
4417 attrib.num_base_attribute39,
4418 attrib.num_base_attribute40,
4419 attrib.num_base_attribute41,
4420 attrib.num_base_attribute42,
4421 attrib.num_base_attribute43,
4422 attrib.num_base_attribute44,
4423 attrib.num_base_attribute45,
4424 attrib.num_base_attribute46,
4425 attrib.num_base_attribute47,
4426 attrib.num_base_attribute48,
4427 attrib.num_base_attribute49,
4428 attrib.num_base_attribute50,
4429 attrib.num_base_attribute51,
4430 attrib.num_base_attribute52,
4431 attrib.num_base_attribute53,
4432 attrib.num_base_attribute54,
4433 attrib.num_base_attribute55,
4434 attrib.num_base_attribute56,
4435 attrib.num_base_attribute57,
4436 attrib.num_base_attribute58,
4437 attrib.num_base_attribute59,
4438 attrib.num_base_attribute60,
4439 attrib.num_base_attribute61,
4440 attrib.num_base_attribute62,
4441 attrib.num_base_attribute63,
4442 attrib.num_base_attribute64,
4443 attrib.num_base_attribute65,
4444 attrib.num_base_attribute66,
4445 attrib.num_base_attribute67,
4446 attrib.num_base_attribute68,
4447 attrib.num_base_attribute69,
4448 attrib.num_base_attribute70,
4449 attrib.num_base_attribute71,
4450 attrib.num_base_attribute72,
4451 attrib.num_base_attribute73,
4452 attrib.num_base_attribute74,
4453 attrib.num_base_attribute75,
4454 attrib.num_base_attribute76,
4455 attrib.num_base_attribute77,
4456 attrib.num_base_attribute78,
4457 attrib.num_base_attribute79,
4458 attrib.num_base_attribute80,
4459 attrib.num_base_attribute81,
4460 attrib.num_base_attribute82,
4461 attrib.num_base_attribute83,
4462 attrib.num_base_attribute84,
4463 attrib.num_base_attribute85,
4464 attrib.num_base_attribute86,
4465 attrib.num_base_attribute87,
4466 attrib.num_base_attribute88,
4467 attrib.num_base_attribute89,
4468 attrib.num_base_attribute90,
4469 attrib.num_base_attribute91,
4470 attrib.num_base_attribute92,
4471 attrib.num_base_attribute93,
4472 attrib.num_base_attribute94,
4473 attrib.num_base_attribute95,
4474 attrib.num_base_attribute96,
4475 attrib.num_base_attribute97,
4476 attrib.num_base_attribute98,
4477 attrib.num_base_attribute99,
4478 attrib.num_base_attribute100,
4479 attrib.text_cat_attribute1,
4480 attrib.text_cat_attribute2,
4481 attrib.text_cat_attribute3,
4482 attrib.text_cat_attribute4,
4483 attrib.text_cat_attribute5,
4484 attrib.text_cat_attribute6,
4485 attrib.text_cat_attribute7,
4486 attrib.text_cat_attribute8,
4487 attrib.text_cat_attribute9,
4488 attrib.text_cat_attribute10,
4489 attrib.text_cat_attribute11,
4490 attrib.text_cat_attribute12,
4491 attrib.text_cat_attribute13,
4492 attrib.text_cat_attribute14,
4493 attrib.text_cat_attribute15,
4494 attrib.text_cat_attribute16,
4495 attrib.text_cat_attribute17,
4496 attrib.text_cat_attribute18,
4497 attrib.text_cat_attribute19,
4498 attrib.text_cat_attribute20,
4499 attrib.text_cat_attribute21,
4500 attrib.text_cat_attribute22,
4501 attrib.text_cat_attribute23,
4502 attrib.text_cat_attribute24,
4503 attrib.text_cat_attribute25,
4504 attrib.text_cat_attribute26,
4505 attrib.text_cat_attribute27,
4506 attrib.text_cat_attribute28,
4507 attrib.text_cat_attribute29,
4508 attrib.text_cat_attribute30,
4509 attrib.text_cat_attribute31,
4510 attrib.text_cat_attribute32,
4511 attrib.text_cat_attribute33,
4512 attrib.text_cat_attribute34,
4513 attrib.text_cat_attribute35,
4514 attrib.text_cat_attribute36,
4515 attrib.text_cat_attribute37,
4516 attrib.text_cat_attribute38,
4517 attrib.text_cat_attribute39,
4518 attrib.text_cat_attribute40,
4519 attrib.text_cat_attribute41,
4520 attrib.text_cat_attribute42,
4521 attrib.text_cat_attribute43,
4522 attrib.text_cat_attribute44,
4523 attrib.text_cat_attribute45,
4524 attrib.text_cat_attribute46,
4525 attrib.text_cat_attribute47,
4526 attrib.text_cat_attribute48,
4527 attrib.text_cat_attribute49,
4528 attrib.text_cat_attribute50,
4529 attrib.num_cat_attribute1,
4530 attrib.num_cat_attribute2,
4531 attrib.num_cat_attribute3,
4532 attrib.num_cat_attribute4,
4533 attrib.num_cat_attribute5,
4534 attrib.num_cat_attribute6,
4535 attrib.num_cat_attribute7,
4536 attrib.num_cat_attribute8,
4537 attrib.num_cat_attribute9,
4538 attrib.num_cat_attribute10,
4539 attrib.num_cat_attribute11,
4540 attrib.num_cat_attribute12,
4541 attrib.num_cat_attribute13,
4542 attrib.num_cat_attribute14,
4543 attrib.num_cat_attribute15,
4544 attrib.num_cat_attribute16,
4545 attrib.num_cat_attribute17,
4546 attrib.num_cat_attribute18,
4547 attrib.num_cat_attribute19,
4548 attrib.num_cat_attribute20,
4549 attrib.num_cat_attribute21,
4550 attrib.num_cat_attribute22,
4551 attrib.num_cat_attribute23,
4552 attrib.num_cat_attribute24,
4553 attrib.num_cat_attribute25,
4554 attrib.num_cat_attribute26,
4555 attrib.num_cat_attribute27,
4556 attrib.num_cat_attribute28,
4557 attrib.num_cat_attribute29,
4558 attrib.num_cat_attribute30,
4559 attrib.num_cat_attribute31,
4560 attrib.num_cat_attribute32,
4561 attrib.num_cat_attribute33,
4562 attrib.num_cat_attribute34,
4563 attrib.num_cat_attribute35,
4564 attrib.num_cat_attribute36,
4565 attrib.num_cat_attribute37,
4566 attrib.num_cat_attribute38,
4567 attrib.num_cat_attribute39,
4568 attrib.num_cat_attribute40,
4569 attrib.num_cat_attribute41,
4570 attrib.num_cat_attribute42,
4571 attrib.num_cat_attribute43,
4572 attrib.num_cat_attribute44,
4573 attrib.num_cat_attribute45,
4574 attrib.num_cat_attribute46,
4575 attrib.num_cat_attribute47,
4576 attrib.num_cat_attribute48,
4577 attrib.num_cat_attribute49,
4578 attrib.num_cat_attribute50,
4579 attrib.last_update_login,
4580 attrib.last_updated_by,
4581 attrib.last_update_date,
4582 attrib.created_by,
4583 attrib.creation_date,
4584 attrib.request_id,
4585 attrib.program_application_id,
4586 attrib.program_id,
4587 attrib.program_update_date,
4588 attrib.processing_id,
4589 'N' -- has_errors
4590 FROM PO_ATTR_VALUES_INTERFACE attrib,
4591 PO_LINES_INTERFACE POLI
4592 WHERE attrib.processing_id = request_processing_id
4593 AND attrib.process_code = PO_R12_CAT_UPG_PVT.g_PROCESS_CODE_NEW
4594 AND attrib.action IN (PO_R12_CAT_UPG_PVT.g_action_attr_create, 'UPDATE', 'DELETE')
4595 AND attrib.interface_line_id = POLI.interface_line_id;
4596
4597 l_attrib_table record_of_attr_values_type;
4598
4599 BEGIN
4600 l_progress := '010';
4601 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
4602
4603 -- Algorithm:
4604 -- 1. Load Lines batch (batch_size) into pl/sql table.
4605 -- 2. Call PDOI modules to process data in batches (default, derive, validate).
4606 -- 3. Get the validated pl/sql table for the batch from PDOI.
4607 -- 4. Transfer directly to Transaction tables
4608
4609 OPEN load_attrib_csr(g_processing_id);
4610
4611 l_progress := '020';
4612 LOOP
4613 BEGIN -- block to handle SNAPSHOT_TOO_OLD exception
4614 l_progress := '025';
4615 FETCH load_attrib_csr BULK COLLECT INTO
4616 l_attrib_table.interface_attr_values_id,
4617 l_attrib_table.interface_header_id,
4618 l_attrib_table.interface_line_id,
4619 l_attrib_table.action,
4620 l_attrib_table.process_code,
4621 l_attrib_table.po_line_id,
4622 l_attrib_table.req_template_name,
4623 l_attrib_table.req_template_line_num,
4624 l_attrib_table.ip_category_id,
4625 l_attrib_table.inventory_item_id,
4626 l_attrib_table.org_id,
4627 l_attrib_table.manufacturer_part_num,
4628 l_attrib_table.thumbnail_image,
4629 l_attrib_table.supplier_url,
4630 l_attrib_table.manufacturer_url,
4631 l_attrib_table.attachment_url,
4632 l_attrib_table.unspsc,
4633 l_attrib_table.availability,
4634 l_attrib_table.lead_time,
4635 l_attrib_table.text_base_attribute1,
4636 l_attrib_table.text_base_attribute2,
4637 l_attrib_table.text_base_attribute3,
4638 l_attrib_table.text_base_attribute4,
4639 l_attrib_table.text_base_attribute5,
4640 l_attrib_table.text_base_attribute6,
4641 l_attrib_table.text_base_attribute7,
4642 l_attrib_table.text_base_attribute8,
4643 l_attrib_table.text_base_attribute9,
4644 l_attrib_table.text_base_attribute10,
4645 l_attrib_table.text_base_attribute11,
4646 l_attrib_table.text_base_attribute12,
4647 l_attrib_table.text_base_attribute13,
4648 l_attrib_table.text_base_attribute14,
4649 l_attrib_table.text_base_attribute15,
4650 l_attrib_table.text_base_attribute16,
4651 l_attrib_table.text_base_attribute17,
4652 l_attrib_table.text_base_attribute18,
4653 l_attrib_table.text_base_attribute19,
4654 l_attrib_table.text_base_attribute20,
4655 l_attrib_table.text_base_attribute21,
4656 l_attrib_table.text_base_attribute22,
4657 l_attrib_table.text_base_attribute23,
4658 l_attrib_table.text_base_attribute24,
4659 l_attrib_table.text_base_attribute25,
4660 l_attrib_table.text_base_attribute26,
4661 l_attrib_table.text_base_attribute27,
4662 l_attrib_table.text_base_attribute28,
4663 l_attrib_table.text_base_attribute29,
4664 l_attrib_table.text_base_attribute30,
4665 l_attrib_table.text_base_attribute31,
4666 l_attrib_table.text_base_attribute32,
4667 l_attrib_table.text_base_attribute33,
4668 l_attrib_table.text_base_attribute34,
4669 l_attrib_table.text_base_attribute35,
4670 l_attrib_table.text_base_attribute36,
4671 l_attrib_table.text_base_attribute37,
4672 l_attrib_table.text_base_attribute38,
4673 l_attrib_table.text_base_attribute39,
4674 l_attrib_table.text_base_attribute40,
4675 l_attrib_table.text_base_attribute41,
4676 l_attrib_table.text_base_attribute42,
4677 l_attrib_table.text_base_attribute43,
4678 l_attrib_table.text_base_attribute44,
4679 l_attrib_table.text_base_attribute45,
4680 l_attrib_table.text_base_attribute46,
4681 l_attrib_table.text_base_attribute47,
4682 l_attrib_table.text_base_attribute48,
4683 l_attrib_table.text_base_attribute49,
4684 l_attrib_table.text_base_attribute50,
4685 l_attrib_table.text_base_attribute51,
4686 l_attrib_table.text_base_attribute52,
4687 l_attrib_table.text_base_attribute53,
4688 l_attrib_table.text_base_attribute54,
4689 l_attrib_table.text_base_attribute55,
4690 l_attrib_table.text_base_attribute56,
4691 l_attrib_table.text_base_attribute57,
4692 l_attrib_table.text_base_attribute58,
4693 l_attrib_table.text_base_attribute59,
4694 l_attrib_table.text_base_attribute60,
4695 l_attrib_table.text_base_attribute61,
4696 l_attrib_table.text_base_attribute62,
4697 l_attrib_table.text_base_attribute63,
4698 l_attrib_table.text_base_attribute64,
4699 l_attrib_table.text_base_attribute65,
4700 l_attrib_table.text_base_attribute66,
4701 l_attrib_table.text_base_attribute67,
4702 l_attrib_table.text_base_attribute68,
4703 l_attrib_table.text_base_attribute69,
4704 l_attrib_table.text_base_attribute70,
4705 l_attrib_table.text_base_attribute71,
4706 l_attrib_table.text_base_attribute72,
4707 l_attrib_table.text_base_attribute73,
4708 l_attrib_table.text_base_attribute74,
4709 l_attrib_table.text_base_attribute75,
4710 l_attrib_table.text_base_attribute76,
4711 l_attrib_table.text_base_attribute77,
4712 l_attrib_table.text_base_attribute78,
4713 l_attrib_table.text_base_attribute79,
4714 l_attrib_table.text_base_attribute80,
4715 l_attrib_table.text_base_attribute81,
4716 l_attrib_table.text_base_attribute82,
4717 l_attrib_table.text_base_attribute83,
4718 l_attrib_table.text_base_attribute84,
4719 l_attrib_table.text_base_attribute85,
4720 l_attrib_table.text_base_attribute86,
4721 l_attrib_table.text_base_attribute87,
4722 l_attrib_table.text_base_attribute88,
4723 l_attrib_table.text_base_attribute89,
4724 l_attrib_table.text_base_attribute90,
4725 l_attrib_table.text_base_attribute91,
4726 l_attrib_table.text_base_attribute92,
4727 l_attrib_table.text_base_attribute93,
4728 l_attrib_table.text_base_attribute94,
4729 l_attrib_table.text_base_attribute95,
4730 l_attrib_table.text_base_attribute96,
4731 l_attrib_table.text_base_attribute97,
4732 l_attrib_table.text_base_attribute98,
4733 l_attrib_table.text_base_attribute99,
4734 l_attrib_table.text_base_attribute100,
4735 l_attrib_table.num_base_attribute1,
4736 l_attrib_table.num_base_attribute2,
4737 l_attrib_table.num_base_attribute3,
4738 l_attrib_table.num_base_attribute4,
4739 l_attrib_table.num_base_attribute5,
4740 l_attrib_table.num_base_attribute6,
4741 l_attrib_table.num_base_attribute7,
4742 l_attrib_table.num_base_attribute8,
4743 l_attrib_table.num_base_attribute9,
4744 l_attrib_table.num_base_attribute10,
4745 l_attrib_table.num_base_attribute11,
4746 l_attrib_table.num_base_attribute12,
4747 l_attrib_table.num_base_attribute13,
4748 l_attrib_table.num_base_attribute14,
4749 l_attrib_table.num_base_attribute15,
4750 l_attrib_table.num_base_attribute16,
4751 l_attrib_table.num_base_attribute17,
4752 l_attrib_table.num_base_attribute18,
4753 l_attrib_table.num_base_attribute19,
4754 l_attrib_table.num_base_attribute20,
4755 l_attrib_table.num_base_attribute21,
4756 l_attrib_table.num_base_attribute22,
4757 l_attrib_table.num_base_attribute23,
4758 l_attrib_table.num_base_attribute24,
4759 l_attrib_table.num_base_attribute25,
4760 l_attrib_table.num_base_attribute26,
4761 l_attrib_table.num_base_attribute27,
4762 l_attrib_table.num_base_attribute28,
4763 l_attrib_table.num_base_attribute29,
4764 l_attrib_table.num_base_attribute30,
4765 l_attrib_table.num_base_attribute31,
4766 l_attrib_table.num_base_attribute32,
4767 l_attrib_table.num_base_attribute33,
4768 l_attrib_table.num_base_attribute34,
4769 l_attrib_table.num_base_attribute35,
4770 l_attrib_table.num_base_attribute36,
4771 l_attrib_table.num_base_attribute37,
4772 l_attrib_table.num_base_attribute38,
4773 l_attrib_table.num_base_attribute39,
4774 l_attrib_table.num_base_attribute40,
4775 l_attrib_table.num_base_attribute41,
4776 l_attrib_table.num_base_attribute42,
4777 l_attrib_table.num_base_attribute43,
4778 l_attrib_table.num_base_attribute44,
4779 l_attrib_table.num_base_attribute45,
4780 l_attrib_table.num_base_attribute46,
4781 l_attrib_table.num_base_attribute47,
4782 l_attrib_table.num_base_attribute48,
4783 l_attrib_table.num_base_attribute49,
4784 l_attrib_table.num_base_attribute50,
4785 l_attrib_table.num_base_attribute51,
4786 l_attrib_table.num_base_attribute52,
4787 l_attrib_table.num_base_attribute53,
4788 l_attrib_table.num_base_attribute54,
4789 l_attrib_table.num_base_attribute55,
4790 l_attrib_table.num_base_attribute56,
4791 l_attrib_table.num_base_attribute57,
4792 l_attrib_table.num_base_attribute58,
4793 l_attrib_table.num_base_attribute59,
4794 l_attrib_table.num_base_attribute60,
4795 l_attrib_table.num_base_attribute61,
4796 l_attrib_table.num_base_attribute62,
4797 l_attrib_table.num_base_attribute63,
4798 l_attrib_table.num_base_attribute64,
4799 l_attrib_table.num_base_attribute65,
4800 l_attrib_table.num_base_attribute66,
4801 l_attrib_table.num_base_attribute67,
4802 l_attrib_table.num_base_attribute68,
4803 l_attrib_table.num_base_attribute69,
4804 l_attrib_table.num_base_attribute70,
4805 l_attrib_table.num_base_attribute71,
4806 l_attrib_table.num_base_attribute72,
4807 l_attrib_table.num_base_attribute73,
4808 l_attrib_table.num_base_attribute74,
4809 l_attrib_table.num_base_attribute75,
4810 l_attrib_table.num_base_attribute76,
4811 l_attrib_table.num_base_attribute77,
4812 l_attrib_table.num_base_attribute78,
4813 l_attrib_table.num_base_attribute79,
4814 l_attrib_table.num_base_attribute80,
4815 l_attrib_table.num_base_attribute81,
4816 l_attrib_table.num_base_attribute82,
4817 l_attrib_table.num_base_attribute83,
4818 l_attrib_table.num_base_attribute84,
4819 l_attrib_table.num_base_attribute85,
4820 l_attrib_table.num_base_attribute86,
4821 l_attrib_table.num_base_attribute87,
4822 l_attrib_table.num_base_attribute88,
4823 l_attrib_table.num_base_attribute89,
4824 l_attrib_table.num_base_attribute90,
4825 l_attrib_table.num_base_attribute91,
4826 l_attrib_table.num_base_attribute92,
4827 l_attrib_table.num_base_attribute93,
4828 l_attrib_table.num_base_attribute94,
4829 l_attrib_table.num_base_attribute95,
4830 l_attrib_table.num_base_attribute96,
4831 l_attrib_table.num_base_attribute97,
4832 l_attrib_table.num_base_attribute98,
4833 l_attrib_table.num_base_attribute99,
4834 l_attrib_table.num_base_attribute100,
4835 l_attrib_table.text_cat_attribute1,
4836 l_attrib_table.text_cat_attribute2,
4837 l_attrib_table.text_cat_attribute3,
4838 l_attrib_table.text_cat_attribute4,
4839 l_attrib_table.text_cat_attribute5,
4840 l_attrib_table.text_cat_attribute6,
4841 l_attrib_table.text_cat_attribute7,
4842 l_attrib_table.text_cat_attribute8,
4843 l_attrib_table.text_cat_attribute9,
4844 l_attrib_table.text_cat_attribute10,
4845 l_attrib_table.text_cat_attribute11,
4846 l_attrib_table.text_cat_attribute12,
4847 l_attrib_table.text_cat_attribute13,
4848 l_attrib_table.text_cat_attribute14,
4849 l_attrib_table.text_cat_attribute15,
4850 l_attrib_table.text_cat_attribute16,
4851 l_attrib_table.text_cat_attribute17,
4852 l_attrib_table.text_cat_attribute18,
4853 l_attrib_table.text_cat_attribute19,
4854 l_attrib_table.text_cat_attribute20,
4855 l_attrib_table.text_cat_attribute21,
4856 l_attrib_table.text_cat_attribute22,
4857 l_attrib_table.text_cat_attribute23,
4858 l_attrib_table.text_cat_attribute24,
4859 l_attrib_table.text_cat_attribute25,
4860 l_attrib_table.text_cat_attribute26,
4861 l_attrib_table.text_cat_attribute27,
4862 l_attrib_table.text_cat_attribute28,
4863 l_attrib_table.text_cat_attribute29,
4864 l_attrib_table.text_cat_attribute30,
4865 l_attrib_table.text_cat_attribute31,
4866 l_attrib_table.text_cat_attribute32,
4867 l_attrib_table.text_cat_attribute33,
4868 l_attrib_table.text_cat_attribute34,
4869 l_attrib_table.text_cat_attribute35,
4870 l_attrib_table.text_cat_attribute36,
4871 l_attrib_table.text_cat_attribute37,
4872 l_attrib_table.text_cat_attribute38,
4873 l_attrib_table.text_cat_attribute39,
4874 l_attrib_table.text_cat_attribute40,
4875 l_attrib_table.text_cat_attribute41,
4876 l_attrib_table.text_cat_attribute42,
4877 l_attrib_table.text_cat_attribute43,
4878 l_attrib_table.text_cat_attribute44,
4879 l_attrib_table.text_cat_attribute45,
4880 l_attrib_table.text_cat_attribute46,
4881 l_attrib_table.text_cat_attribute47,
4882 l_attrib_table.text_cat_attribute48,
4883 l_attrib_table.text_cat_attribute49,
4884 l_attrib_table.text_cat_attribute50,
4885 l_attrib_table.num_cat_attribute1,
4886 l_attrib_table.num_cat_attribute2,
4887 l_attrib_table.num_cat_attribute3,
4888 l_attrib_table.num_cat_attribute4,
4889 l_attrib_table.num_cat_attribute5,
4890 l_attrib_table.num_cat_attribute6,
4891 l_attrib_table.num_cat_attribute7,
4892 l_attrib_table.num_cat_attribute8,
4893 l_attrib_table.num_cat_attribute9,
4894 l_attrib_table.num_cat_attribute10,
4895 l_attrib_table.num_cat_attribute11,
4896 l_attrib_table.num_cat_attribute12,
4897 l_attrib_table.num_cat_attribute13,
4898 l_attrib_table.num_cat_attribute14,
4899 l_attrib_table.num_cat_attribute15,
4900 l_attrib_table.num_cat_attribute16,
4901 l_attrib_table.num_cat_attribute17,
4902 l_attrib_table.num_cat_attribute18,
4903 l_attrib_table.num_cat_attribute19,
4904 l_attrib_table.num_cat_attribute20,
4905 l_attrib_table.num_cat_attribute21,
4906 l_attrib_table.num_cat_attribute22,
4907 l_attrib_table.num_cat_attribute23,
4908 l_attrib_table.num_cat_attribute24,
4909 l_attrib_table.num_cat_attribute25,
4910 l_attrib_table.num_cat_attribute26,
4911 l_attrib_table.num_cat_attribute27,
4912 l_attrib_table.num_cat_attribute28,
4913 l_attrib_table.num_cat_attribute29,
4914 l_attrib_table.num_cat_attribute30,
4915 l_attrib_table.num_cat_attribute31,
4916 l_attrib_table.num_cat_attribute32,
4917 l_attrib_table.num_cat_attribute33,
4918 l_attrib_table.num_cat_attribute34,
4919 l_attrib_table.num_cat_attribute35,
4920 l_attrib_table.num_cat_attribute36,
4921 l_attrib_table.num_cat_attribute37,
4922 l_attrib_table.num_cat_attribute38,
4923 l_attrib_table.num_cat_attribute39,
4924 l_attrib_table.num_cat_attribute40,
4925 l_attrib_table.num_cat_attribute41,
4926 l_attrib_table.num_cat_attribute42,
4927 l_attrib_table.num_cat_attribute43,
4928 l_attrib_table.num_cat_attribute44,
4929 l_attrib_table.num_cat_attribute45,
4930 l_attrib_table.num_cat_attribute46,
4931 l_attrib_table.num_cat_attribute47,
4932 l_attrib_table.num_cat_attribute48,
4933 l_attrib_table.num_cat_attribute49,
4934 l_attrib_table.num_cat_attribute50,
4935 l_attrib_table.last_update_login,
4936 l_attrib_table.last_updated_by,
4937 l_attrib_table.last_update_date,
4938 l_attrib_table.created_by,
4939 l_attrib_table.creation_date,
4940 l_attrib_table.request_id,
4941 l_attrib_table.program_application_id,
4942 l_attrib_table.program_id,
4943 l_attrib_table.program_update_date,
4944 l_attrib_table.processing_id,
4945 l_attrib_table.has_errors
4946 LIMIT g_job.batch_size;
4947
4948 l_progress := '030';
4949
4950 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_attrib_table.interface_line_id.COUNT='||l_attrib_table.interface_line_id.COUNT); END IF;
4951
4952 IF (l_attrib_table.interface_line_id.COUNT > 0) THEN
4953 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_attrib_table.interface_attr_values_id(1)='||l_attrib_table.interface_attr_values_id(1)); END IF;
4954 END IF;
4955
4956 EXIT WHEN l_attrib_table.interface_line_id.COUNT = 0;
4957
4958 -- Derive + Default + Validation are not required for attribute values
4959
4960 l_progress := '070';
4961 -- Skip transfer if running in Validate Only mode.
4962 IF (p_validate_only_mode = FND_API.G_FALSE) THEN
4963 -- Transfer Attribute Values
4964 transfer_attributes(p_attrib_values_tbl => l_attrib_table);
4965 END IF; -- IF (p_validate_only_mode = FND_API.G_FALSE)
4966
4967 l_progress := '100';
4968 COMMIT;
4969
4970 l_progress := '110';
4971 IF (l_attrib_table.interface_attr_values_id.COUNT < g_job.batch_size) THEN
4972 EXIT;
4973 END IF;
4974 l_progress := '120';
4975 EXCEPTION
4976 WHEN g_SNAPSHOT_TOO_OLD THEN
4977 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'EXCEPTION: SNAPSHOT_TOO_OLD. Now commiting and re-opening the load_attrib_csr'); END IF;
4978
4979 -- Commit and re-open the cursor
4980 l_progress := '130';
4981 COMMIT;
4982
4983 l_progress := '140';
4984 CLOSE load_attrib_csr;
4985
4986 l_progress := '150';
4987 OPEN load_attrib_csr(g_processing_id);
4988 l_progress := '160';
4989 END; -- block to handle SNAPSHOT_TOO_OLD exception
4990 END LOOP;
4991
4992 l_progress := '170';
4993 IF (load_attrib_csr%ISOPEN) THEN
4994 CLOSE load_attrib_csr;
4995 END IF;
4996
4997 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
4998 EXCEPTION
4999 WHEN OTHERS THEN
5000 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
5001 IF (load_attrib_csr%ISOPEN) THEN
5002 CLOSE load_attrib_csr;
5003 END IF;
5004 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
5005 END migrate_attributes;
5006
5007 --------------------------------------------------------------------------------
5008 --Start of Comments
5009 --Name: transfer_attributes
5010 --Pre-reqs:
5011 -- The iP catalog data is populated in PO Interface tables.
5012 --Modifies:
5013 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
5014 -- to the Interface tables.
5015 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
5016 -- failed the migration.
5017 -- c) FND_MSG_PUB on unhandled exceptions.
5018 --Locks:
5019 -- None.
5020 --Function:
5021 -- Transfers a batch of attribute values given in a plsql table, into the
5022 -- transaction tables.
5023 -- This API should be called during the upgrade phase only.
5024 --Parameters:
5025 --IN:
5026 -- p_attrib_values_tbl
5027 -- A table of plsql records containing a batch of attribute values
5028 --OUT:
5029 --End of Comments
5030 --------------------------------------------------------------------------------
5031 PROCEDURE transfer_attributes
5032 (
5033 p_attrib_values_tbl IN record_of_attr_values_type
5034 )
5035 IS
5036 l_api_name CONSTANT VARCHAR2(30) := 'transfer_attributes';
5037 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
5038 l_progress VARCHAR2(3) := '000';
5039
5040 BEGIN
5041 l_progress := '010';
5042 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
5043
5044 -- Insert Attributes
5045 insert_attributes(p_attr_values_tbl => p_attrib_values_tbl);
5046
5047 l_progress := '020';
5048 -- Update Attributes
5049 update_attributes(p_attr_values_tbl => p_attrib_values_tbl);
5050
5051 l_progress := '030';
5052 -- Delete Attributes
5053 -- This procedure is not required anymore. Deletion of the default attribute row is
5054 -- not allowed. Only update is allowed. In the pre-process validations, the rows
5055 -- that specified the DELETE action are already filtered.
5056 --delete_attributes(p_attr_values_tbl => p_attrib_values_tbl);
5057 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
5058 EXCEPTION
5059 WHEN OTHERS THEN
5060 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
5061 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
5062 END transfer_attributes;
5063
5064 --------------------------------------------------------------------------------
5065 --Start of Comments
5066 --Name: insert_attributes
5067 --Pre-reqs:
5068 -- The iP catalog data is populated in PO Interface tables.
5069 --Modifies:
5070 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
5071 -- to the Interface tables.
5072 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
5073 -- failed the migration.
5074 -- c) FND_MSG_PUB on unhandled exceptions.
5075 --Locks:
5076 -- None.
5077 --Function:
5078 -- Inserts a batch of attr values given in a plsql table, into the transaction
5079 -- tables.
5080 -- This API should be called during the upgrade phase only.
5081 --Parameters:
5082 --IN:
5083 -- p_attr_values_tbl
5084 -- A table of plsql records containing a batch of attr values
5085 --OUT:
5086 --End of Comments
5087 --------------------------------------------------------------------------------
5088 PROCEDURE insert_attributes
5089 (
5090 p_attr_values_tbl IN record_of_attr_values_type
5091 )
5092 IS
5093 l_api_name CONSTANT VARCHAR2(30) := 'insert_attributes';
5094 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
5095 l_progress VARCHAR2(3) := '000';
5096 BEGIN
5097 l_progress := '010';
5098 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
5099
5100 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_attr_values_tbl.po_line_id.COUNT='||p_attr_values_tbl.po_line_id.COUNT); END IF;
5101
5102 IF (p_attr_values_tbl.po_line_id.COUNT > 0) THEN
5103 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_attr_values_tbl.has_errors(1)='||p_attr_values_tbl.has_errors(1)); END IF;
5104 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_attr_values_tbl.action(1)='||p_attr_values_tbl.action(1)); END IF;
5105 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'p_attr_values_tbl.interface_attr_values_id(1)='||p_attr_values_tbl.interface_attr_values_id(1)); END IF;
5106 END IF;
5107
5108 -- SQL What: Insert rows that have no errors, and action = PO_R12_CAT_UPG_PVT.g_action_attr_create
5109 -- SQL Why : To migrate data to txn tables
5110 -- SQL Join: none
5111 FORALL i IN 1..p_attr_values_tbl.po_line_id.COUNT
5112 INSERT INTO po_attribute_values
5113 (attribute_values_id,
5114 po_line_id,
5115 req_template_name,
5116 req_template_line_num,
5117 ip_category_id,
5118 inventory_item_id,
5119 org_id,
5120 manufacturer_part_num,
5121 thumbnail_image,
5122 supplier_url,
5123 manufacturer_url,
5124 attachment_url,
5125 unspsc,
5126 availability,
5127 lead_time,
5128 text_base_attribute1,
5129 text_base_attribute2,
5130 text_base_attribute3,
5131 text_base_attribute4,
5132 text_base_attribute5,
5133 text_base_attribute6,
5134 text_base_attribute7,
5135 text_base_attribute8,
5136 text_base_attribute9,
5137 text_base_attribute10,
5138 text_base_attribute11,
5139 text_base_attribute12,
5140 text_base_attribute13,
5141 text_base_attribute14,
5142 text_base_attribute15,
5143 text_base_attribute16,
5144 text_base_attribute17,
5145 text_base_attribute18,
5146 text_base_attribute19,
5147 text_base_attribute20,
5148 text_base_attribute21,
5149 text_base_attribute22,
5150 text_base_attribute23,
5151 text_base_attribute24,
5152 text_base_attribute25,
5153 text_base_attribute26,
5154 text_base_attribute27,
5155 text_base_attribute28,
5156 text_base_attribute29,
5157 text_base_attribute30,
5158 text_base_attribute31,
5159 text_base_attribute32,
5160 text_base_attribute33,
5161 text_base_attribute34,
5162 text_base_attribute35,
5163 text_base_attribute36,
5164 text_base_attribute37,
5165 text_base_attribute38,
5166 text_base_attribute39,
5167 text_base_attribute40,
5168 text_base_attribute41,
5169 text_base_attribute42,
5170 text_base_attribute43,
5171 text_base_attribute44,
5172 text_base_attribute45,
5173 text_base_attribute46,
5174 text_base_attribute47,
5175 text_base_attribute48,
5176 text_base_attribute49,
5177 text_base_attribute50,
5178 text_base_attribute51,
5179 text_base_attribute52,
5180 text_base_attribute53,
5181 text_base_attribute54,
5182 text_base_attribute55,
5183 text_base_attribute56,
5184 text_base_attribute57,
5185 text_base_attribute58,
5186 text_base_attribute59,
5187 text_base_attribute60,
5188 text_base_attribute61,
5189 text_base_attribute62,
5190 text_base_attribute63,
5191 text_base_attribute64,
5192 text_base_attribute65,
5193 text_base_attribute66,
5194 text_base_attribute67,
5195 text_base_attribute68,
5196 text_base_attribute69,
5197 text_base_attribute70,
5198 text_base_attribute71,
5199 text_base_attribute72,
5200 text_base_attribute73,
5201 text_base_attribute74,
5202 text_base_attribute75,
5203 text_base_attribute76,
5204 text_base_attribute77,
5205 text_base_attribute78,
5206 text_base_attribute79,
5207 text_base_attribute80,
5208 text_base_attribute81,
5209 text_base_attribute82,
5210 text_base_attribute83,
5211 text_base_attribute84,
5212 text_base_attribute85,
5213 text_base_attribute86,
5214 text_base_attribute87,
5215 text_base_attribute88,
5216 text_base_attribute89,
5217 text_base_attribute90,
5218 text_base_attribute91,
5219 text_base_attribute92,
5220 text_base_attribute93,
5221 text_base_attribute94,
5222 text_base_attribute95,
5223 text_base_attribute96,
5224 text_base_attribute97,
5225 text_base_attribute98,
5226 text_base_attribute99,
5227 text_base_attribute100,
5228 num_base_attribute1,
5229 num_base_attribute2,
5230 num_base_attribute3,
5231 num_base_attribute4,
5232 num_base_attribute5,
5233 num_base_attribute6,
5234 num_base_attribute7,
5235 num_base_attribute8,
5236 num_base_attribute9,
5237 num_base_attribute10,
5238 num_base_attribute11,
5239 num_base_attribute12,
5240 num_base_attribute13,
5241 num_base_attribute14,
5242 num_base_attribute15,
5243 num_base_attribute16,
5244 num_base_attribute17,
5245 num_base_attribute18,
5246 num_base_attribute19,
5247 num_base_attribute20,
5248 num_base_attribute21,
5249 num_base_attribute22,
5250 num_base_attribute23,
5251 num_base_attribute24,
5252 num_base_attribute25,
5253 num_base_attribute26,
5254 num_base_attribute27,
5255 num_base_attribute28,
5256 num_base_attribute29,
5257 num_base_attribute30,
5258 num_base_attribute31,
5259 num_base_attribute32,
5260 num_base_attribute33,
5261 num_base_attribute34,
5262 num_base_attribute35,
5263 num_base_attribute36,
5264 num_base_attribute37,
5265 num_base_attribute38,
5266 num_base_attribute39,
5267 num_base_attribute40,
5268 num_base_attribute41,
5269 num_base_attribute42,
5270 num_base_attribute43,
5271 num_base_attribute44,
5272 num_base_attribute45,
5273 num_base_attribute46,
5274 num_base_attribute47,
5275 num_base_attribute48,
5276 num_base_attribute49,
5277 num_base_attribute50,
5278 num_base_attribute51,
5279 num_base_attribute52,
5280 num_base_attribute53,
5281 num_base_attribute54,
5282 num_base_attribute55,
5283 num_base_attribute56,
5284 num_base_attribute57,
5285 num_base_attribute58,
5286 num_base_attribute59,
5287 num_base_attribute60,
5288 num_base_attribute61,
5289 num_base_attribute62,
5290 num_base_attribute63,
5291 num_base_attribute64,
5292 num_base_attribute65,
5293 num_base_attribute66,
5294 num_base_attribute67,
5295 num_base_attribute68,
5296 num_base_attribute69,
5297 num_base_attribute70,
5298 num_base_attribute71,
5299 num_base_attribute72,
5300 num_base_attribute73,
5301 num_base_attribute74,
5302 num_base_attribute75,
5303 num_base_attribute76,
5304 num_base_attribute77,
5305 num_base_attribute78,
5306 num_base_attribute79,
5307 num_base_attribute80,
5308 num_base_attribute81,
5309 num_base_attribute82,
5310 num_base_attribute83,
5311 num_base_attribute84,
5312 num_base_attribute85,
5313 num_base_attribute86,
5314 num_base_attribute87,
5315 num_base_attribute88,
5316 num_base_attribute89,
5317 num_base_attribute90,
5318 num_base_attribute91,
5319 num_base_attribute92,
5320 num_base_attribute93,
5321 num_base_attribute94,
5322 num_base_attribute95,
5323 num_base_attribute96,
5324 num_base_attribute97,
5325 num_base_attribute98,
5326 num_base_attribute99,
5327 num_base_attribute100,
5328 text_cat_attribute1,
5329 text_cat_attribute2,
5330 text_cat_attribute3,
5331 text_cat_attribute4,
5332 text_cat_attribute5,
5333 text_cat_attribute6,
5334 text_cat_attribute7,
5335 text_cat_attribute8,
5336 text_cat_attribute9,
5337 text_cat_attribute10,
5338 text_cat_attribute11,
5339 text_cat_attribute12,
5340 text_cat_attribute13,
5341 text_cat_attribute14,
5342 text_cat_attribute15,
5343 text_cat_attribute16,
5344 text_cat_attribute17,
5345 text_cat_attribute18,
5346 text_cat_attribute19,
5347 text_cat_attribute20,
5348 text_cat_attribute21,
5349 text_cat_attribute22,
5350 text_cat_attribute23,
5351 text_cat_attribute24,
5352 text_cat_attribute25,
5353 text_cat_attribute26,
5354 text_cat_attribute27,
5355 text_cat_attribute28,
5356 text_cat_attribute29,
5357 text_cat_attribute30,
5358 text_cat_attribute31,
5359 text_cat_attribute32,
5360 text_cat_attribute33,
5361 text_cat_attribute34,
5362 text_cat_attribute35,
5363 text_cat_attribute36,
5364 text_cat_attribute37,
5365 text_cat_attribute38,
5366 text_cat_attribute39,
5367 text_cat_attribute40,
5368 text_cat_attribute41,
5369 text_cat_attribute42,
5370 text_cat_attribute43,
5371 text_cat_attribute44,
5372 text_cat_attribute45,
5373 text_cat_attribute46,
5374 text_cat_attribute47,
5375 text_cat_attribute48,
5376 text_cat_attribute49,
5377 text_cat_attribute50,
5378 num_cat_attribute1,
5379 num_cat_attribute2,
5380 num_cat_attribute3,
5381 num_cat_attribute4,
5382 num_cat_attribute5,
5383 num_cat_attribute6,
5384 num_cat_attribute7,
5385 num_cat_attribute8,
5386 num_cat_attribute9,
5387 num_cat_attribute10,
5388 num_cat_attribute11,
5389 num_cat_attribute12,
5390 num_cat_attribute13,
5391 num_cat_attribute14,
5392 num_cat_attribute15,
5393 num_cat_attribute16,
5394 num_cat_attribute17,
5395 num_cat_attribute18,
5396 num_cat_attribute19,
5397 num_cat_attribute20,
5398 num_cat_attribute21,
5399 num_cat_attribute22,
5400 num_cat_attribute23,
5401 num_cat_attribute24,
5402 num_cat_attribute25,
5403 num_cat_attribute26,
5404 num_cat_attribute27,
5405 num_cat_attribute28,
5406 num_cat_attribute29,
5407 num_cat_attribute30,
5408 num_cat_attribute31,
5409 num_cat_attribute32,
5410 num_cat_attribute33,
5411 num_cat_attribute34,
5412 num_cat_attribute35,
5413 num_cat_attribute36,
5414 num_cat_attribute37,
5415 num_cat_attribute38,
5416 num_cat_attribute39,
5417 num_cat_attribute40,
5418 num_cat_attribute41,
5419 num_cat_attribute42,
5420 num_cat_attribute43,
5421 num_cat_attribute44,
5422 num_cat_attribute45,
5423 num_cat_attribute46,
5424 num_cat_attribute47,
5425 num_cat_attribute48,
5426 num_cat_attribute49,
5427 num_cat_attribute50,
5428 last_update_login,
5429 last_updated_by,
5430 last_update_date,
5431 created_by,
5432 creation_date,
5433 request_id,
5434 program_application_id,
5435 program_id,
5436 program_update_date,
5437 last_updated_program
5438 )
5439 -- Bug 5677911: Added the hint for performance reason.
5440 SELECT /*+ INDEX(POAVI, PO_ATTR_VALUES_INT_U1)*/
5441 PO_ATTRIBUTE_VALUES_S.nextval,
5442
5443 -- ECO bug 4738058
5444 --p_attr_values_tbl.po_line_id(i),
5445 --bug 7245624 added nvl condition
5446 Nvl( POLI.po_line_id,-2),
5447
5448 p_attr_values_tbl.req_template_name(i),
5449 p_attr_values_tbl.req_template_line_num(i),
5450 p_attr_values_tbl.ip_category_id(i),
5451 p_attr_values_tbl.inventory_item_id(i),
5452 p_attr_values_tbl.org_id(i),
5453 p_attr_values_tbl.manufacturer_part_num(i),
5454 p_attr_values_tbl.thumbnail_image(i),
5455 p_attr_values_tbl.supplier_url(i),
5456 p_attr_values_tbl.manufacturer_url(i),
5457 p_attr_values_tbl.attachment_url(i),
5458 p_attr_values_tbl.unspsc(i),
5459 p_attr_values_tbl.availability(i),
5460 p_attr_values_tbl.lead_time(i),
5461 p_attr_values_tbl.text_base_attribute1(i),
5462 p_attr_values_tbl.text_base_attribute2(i),
5463 p_attr_values_tbl.text_base_attribute3(i),
5464 p_attr_values_tbl.text_base_attribute4(i),
5465 p_attr_values_tbl.text_base_attribute5(i),
5466 p_attr_values_tbl.text_base_attribute6(i),
5467 p_attr_values_tbl.text_base_attribute7(i),
5468 p_attr_values_tbl.text_base_attribute8(i),
5469 p_attr_values_tbl.text_base_attribute9(i),
5470 p_attr_values_tbl.text_base_attribute10(i),
5471 p_attr_values_tbl.text_base_attribute11(i),
5472 p_attr_values_tbl.text_base_attribute12(i),
5473 p_attr_values_tbl.text_base_attribute13(i),
5474 p_attr_values_tbl.text_base_attribute14(i),
5475 p_attr_values_tbl.text_base_attribute15(i),
5476 p_attr_values_tbl.text_base_attribute16(i),
5477 p_attr_values_tbl.text_base_attribute17(i),
5478 p_attr_values_tbl.text_base_attribute18(i),
5479 p_attr_values_tbl.text_base_attribute19(i),
5480 p_attr_values_tbl.text_base_attribute20(i),
5481 p_attr_values_tbl.text_base_attribute21(i),
5482 p_attr_values_tbl.text_base_attribute22(i),
5483 p_attr_values_tbl.text_base_attribute23(i),
5484 p_attr_values_tbl.text_base_attribute24(i),
5485 p_attr_values_tbl.text_base_attribute25(i),
5486 p_attr_values_tbl.text_base_attribute26(i),
5487 p_attr_values_tbl.text_base_attribute27(i),
5488 p_attr_values_tbl.text_base_attribute28(i),
5489 p_attr_values_tbl.text_base_attribute29(i),
5490 p_attr_values_tbl.text_base_attribute30(i),
5491 p_attr_values_tbl.text_base_attribute31(i),
5492 p_attr_values_tbl.text_base_attribute32(i),
5493 p_attr_values_tbl.text_base_attribute33(i),
5494 p_attr_values_tbl.text_base_attribute34(i),
5495 p_attr_values_tbl.text_base_attribute35(i),
5496 p_attr_values_tbl.text_base_attribute36(i),
5497 p_attr_values_tbl.text_base_attribute37(i),
5498 p_attr_values_tbl.text_base_attribute38(i),
5499 p_attr_values_tbl.text_base_attribute39(i),
5500 p_attr_values_tbl.text_base_attribute40(i),
5501 p_attr_values_tbl.text_base_attribute41(i),
5502 p_attr_values_tbl.text_base_attribute42(i),
5503 p_attr_values_tbl.text_base_attribute43(i),
5504 p_attr_values_tbl.text_base_attribute44(i),
5505 p_attr_values_tbl.text_base_attribute45(i),
5506 p_attr_values_tbl.text_base_attribute46(i),
5507 p_attr_values_tbl.text_base_attribute47(i),
5508 p_attr_values_tbl.text_base_attribute48(i),
5509 p_attr_values_tbl.text_base_attribute49(i),
5510 p_attr_values_tbl.text_base_attribute50(i),
5511 p_attr_values_tbl.text_base_attribute51(i),
5512 p_attr_values_tbl.text_base_attribute52(i),
5513 p_attr_values_tbl.text_base_attribute53(i),
5514 p_attr_values_tbl.text_base_attribute54(i),
5515 p_attr_values_tbl.text_base_attribute55(i),
5516 p_attr_values_tbl.text_base_attribute56(i),
5517 p_attr_values_tbl.text_base_attribute57(i),
5518 p_attr_values_tbl.text_base_attribute58(i),
5519 p_attr_values_tbl.text_base_attribute59(i),
5520 p_attr_values_tbl.text_base_attribute60(i),
5521 p_attr_values_tbl.text_base_attribute61(i),
5522 p_attr_values_tbl.text_base_attribute62(i),
5523 p_attr_values_tbl.text_base_attribute63(i),
5524 p_attr_values_tbl.text_base_attribute64(i),
5525 p_attr_values_tbl.text_base_attribute65(i),
5526 p_attr_values_tbl.text_base_attribute66(i),
5527 p_attr_values_tbl.text_base_attribute67(i),
5528 p_attr_values_tbl.text_base_attribute68(i),
5529 p_attr_values_tbl.text_base_attribute69(i),
5530 p_attr_values_tbl.text_base_attribute70(i),
5531 p_attr_values_tbl.text_base_attribute71(i),
5532 p_attr_values_tbl.text_base_attribute72(i),
5533 p_attr_values_tbl.text_base_attribute73(i),
5534 p_attr_values_tbl.text_base_attribute74(i),
5535 p_attr_values_tbl.text_base_attribute75(i),
5536 p_attr_values_tbl.text_base_attribute76(i),
5537 p_attr_values_tbl.text_base_attribute77(i),
5538 p_attr_values_tbl.text_base_attribute78(i),
5539 p_attr_values_tbl.text_base_attribute79(i),
5540 p_attr_values_tbl.text_base_attribute80(i),
5541 p_attr_values_tbl.text_base_attribute81(i),
5542 p_attr_values_tbl.text_base_attribute82(i),
5543 p_attr_values_tbl.text_base_attribute83(i),
5544 p_attr_values_tbl.text_base_attribute84(i),
5545 p_attr_values_tbl.text_base_attribute85(i),
5546 p_attr_values_tbl.text_base_attribute86(i),
5547 p_attr_values_tbl.text_base_attribute87(i),
5548 p_attr_values_tbl.text_base_attribute88(i),
5549 p_attr_values_tbl.text_base_attribute89(i),
5550 p_attr_values_tbl.text_base_attribute90(i),
5551 p_attr_values_tbl.text_base_attribute91(i),
5552 p_attr_values_tbl.text_base_attribute92(i),
5553 p_attr_values_tbl.text_base_attribute93(i),
5554 p_attr_values_tbl.text_base_attribute94(i),
5555 p_attr_values_tbl.text_base_attribute95(i),
5556 p_attr_values_tbl.text_base_attribute96(i),
5557 p_attr_values_tbl.text_base_attribute97(i),
5558 p_attr_values_tbl.text_base_attribute98(i),
5559 p_attr_values_tbl.text_base_attribute99(i),
5560 p_attr_values_tbl.text_base_attribute100(i),
5561 p_attr_values_tbl.num_base_attribute1(i),
5562 p_attr_values_tbl.num_base_attribute2(i),
5563 p_attr_values_tbl.num_base_attribute3(i),
5564 p_attr_values_tbl.num_base_attribute4(i),
5565 p_attr_values_tbl.num_base_attribute5(i),
5566 p_attr_values_tbl.num_base_attribute6(i),
5567 p_attr_values_tbl.num_base_attribute7(i),
5568 p_attr_values_tbl.num_base_attribute8(i),
5569 p_attr_values_tbl.num_base_attribute9(i),
5570 p_attr_values_tbl.num_base_attribute10(i),
5571 p_attr_values_tbl.num_base_attribute11(i),
5572 p_attr_values_tbl.num_base_attribute12(i),
5573 p_attr_values_tbl.num_base_attribute13(i),
5574 p_attr_values_tbl.num_base_attribute14(i),
5575 p_attr_values_tbl.num_base_attribute15(i),
5576 p_attr_values_tbl.num_base_attribute16(i),
5577 p_attr_values_tbl.num_base_attribute17(i),
5578 p_attr_values_tbl.num_base_attribute18(i),
5579 p_attr_values_tbl.num_base_attribute19(i),
5580 p_attr_values_tbl.num_base_attribute20(i),
5581 p_attr_values_tbl.num_base_attribute21(i),
5582 p_attr_values_tbl.num_base_attribute22(i),
5583 p_attr_values_tbl.num_base_attribute23(i),
5584 p_attr_values_tbl.num_base_attribute24(i),
5585 p_attr_values_tbl.num_base_attribute25(i),
5586 p_attr_values_tbl.num_base_attribute26(i),
5587 p_attr_values_tbl.num_base_attribute27(i),
5588 p_attr_values_tbl.num_base_attribute28(i),
5589 p_attr_values_tbl.num_base_attribute29(i),
5590 p_attr_values_tbl.num_base_attribute30(i),
5591 p_attr_values_tbl.num_base_attribute31(i),
5592 p_attr_values_tbl.num_base_attribute32(i),
5593 p_attr_values_tbl.num_base_attribute33(i),
5594 p_attr_values_tbl.num_base_attribute34(i),
5595 p_attr_values_tbl.num_base_attribute35(i),
5596 p_attr_values_tbl.num_base_attribute36(i),
5597 p_attr_values_tbl.num_base_attribute37(i),
5598 p_attr_values_tbl.num_base_attribute38(i),
5599 p_attr_values_tbl.num_base_attribute39(i),
5600 p_attr_values_tbl.num_base_attribute40(i),
5601 p_attr_values_tbl.num_base_attribute41(i),
5602 p_attr_values_tbl.num_base_attribute42(i),
5603 p_attr_values_tbl.num_base_attribute43(i),
5604 p_attr_values_tbl.num_base_attribute44(i),
5605 p_attr_values_tbl.num_base_attribute45(i),
5606 p_attr_values_tbl.num_base_attribute46(i),
5607 p_attr_values_tbl.num_base_attribute47(i),
5608 p_attr_values_tbl.num_base_attribute48(i),
5609 p_attr_values_tbl.num_base_attribute49(i),
5610 p_attr_values_tbl.num_base_attribute50(i),
5611 p_attr_values_tbl.num_base_attribute51(i),
5612 p_attr_values_tbl.num_base_attribute52(i),
5613 p_attr_values_tbl.num_base_attribute53(i),
5614 p_attr_values_tbl.num_base_attribute54(i),
5615 p_attr_values_tbl.num_base_attribute55(i),
5616 p_attr_values_tbl.num_base_attribute56(i),
5617 p_attr_values_tbl.num_base_attribute57(i),
5618 p_attr_values_tbl.num_base_attribute58(i),
5619 p_attr_values_tbl.num_base_attribute59(i),
5620 p_attr_values_tbl.num_base_attribute60(i),
5621 p_attr_values_tbl.num_base_attribute61(i),
5622 p_attr_values_tbl.num_base_attribute62(i),
5623 p_attr_values_tbl.num_base_attribute63(i),
5624 p_attr_values_tbl.num_base_attribute64(i),
5625 p_attr_values_tbl.num_base_attribute65(i),
5626 p_attr_values_tbl.num_base_attribute66(i),
5627 p_attr_values_tbl.num_base_attribute67(i),
5628 p_attr_values_tbl.num_base_attribute68(i),
5629 p_attr_values_tbl.num_base_attribute69(i),
5630 p_attr_values_tbl.num_base_attribute70(i),
5631 p_attr_values_tbl.num_base_attribute71(i),
5632 p_attr_values_tbl.num_base_attribute72(i),
5633 p_attr_values_tbl.num_base_attribute73(i),
5634 p_attr_values_tbl.num_base_attribute74(i),
5635 p_attr_values_tbl.num_base_attribute75(i),
5636 p_attr_values_tbl.num_base_attribute76(i),
5637 p_attr_values_tbl.num_base_attribute77(i),
5638 p_attr_values_tbl.num_base_attribute78(i),
5639 p_attr_values_tbl.num_base_attribute79(i),
5640 p_attr_values_tbl.num_base_attribute80(i),
5641 p_attr_values_tbl.num_base_attribute81(i),
5642 p_attr_values_tbl.num_base_attribute82(i),
5643 p_attr_values_tbl.num_base_attribute83(i),
5644 p_attr_values_tbl.num_base_attribute84(i),
5645 p_attr_values_tbl.num_base_attribute85(i),
5646 p_attr_values_tbl.num_base_attribute86(i),
5647 p_attr_values_tbl.num_base_attribute87(i),
5648 p_attr_values_tbl.num_base_attribute88(i),
5649 p_attr_values_tbl.num_base_attribute89(i),
5650 p_attr_values_tbl.num_base_attribute90(i),
5651 p_attr_values_tbl.num_base_attribute91(i),
5652 p_attr_values_tbl.num_base_attribute92(i),
5653 p_attr_values_tbl.num_base_attribute93(i),
5654 p_attr_values_tbl.num_base_attribute94(i),
5655 p_attr_values_tbl.num_base_attribute95(i),
5656 p_attr_values_tbl.num_base_attribute96(i),
5657 p_attr_values_tbl.num_base_attribute97(i),
5658 p_attr_values_tbl.num_base_attribute98(i),
5659 p_attr_values_tbl.num_base_attribute99(i),
5660 p_attr_values_tbl.num_base_attribute100(i),
5661 p_attr_values_tbl.text_cat_attribute1(i),
5662 p_attr_values_tbl.text_cat_attribute2(i),
5663 p_attr_values_tbl.text_cat_attribute3(i),
5664 p_attr_values_tbl.text_cat_attribute4(i),
5665 p_attr_values_tbl.text_cat_attribute5(i),
5666 p_attr_values_tbl.text_cat_attribute6(i),
5667 p_attr_values_tbl.text_cat_attribute7(i),
5668 p_attr_values_tbl.text_cat_attribute8(i),
5669 p_attr_values_tbl.text_cat_attribute9(i),
5670 p_attr_values_tbl.text_cat_attribute10(i),
5671 p_attr_values_tbl.text_cat_attribute11(i),
5672 p_attr_values_tbl.text_cat_attribute12(i),
5673 p_attr_values_tbl.text_cat_attribute13(i),
5674 p_attr_values_tbl.text_cat_attribute14(i),
5675 p_attr_values_tbl.text_cat_attribute15(i),
5676 p_attr_values_tbl.text_cat_attribute16(i),
5677 p_attr_values_tbl.text_cat_attribute17(i),
5678 p_attr_values_tbl.text_cat_attribute18(i),
5679 p_attr_values_tbl.text_cat_attribute19(i),
5680 p_attr_values_tbl.text_cat_attribute20(i),
5681 p_attr_values_tbl.text_cat_attribute21(i),
5682 p_attr_values_tbl.text_cat_attribute22(i),
5683 p_attr_values_tbl.text_cat_attribute23(i),
5684 p_attr_values_tbl.text_cat_attribute24(i),
5685 p_attr_values_tbl.text_cat_attribute25(i),
5686 p_attr_values_tbl.text_cat_attribute26(i),
5687 p_attr_values_tbl.text_cat_attribute27(i),
5688 p_attr_values_tbl.text_cat_attribute28(i),
5689 p_attr_values_tbl.text_cat_attribute29(i),
5690 p_attr_values_tbl.text_cat_attribute30(i),
5691 p_attr_values_tbl.text_cat_attribute31(i),
5692 p_attr_values_tbl.text_cat_attribute32(i),
5693 p_attr_values_tbl.text_cat_attribute33(i),
5694 p_attr_values_tbl.text_cat_attribute34(i),
5695 p_attr_values_tbl.text_cat_attribute35(i),
5696 p_attr_values_tbl.text_cat_attribute36(i),
5697 p_attr_values_tbl.text_cat_attribute37(i),
5698 p_attr_values_tbl.text_cat_attribute38(i),
5699 p_attr_values_tbl.text_cat_attribute39(i),
5700 p_attr_values_tbl.text_cat_attribute40(i),
5701 p_attr_values_tbl.text_cat_attribute41(i),
5702 p_attr_values_tbl.text_cat_attribute42(i),
5703 p_attr_values_tbl.text_cat_attribute43(i),
5704 p_attr_values_tbl.text_cat_attribute44(i),
5705 p_attr_values_tbl.text_cat_attribute45(i),
5706 p_attr_values_tbl.text_cat_attribute46(i),
5707 p_attr_values_tbl.text_cat_attribute47(i),
5708 p_attr_values_tbl.text_cat_attribute48(i),
5709 p_attr_values_tbl.text_cat_attribute49(i),
5710 p_attr_values_tbl.text_cat_attribute50(i),
5711 p_attr_values_tbl.num_cat_attribute1(i),
5712 p_attr_values_tbl.num_cat_attribute2(i),
5713 p_attr_values_tbl.num_cat_attribute3(i),
5714 p_attr_values_tbl.num_cat_attribute4(i),
5715 p_attr_values_tbl.num_cat_attribute5(i),
5716 p_attr_values_tbl.num_cat_attribute6(i),
5717 p_attr_values_tbl.num_cat_attribute7(i),
5718 p_attr_values_tbl.num_cat_attribute8(i),
5719 p_attr_values_tbl.num_cat_attribute9(i),
5720 p_attr_values_tbl.num_cat_attribute10(i),
5721 p_attr_values_tbl.num_cat_attribute11(i),
5722 p_attr_values_tbl.num_cat_attribute12(i),
5723 p_attr_values_tbl.num_cat_attribute13(i),
5724 p_attr_values_tbl.num_cat_attribute14(i),
5725 p_attr_values_tbl.num_cat_attribute15(i),
5726 p_attr_values_tbl.num_cat_attribute16(i),
5727 p_attr_values_tbl.num_cat_attribute17(i),
5728 p_attr_values_tbl.num_cat_attribute18(i),
5729 p_attr_values_tbl.num_cat_attribute19(i),
5730 p_attr_values_tbl.num_cat_attribute20(i),
5731 p_attr_values_tbl.num_cat_attribute21(i),
5732 p_attr_values_tbl.num_cat_attribute22(i),
5733 p_attr_values_tbl.num_cat_attribute23(i),
5734 p_attr_values_tbl.num_cat_attribute24(i),
5735 p_attr_values_tbl.num_cat_attribute25(i),
5736 p_attr_values_tbl.num_cat_attribute26(i),
5737 p_attr_values_tbl.num_cat_attribute27(i),
5738 p_attr_values_tbl.num_cat_attribute28(i),
5739 p_attr_values_tbl.num_cat_attribute29(i),
5740 p_attr_values_tbl.num_cat_attribute30(i),
5741 p_attr_values_tbl.num_cat_attribute31(i),
5742 p_attr_values_tbl.num_cat_attribute32(i),
5743 p_attr_values_tbl.num_cat_attribute33(i),
5744 p_attr_values_tbl.num_cat_attribute34(i),
5745 p_attr_values_tbl.num_cat_attribute35(i),
5746 p_attr_values_tbl.num_cat_attribute36(i),
5747 p_attr_values_tbl.num_cat_attribute37(i),
5748 p_attr_values_tbl.num_cat_attribute38(i),
5749 p_attr_values_tbl.num_cat_attribute39(i),
5750 p_attr_values_tbl.num_cat_attribute40(i),
5751 p_attr_values_tbl.num_cat_attribute41(i),
5752 p_attr_values_tbl.num_cat_attribute42(i),
5753 p_attr_values_tbl.num_cat_attribute43(i),
5754 p_attr_values_tbl.num_cat_attribute44(i),
5755 p_attr_values_tbl.num_cat_attribute45(i),
5756 p_attr_values_tbl.num_cat_attribute46(i),
5757 p_attr_values_tbl.num_cat_attribute47(i),
5758 p_attr_values_tbl.num_cat_attribute48(i),
5759 p_attr_values_tbl.num_cat_attribute49(i),
5760 p_attr_values_tbl.num_cat_attribute50(i),
5761 FND_GLOBAL.login_id, -- last_update_login
5762 FND_GLOBAL.user_id, -- last_updated_by
5763 sysdate, -- last_update_date
5764 g_R12_UPGRADE_USER, -- created_by
5765 sysdate, -- creation_date
5766 FND_GLOBAL.conc_request_id, -- request_id
5767 p_attr_values_tbl.program_application_id(i),
5768 p_attr_values_tbl.program_id(i),
5769 p_attr_values_tbl.program_update_date(i),
5770 g_R12_MIGRATION_PROGRAM -- last_updated_program
5771 FROM PO_ATTR_VALUES_INTERFACE POAVI,
5772 PO_LINES_INTERFACE POLI -- ECO bug 4738058
5773 WHERE POAVI.interface_attr_values_id = p_attr_values_tbl.interface_attr_values_id(i)
5774 AND p_attr_values_tbl.has_errors(i) = 'N'
5775 AND p_attr_values_tbl.action(i) = PO_R12_CAT_UPG_PVT.g_action_attr_create
5776 -- ECO bug 4738058
5777 AND POLI.interface_line_id = POAVI.interface_line_id;
5778
5779 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Attr inserted='||SQL%rowcount); END IF;
5780
5781 l_progress := '020';
5782 -- SQL What: Update the process_code on interface table as PROCESSED
5783 -- SQL Why : To mark the rows as successfully inserted
5784 -- SQL Join: interface_attr_values_id
5785 -- Bug 5677911: Added the hint for performance reason.
5786 FORALL i IN 1..p_attr_values_tbl.po_line_id.COUNT
5787 UPDATE PO_ATTR_VALUES_INTERFACE POAVI
5788 SET /*+ INDEX(POAVI, PO_ATTR_VALUES_INT_U1)*/
5789 process_code = g_PROCESS_CODE_PROCESSED
5790 -- ECO bug 4738058
5791 , po_line_id = (SELECT POLI.po_line_id
5792 FROM PO_LINES_INTERFACE POLI
5793 WHERE POLI.interface_line_id = POAVI.interface_line_id)
5794 WHERE POAVI.interface_attr_values_id = p_attr_values_tbl.interface_attr_values_id(i)
5795 AND p_attr_values_tbl.has_errors(i) = 'N'
5796 AND p_attr_values_tbl.action(i) = PO_R12_CAT_UPG_PVT.g_action_attr_create;
5797
5798 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Interface Attr PROCESSED='||SQL%rowcount); END IF;
5799
5800 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
5801 EXCEPTION
5802 WHEN OTHERS THEN
5803 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
5804 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
5805 END insert_attributes;
5806
5807 --------------------------------------------------------------------------------
5808 --Start of Comments
5809 --Name: update_attributes
5810 --Pre-reqs:
5811 -- The iP catalog data is populated in PO Interface tables.
5812 --Modifies:
5813 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
5814 -- to the Interface tables.
5815 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
5816 -- failed the migration.
5817 -- c) FND_MSG_PUB on unhandled exceptions.
5818 --Locks:
5819 -- None.
5820 --Function:
5821 -- Updates a batch of attr values given in a plsql table, into the transaction
5822 -- tables.
5823 -- This API should be called during the upgrade phase only.
5824 --Parameters:
5825 --IN:
5826 -- p_attr_values_tbl
5827 -- A table of plsql records containing a batch of attr values
5828 --OUT:
5829 --End of Comments
5830 --------------------------------------------------------------------------------
5831 PROCEDURE update_attributes
5832 (
5833 p_attr_values_tbl IN record_of_attr_values_type
5834 )
5835 IS
5836 l_api_name CONSTANT VARCHAR2(30) := 'update_attributes';
5837 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
5838 l_progress VARCHAR2(3) := '000';
5839 BEGIN
5840 l_progress := '010';
5841 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
5842
5843 -- SQL What: Update Rows that do not have errors. Overwrite all values
5844 -- from interface table to transaction table
5845 -- SQL Why : To update the po_attribute_values columns
5846 -- SQL Join: po_line_id
5847
5848 -- Bug#5389286: Removed unnecessary OR conditions in the criteria
5849 -- For an update action, iP will always populate the
5850 -- po_line_id/req_template_name/req_template_line_num/org_id in the
5851 -- attr/attr_tlp interface tables
5852 FORALL i IN 1..p_attr_values_tbl.po_line_id.COUNT
5853 UPDATE po_attribute_values
5854 SET
5855 ip_category_id = p_attr_values_tbl.ip_category_id(i),
5856 inventory_item_id = p_attr_values_tbl.inventory_item_id(i),
5857 manufacturer_part_num = p_attr_values_tbl.manufacturer_part_num(i),
5858 thumbnail_image = p_attr_values_tbl.thumbnail_image(i),
5859 supplier_url = p_attr_values_tbl.supplier_url(i),
5860 manufacturer_url = p_attr_values_tbl.manufacturer_url(i),
5861 attachment_url = p_attr_values_tbl.attachment_url(i),
5862 unspsc = p_attr_values_tbl.unspsc(i),
5863 availability = p_attr_values_tbl.availability(i),
5864 lead_time = p_attr_values_tbl.lead_time(i),
5865 text_base_attribute1 = p_attr_values_tbl.text_base_attribute1(i),
5866 text_base_attribute2 = p_attr_values_tbl.text_base_attribute2(i),
5867 text_base_attribute3 = p_attr_values_tbl.text_base_attribute3(i),
5868 text_base_attribute4 = p_attr_values_tbl.text_base_attribute4(i),
5869 text_base_attribute5 = p_attr_values_tbl.text_base_attribute5(i),
5870 text_base_attribute6 = p_attr_values_tbl.text_base_attribute6(i),
5871 text_base_attribute7 = p_attr_values_tbl.text_base_attribute7(i),
5872 text_base_attribute8 = p_attr_values_tbl.text_base_attribute8(i),
5873 text_base_attribute9 = p_attr_values_tbl.text_base_attribute9(i),
5874 text_base_attribute10 = p_attr_values_tbl.text_base_attribute10(i),
5875 text_base_attribute11 = p_attr_values_tbl.text_base_attribute11(i),
5876 text_base_attribute12 = p_attr_values_tbl.text_base_attribute12(i),
5877 text_base_attribute13 = p_attr_values_tbl.text_base_attribute13(i),
5878 text_base_attribute14 = p_attr_values_tbl.text_base_attribute14(i),
5879 text_base_attribute15 = p_attr_values_tbl.text_base_attribute15(i),
5880 text_base_attribute16 = p_attr_values_tbl.text_base_attribute16(i),
5881 text_base_attribute17 = p_attr_values_tbl.text_base_attribute17(i),
5882 text_base_attribute18 = p_attr_values_tbl.text_base_attribute18(i),
5883 text_base_attribute19 = p_attr_values_tbl.text_base_attribute19(i),
5884 text_base_attribute20 = p_attr_values_tbl.text_base_attribute20(i),
5885 text_base_attribute21 = p_attr_values_tbl.text_base_attribute21(i),
5886 text_base_attribute22 = p_attr_values_tbl.text_base_attribute22(i),
5887 text_base_attribute23 = p_attr_values_tbl.text_base_attribute23(i),
5888 text_base_attribute24 = p_attr_values_tbl.text_base_attribute24(i),
5889 text_base_attribute25 = p_attr_values_tbl.text_base_attribute25(i),
5890 text_base_attribute26 = p_attr_values_tbl.text_base_attribute26(i),
5891 text_base_attribute27 = p_attr_values_tbl.text_base_attribute27(i),
5892 text_base_attribute28 = p_attr_values_tbl.text_base_attribute28(i),
5893 text_base_attribute29 = p_attr_values_tbl.text_base_attribute29(i),
5894 text_base_attribute30 = p_attr_values_tbl.text_base_attribute30(i),
5895 text_base_attribute31 = p_attr_values_tbl.text_base_attribute31(i),
5896 text_base_attribute32 = p_attr_values_tbl.text_base_attribute32(i),
5897 text_base_attribute33 = p_attr_values_tbl.text_base_attribute33(i),
5898 text_base_attribute34 = p_attr_values_tbl.text_base_attribute34(i),
5899 text_base_attribute35 = p_attr_values_tbl.text_base_attribute35(i),
5900 text_base_attribute36 = p_attr_values_tbl.text_base_attribute36(i),
5901 text_base_attribute37 = p_attr_values_tbl.text_base_attribute37(i),
5902 text_base_attribute38 = p_attr_values_tbl.text_base_attribute38(i),
5903 text_base_attribute39 = p_attr_values_tbl.text_base_attribute39(i),
5904 text_base_attribute40 = p_attr_values_tbl.text_base_attribute40(i),
5905 text_base_attribute41 = p_attr_values_tbl.text_base_attribute41(i),
5906 text_base_attribute42 = p_attr_values_tbl.text_base_attribute42(i),
5907 text_base_attribute43 = p_attr_values_tbl.text_base_attribute43(i),
5908 text_base_attribute44 = p_attr_values_tbl.text_base_attribute44(i),
5909 text_base_attribute45 = p_attr_values_tbl.text_base_attribute45(i),
5910 text_base_attribute46 = p_attr_values_tbl.text_base_attribute46(i),
5911 text_base_attribute47 = p_attr_values_tbl.text_base_attribute47(i),
5912 text_base_attribute48 = p_attr_values_tbl.text_base_attribute48(i),
5913 text_base_attribute49 = p_attr_values_tbl.text_base_attribute49(i),
5914 text_base_attribute50 = p_attr_values_tbl.text_base_attribute50(i),
5915 text_base_attribute51 = p_attr_values_tbl.text_base_attribute51(i),
5916 text_base_attribute52 = p_attr_values_tbl.text_base_attribute52(i),
5917 text_base_attribute53 = p_attr_values_tbl.text_base_attribute53(i),
5918 text_base_attribute54 = p_attr_values_tbl.text_base_attribute54(i),
5919 text_base_attribute55 = p_attr_values_tbl.text_base_attribute55(i),
5920 text_base_attribute56 = p_attr_values_tbl.text_base_attribute56(i),
5921 text_base_attribute57 = p_attr_values_tbl.text_base_attribute57(i),
5922 text_base_attribute58 = p_attr_values_tbl.text_base_attribute58(i),
5923 text_base_attribute59 = p_attr_values_tbl.text_base_attribute59(i),
5924 text_base_attribute60 = p_attr_values_tbl.text_base_attribute60(i),
5925 text_base_attribute61 = p_attr_values_tbl.text_base_attribute61(i),
5926 text_base_attribute62 = p_attr_values_tbl.text_base_attribute62(i),
5927 text_base_attribute63 = p_attr_values_tbl.text_base_attribute63(i),
5928 text_base_attribute64 = p_attr_values_tbl.text_base_attribute64(i),
5929 text_base_attribute65 = p_attr_values_tbl.text_base_attribute65(i),
5930 text_base_attribute66 = p_attr_values_tbl.text_base_attribute66(i),
5931 text_base_attribute67 = p_attr_values_tbl.text_base_attribute67(i),
5932 text_base_attribute68 = p_attr_values_tbl.text_base_attribute68(i),
5933 text_base_attribute69 = p_attr_values_tbl.text_base_attribute69(i),
5934 text_base_attribute70 = p_attr_values_tbl.text_base_attribute70(i),
5935 text_base_attribute71 = p_attr_values_tbl.text_base_attribute71(i),
5936 text_base_attribute72 = p_attr_values_tbl.text_base_attribute72(i),
5937 text_base_attribute73 = p_attr_values_tbl.text_base_attribute73(i),
5938 text_base_attribute74 = p_attr_values_tbl.text_base_attribute74(i),
5939 text_base_attribute75 = p_attr_values_tbl.text_base_attribute75(i),
5940 text_base_attribute76 = p_attr_values_tbl.text_base_attribute76(i),
5941 text_base_attribute77 = p_attr_values_tbl.text_base_attribute77(i),
5942 text_base_attribute78 = p_attr_values_tbl.text_base_attribute78(i),
5943 text_base_attribute79 = p_attr_values_tbl.text_base_attribute79(i),
5944 text_base_attribute80 = p_attr_values_tbl.text_base_attribute80(i),
5945 text_base_attribute81 = p_attr_values_tbl.text_base_attribute81(i),
5946 text_base_attribute82 = p_attr_values_tbl.text_base_attribute82(i),
5947 text_base_attribute83 = p_attr_values_tbl.text_base_attribute83(i),
5948 text_base_attribute84 = p_attr_values_tbl.text_base_attribute84(i),
5949 text_base_attribute85 = p_attr_values_tbl.text_base_attribute85(i),
5950 text_base_attribute86 = p_attr_values_tbl.text_base_attribute86(i),
5951 text_base_attribute87 = p_attr_values_tbl.text_base_attribute87(i),
5952 text_base_attribute88 = p_attr_values_tbl.text_base_attribute88(i),
5953 text_base_attribute89 = p_attr_values_tbl.text_base_attribute89(i),
5954 text_base_attribute90 = p_attr_values_tbl.text_base_attribute90(i),
5955 text_base_attribute91 = p_attr_values_tbl.text_base_attribute91(i),
5956 text_base_attribute92 = p_attr_values_tbl.text_base_attribute92(i),
5957 text_base_attribute93 = p_attr_values_tbl.text_base_attribute93(i),
5958 text_base_attribute94 = p_attr_values_tbl.text_base_attribute94(i),
5959 text_base_attribute95 = p_attr_values_tbl.text_base_attribute95(i),
5960 text_base_attribute96 = p_attr_values_tbl.text_base_attribute96(i),
5961 text_base_attribute97 = p_attr_values_tbl.text_base_attribute97(i),
5962 text_base_attribute98 = p_attr_values_tbl.text_base_attribute98(i),
5963 text_base_attribute99 = p_attr_values_tbl.text_base_attribute99(i),
5964 text_base_attribute100 = p_attr_values_tbl.text_base_attribute100(i),
5965 num_base_attribute1 = p_attr_values_tbl.num_base_attribute1(i),
5966 num_base_attribute2 = p_attr_values_tbl.num_base_attribute2(i),
5967 num_base_attribute3 = p_attr_values_tbl.num_base_attribute3(i),
5968 num_base_attribute4 = p_attr_values_tbl.num_base_attribute4(i),
5969 num_base_attribute5 = p_attr_values_tbl.num_base_attribute5(i),
5970 num_base_attribute6 = p_attr_values_tbl.num_base_attribute6(i),
5971 num_base_attribute7 = p_attr_values_tbl.num_base_attribute7(i),
5972 num_base_attribute8 = p_attr_values_tbl.num_base_attribute8(i),
5973 num_base_attribute9 = p_attr_values_tbl.num_base_attribute9(i),
5974 num_base_attribute10 = p_attr_values_tbl.num_base_attribute10(i),
5975 num_base_attribute11 = p_attr_values_tbl.num_base_attribute11(i),
5976 num_base_attribute12 = p_attr_values_tbl.num_base_attribute12(i),
5977 num_base_attribute13 = p_attr_values_tbl.num_base_attribute13(i),
5978 num_base_attribute14 = p_attr_values_tbl.num_base_attribute14(i),
5979 num_base_attribute15 = p_attr_values_tbl.num_base_attribute15(i),
5980 num_base_attribute16 = p_attr_values_tbl.num_base_attribute16(i),
5981 num_base_attribute17 = p_attr_values_tbl.num_base_attribute17(i),
5982 num_base_attribute18 = p_attr_values_tbl.num_base_attribute18(i),
5983 num_base_attribute19 = p_attr_values_tbl.num_base_attribute19(i),
5984 num_base_attribute20 = p_attr_values_tbl.num_base_attribute20(i),
5985 num_base_attribute21 = p_attr_values_tbl.num_base_attribute21(i),
5986 num_base_attribute22 = p_attr_values_tbl.num_base_attribute22(i),
5987 num_base_attribute23 = p_attr_values_tbl.num_base_attribute23(i),
5988 num_base_attribute24 = p_attr_values_tbl.num_base_attribute24(i),
5989 num_base_attribute25 = p_attr_values_tbl.num_base_attribute25(i),
5990 num_base_attribute26 = p_attr_values_tbl.num_base_attribute26(i),
5991 num_base_attribute27 = p_attr_values_tbl.num_base_attribute27(i),
5992 num_base_attribute28 = p_attr_values_tbl.num_base_attribute28(i),
5993 num_base_attribute29 = p_attr_values_tbl.num_base_attribute29(i),
5994 num_base_attribute30 = p_attr_values_tbl.num_base_attribute30(i),
5995 num_base_attribute31 = p_attr_values_tbl.num_base_attribute31(i),
5996 num_base_attribute32 = p_attr_values_tbl.num_base_attribute32(i),
5997 num_base_attribute33 = p_attr_values_tbl.num_base_attribute33(i),
5998 num_base_attribute34 = p_attr_values_tbl.num_base_attribute34(i),
5999 num_base_attribute35 = p_attr_values_tbl.num_base_attribute35(i),
6000 num_base_attribute36 = p_attr_values_tbl.num_base_attribute36(i),
6001 num_base_attribute37 = p_attr_values_tbl.num_base_attribute37(i),
6002 num_base_attribute38 = p_attr_values_tbl.num_base_attribute38(i),
6003 num_base_attribute39 = p_attr_values_tbl.num_base_attribute39(i),
6004 num_base_attribute40 = p_attr_values_tbl.num_base_attribute40(i),
6005 num_base_attribute41 = p_attr_values_tbl.num_base_attribute41(i),
6006 num_base_attribute42 = p_attr_values_tbl.num_base_attribute42(i),
6007 num_base_attribute43 = p_attr_values_tbl.num_base_attribute43(i),
6008 num_base_attribute44 = p_attr_values_tbl.num_base_attribute44(i),
6009 num_base_attribute45 = p_attr_values_tbl.num_base_attribute45(i),
6010 num_base_attribute46 = p_attr_values_tbl.num_base_attribute46(i),
6011 num_base_attribute47 = p_attr_values_tbl.num_base_attribute47(i),
6012 num_base_attribute48 = p_attr_values_tbl.num_base_attribute48(i),
6013 num_base_attribute49 = p_attr_values_tbl.num_base_attribute49(i),
6014 num_base_attribute50 = p_attr_values_tbl.num_base_attribute50(i),
6015 num_base_attribute51 = p_attr_values_tbl.num_base_attribute51(i),
6016 num_base_attribute52 = p_attr_values_tbl.num_base_attribute52(i),
6017 num_base_attribute53 = p_attr_values_tbl.num_base_attribute53(i),
6018 num_base_attribute54 = p_attr_values_tbl.num_base_attribute54(i),
6019 num_base_attribute55 = p_attr_values_tbl.num_base_attribute55(i),
6020 num_base_attribute56 = p_attr_values_tbl.num_base_attribute56(i),
6021 num_base_attribute57 = p_attr_values_tbl.num_base_attribute57(i),
6022 num_base_attribute58 = p_attr_values_tbl.num_base_attribute58(i),
6023 num_base_attribute59 = p_attr_values_tbl.num_base_attribute59(i),
6024 num_base_attribute60 = p_attr_values_tbl.num_base_attribute60(i),
6025 num_base_attribute61 = p_attr_values_tbl.num_base_attribute61(i),
6026 num_base_attribute62 = p_attr_values_tbl.num_base_attribute62(i),
6027 num_base_attribute63 = p_attr_values_tbl.num_base_attribute63(i),
6028 num_base_attribute64 = p_attr_values_tbl.num_base_attribute64(i),
6029 num_base_attribute65 = p_attr_values_tbl.num_base_attribute65(i),
6030 num_base_attribute66 = p_attr_values_tbl.num_base_attribute66(i),
6031 num_base_attribute67 = p_attr_values_tbl.num_base_attribute67(i),
6032 num_base_attribute68 = p_attr_values_tbl.num_base_attribute68(i),
6033 num_base_attribute69 = p_attr_values_tbl.num_base_attribute69(i),
6034 num_base_attribute70 = p_attr_values_tbl.num_base_attribute70(i),
6035 num_base_attribute71 = p_attr_values_tbl.num_base_attribute71(i),
6036 num_base_attribute72 = p_attr_values_tbl.num_base_attribute72(i),
6037 num_base_attribute73 = p_attr_values_tbl.num_base_attribute73(i),
6038 num_base_attribute74 = p_attr_values_tbl.num_base_attribute74(i),
6039 num_base_attribute75 = p_attr_values_tbl.num_base_attribute75(i),
6040 num_base_attribute76 = p_attr_values_tbl.num_base_attribute76(i),
6041 num_base_attribute77 = p_attr_values_tbl.num_base_attribute77(i),
6042 num_base_attribute78 = p_attr_values_tbl.num_base_attribute78(i),
6043 num_base_attribute79 = p_attr_values_tbl.num_base_attribute79(i),
6044 num_base_attribute80 = p_attr_values_tbl.num_base_attribute80(i),
6045 num_base_attribute81 = p_attr_values_tbl.num_base_attribute81(i),
6046 num_base_attribute82 = p_attr_values_tbl.num_base_attribute82(i),
6047 num_base_attribute83 = p_attr_values_tbl.num_base_attribute83(i),
6048 num_base_attribute84 = p_attr_values_tbl.num_base_attribute84(i),
6049 num_base_attribute85 = p_attr_values_tbl.num_base_attribute85(i),
6050 num_base_attribute86 = p_attr_values_tbl.num_base_attribute86(i),
6051 num_base_attribute87 = p_attr_values_tbl.num_base_attribute87(i),
6052 num_base_attribute88 = p_attr_values_tbl.num_base_attribute88(i),
6053 num_base_attribute89 = p_attr_values_tbl.num_base_attribute89(i),
6054 num_base_attribute90 = p_attr_values_tbl.num_base_attribute90(i),
6055 num_base_attribute91 = p_attr_values_tbl.num_base_attribute91(i),
6056 num_base_attribute92 = p_attr_values_tbl.num_base_attribute92(i),
6057 num_base_attribute93 = p_attr_values_tbl.num_base_attribute93(i),
6058 num_base_attribute94 = p_attr_values_tbl.num_base_attribute94(i),
6059 num_base_attribute95 = p_attr_values_tbl.num_base_attribute95(i),
6060 num_base_attribute96 = p_attr_values_tbl.num_base_attribute96(i),
6061 num_base_attribute97 = p_attr_values_tbl.num_base_attribute97(i),
6062 num_base_attribute98 = p_attr_values_tbl.num_base_attribute98(i),
6063 num_base_attribute99 = p_attr_values_tbl.num_base_attribute99(i),
6064 num_base_attribute100 = p_attr_values_tbl.num_base_attribute100(i),
6065 text_cat_attribute1 = p_attr_values_tbl.text_cat_attribute1(i),
6066 text_cat_attribute2 = p_attr_values_tbl.text_cat_attribute2(i),
6067 text_cat_attribute3 = p_attr_values_tbl.text_cat_attribute3(i),
6068 text_cat_attribute4 = p_attr_values_tbl.text_cat_attribute4(i),
6069 text_cat_attribute5 = p_attr_values_tbl.text_cat_attribute5(i),
6070 text_cat_attribute6 = p_attr_values_tbl.text_cat_attribute6(i),
6071 text_cat_attribute7 = p_attr_values_tbl.text_cat_attribute7(i),
6072 text_cat_attribute8 = p_attr_values_tbl.text_cat_attribute8(i),
6073 text_cat_attribute9 = p_attr_values_tbl.text_cat_attribute9(i),
6074 text_cat_attribute10 = p_attr_values_tbl.text_cat_attribute10(i),
6075 text_cat_attribute11 = p_attr_values_tbl.text_cat_attribute11(i),
6076 text_cat_attribute12 = p_attr_values_tbl.text_cat_attribute12(i),
6077 text_cat_attribute13 = p_attr_values_tbl.text_cat_attribute13(i),
6078 text_cat_attribute14 = p_attr_values_tbl.text_cat_attribute14(i),
6079 text_cat_attribute15 = p_attr_values_tbl.text_cat_attribute15(i),
6080 text_cat_attribute16 = p_attr_values_tbl.text_cat_attribute16(i),
6081 text_cat_attribute17 = p_attr_values_tbl.text_cat_attribute17(i),
6082 text_cat_attribute18 = p_attr_values_tbl.text_cat_attribute18(i),
6083 text_cat_attribute19 = p_attr_values_tbl.text_cat_attribute19(i),
6084 text_cat_attribute20 = p_attr_values_tbl.text_cat_attribute20(i),
6085 text_cat_attribute21 = p_attr_values_tbl.text_cat_attribute21(i),
6086 text_cat_attribute22 = p_attr_values_tbl.text_cat_attribute22(i),
6087 text_cat_attribute23 = p_attr_values_tbl.text_cat_attribute23(i),
6088 text_cat_attribute24 = p_attr_values_tbl.text_cat_attribute24(i),
6089 text_cat_attribute25 = p_attr_values_tbl.text_cat_attribute25(i),
6090 text_cat_attribute26 = p_attr_values_tbl.text_cat_attribute26(i),
6091 text_cat_attribute27 = p_attr_values_tbl.text_cat_attribute27(i),
6092 text_cat_attribute28 = p_attr_values_tbl.text_cat_attribute28(i),
6093 text_cat_attribute29 = p_attr_values_tbl.text_cat_attribute29(i),
6094 text_cat_attribute30 = p_attr_values_tbl.text_cat_attribute30(i),
6095 text_cat_attribute31 = p_attr_values_tbl.text_cat_attribute31(i),
6096 text_cat_attribute32 = p_attr_values_tbl.text_cat_attribute32(i),
6097 text_cat_attribute33 = p_attr_values_tbl.text_cat_attribute33(i),
6098 text_cat_attribute34 = p_attr_values_tbl.text_cat_attribute34(i),
6099 text_cat_attribute35 = p_attr_values_tbl.text_cat_attribute35(i),
6100 text_cat_attribute36 = p_attr_values_tbl.text_cat_attribute36(i),
6101 text_cat_attribute37 = p_attr_values_tbl.text_cat_attribute37(i),
6102 text_cat_attribute38 = p_attr_values_tbl.text_cat_attribute38(i),
6103 text_cat_attribute39 = p_attr_values_tbl.text_cat_attribute39(i),
6104 text_cat_attribute40 = p_attr_values_tbl.text_cat_attribute40(i),
6105 text_cat_attribute41 = p_attr_values_tbl.text_cat_attribute41(i),
6106 text_cat_attribute42 = p_attr_values_tbl.text_cat_attribute42(i),
6107 text_cat_attribute43 = p_attr_values_tbl.text_cat_attribute43(i),
6108 text_cat_attribute44 = p_attr_values_tbl.text_cat_attribute44(i),
6109 text_cat_attribute45 = p_attr_values_tbl.text_cat_attribute45(i),
6110 text_cat_attribute46 = p_attr_values_tbl.text_cat_attribute46(i),
6111 text_cat_attribute47 = p_attr_values_tbl.text_cat_attribute47(i),
6112 text_cat_attribute48 = p_attr_values_tbl.text_cat_attribute48(i),
6113 text_cat_attribute49 = p_attr_values_tbl.text_cat_attribute49(i),
6114 text_cat_attribute50 = p_attr_values_tbl.text_cat_attribute50(i),
6115 num_cat_attribute1 = p_attr_values_tbl.num_cat_attribute1(i),
6116 num_cat_attribute2 = p_attr_values_tbl.num_cat_attribute2(i),
6117 num_cat_attribute3 = p_attr_values_tbl.num_cat_attribute3(i),
6118 num_cat_attribute4 = p_attr_values_tbl.num_cat_attribute4(i),
6119 num_cat_attribute5 = p_attr_values_tbl.num_cat_attribute5(i),
6120 num_cat_attribute6 = p_attr_values_tbl.num_cat_attribute6(i),
6121 num_cat_attribute7 = p_attr_values_tbl.num_cat_attribute7(i),
6122 num_cat_attribute8 = p_attr_values_tbl.num_cat_attribute8(i),
6123 num_cat_attribute9 = p_attr_values_tbl.num_cat_attribute9(i),
6124 num_cat_attribute10 = p_attr_values_tbl.num_cat_attribute10(i),
6125 num_cat_attribute11 = p_attr_values_tbl.num_cat_attribute11(i),
6126 num_cat_attribute12 = p_attr_values_tbl.num_cat_attribute12(i),
6127 num_cat_attribute13 = p_attr_values_tbl.num_cat_attribute13(i),
6128 num_cat_attribute14 = p_attr_values_tbl.num_cat_attribute14(i),
6129 num_cat_attribute15 = p_attr_values_tbl.num_cat_attribute15(i),
6130 num_cat_attribute16 = p_attr_values_tbl.num_cat_attribute16(i),
6131 num_cat_attribute17 = p_attr_values_tbl.num_cat_attribute17(i),
6132 num_cat_attribute18 = p_attr_values_tbl.num_cat_attribute18(i),
6133 num_cat_attribute19 = p_attr_values_tbl.num_cat_attribute19(i),
6134 num_cat_attribute20 = p_attr_values_tbl.num_cat_attribute20(i),
6135 num_cat_attribute21 = p_attr_values_tbl.num_cat_attribute21(i),
6136 num_cat_attribute22 = p_attr_values_tbl.num_cat_attribute22(i),
6137 num_cat_attribute23 = p_attr_values_tbl.num_cat_attribute23(i),
6138 num_cat_attribute24 = p_attr_values_tbl.num_cat_attribute24(i),
6139 num_cat_attribute25 = p_attr_values_tbl.num_cat_attribute25(i),
6140 num_cat_attribute26 = p_attr_values_tbl.num_cat_attribute26(i),
6141 num_cat_attribute27 = p_attr_values_tbl.num_cat_attribute27(i),
6142 num_cat_attribute28 = p_attr_values_tbl.num_cat_attribute28(i),
6143 num_cat_attribute29 = p_attr_values_tbl.num_cat_attribute29(i),
6144 num_cat_attribute30 = p_attr_values_tbl.num_cat_attribute30(i),
6145 num_cat_attribute31 = p_attr_values_tbl.num_cat_attribute31(i),
6146 num_cat_attribute32 = p_attr_values_tbl.num_cat_attribute32(i),
6147 num_cat_attribute33 = p_attr_values_tbl.num_cat_attribute33(i),
6148 num_cat_attribute34 = p_attr_values_tbl.num_cat_attribute34(i),
6149 num_cat_attribute35 = p_attr_values_tbl.num_cat_attribute35(i),
6150 num_cat_attribute36 = p_attr_values_tbl.num_cat_attribute36(i),
6151 num_cat_attribute37 = p_attr_values_tbl.num_cat_attribute37(i),
6152 num_cat_attribute38 = p_attr_values_tbl.num_cat_attribute38(i),
6153 num_cat_attribute39 = p_attr_values_tbl.num_cat_attribute39(i),
6154 num_cat_attribute40 = p_attr_values_tbl.num_cat_attribute40(i),
6155 num_cat_attribute41 = p_attr_values_tbl.num_cat_attribute41(i),
6156 num_cat_attribute42 = p_attr_values_tbl.num_cat_attribute42(i),
6157 num_cat_attribute43 = p_attr_values_tbl.num_cat_attribute43(i),
6158 num_cat_attribute44 = p_attr_values_tbl.num_cat_attribute44(i),
6159 num_cat_attribute45 = p_attr_values_tbl.num_cat_attribute45(i),
6160 num_cat_attribute46 = p_attr_values_tbl.num_cat_attribute46(i),
6161 num_cat_attribute47 = p_attr_values_tbl.num_cat_attribute47(i),
6162 num_cat_attribute48 = p_attr_values_tbl.num_cat_attribute48(i),
6163 num_cat_attribute49 = p_attr_values_tbl.num_cat_attribute49(i),
6164 num_cat_attribute50 = p_attr_values_tbl.num_cat_attribute50(i),
6165 last_update_login = FND_GLOBAL.login_id,
6166 last_updated_by = FND_GLOBAL.user_id,
6167 last_update_date = sysdate,
6168 created_by = g_R12_UPGRADE_USER,
6169 creation_date = sysdate,
6170 request_id = FND_GLOBAL.conc_request_id,
6171 program_application_id = p_attr_values_tbl.program_application_id(i),
6172 program_id = p_attr_values_tbl.program_id(i),
6173 program_update_date = p_attr_values_tbl.program_update_date(i),
6174 last_updated_program = g_R12_MIGRATION_PROGRAM
6175 WHERE p_attr_values_tbl.has_errors(i) = 'N'
6176 AND p_attr_values_tbl.action(i) = 'UPDATE'
6177 AND po_line_id = p_attr_values_tbl.po_line_id(i)
6178 AND req_template_name = p_attr_values_tbl.req_template_name (i)
6179 AND req_template_line_num = p_attr_values_tbl.req_template_line_num(i)
6180 AND org_id = p_attr_values_tbl.org_id(i);
6181
6182 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Attr updated='||SQL%rowcount); END IF;
6183
6184 l_progress := '020';
6185 -- SQL What: Update the process_code on interface table as PROCESSED
6186 -- SQL Why : To mark the rows as successfully inserted
6187 -- SQL Join: interface_attr_values_id
6188 -- Bug#5389286: Removed unnecessary OR conditions in the criteria
6189 -- For an update action, iP will always populate the
6190 -- po_line_id/req_template_name/req_template_line_num/org_id in the
6191 -- attr/attr_tlp interface tables
6192 -- Bug 5677911: Added the hint for performance reason.
6193 FORALL i IN 1..p_attr_values_tbl.po_line_id.COUNT
6194 UPDATE /*+ INDEX(POATRI, PO_ATTR_VALUES_INT_N3)*/
6195 PO_ATTR_VALUES_INTERFACE POATRI
6196 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
6197 WHERE p_attr_values_tbl.has_errors(i) = 'N'
6198 AND p_attr_values_tbl.action(i) = 'UPDATE'
6199 AND po_line_id = p_attr_values_tbl.po_line_id(i)
6200 AND req_template_name = p_attr_values_tbl.req_template_name (i)
6201 AND req_template_line_num = p_attr_values_tbl.req_template_line_num(i)
6202 AND org_id = p_attr_values_tbl.org_id(i);
6203
6204 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Interface Attr PROCESSED='||SQL%rowcount); END IF;
6205
6206 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
6207 EXCEPTION
6208 WHEN OTHERS THEN
6209 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
6210 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
6211 END update_attributes;
6212
6213 --------------------------------------------------------------------------------
6214 --Start of Comments
6215 --Name: delete_attributes
6216 --Pre-reqs:
6217 -- The iP catalog data is populated in PO Interface tables.
6218 --Modifies:
6219 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
6220 -- to the Interface tables.
6221 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
6222 -- failed the migration.
6223 -- c) FND_MSG_PUB on unhandled exceptions.
6224 --Locks:
6225 -- None.
6226 --Function:
6227 -- Deletes a batch of attr values given in a plsql table, from the transaction
6228 -- tables. This function is not required anymore because the delete will be
6229 -- performed at the line level, which deletes the corresponding attribute row
6230 -- as well.
6231 --Parameters:
6232 --IN:
6233 -- p_attr_values_tbl
6234 -- A table of plsql records containing a batch of attr values
6235 --OUT:
6236 --End of Comments
6237 --------------------------------------------------------------------------------
6238 PROCEDURE delete_attributes
6239 (
6240 p_attr_values_tbl IN record_of_attr_values_type
6241 )
6242 IS
6243 l_api_name CONSTANT VARCHAR2(30) := 'delete_attributes';
6244 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
6245 l_progress VARCHAR2(3) := '000';
6246 BEGIN
6247 l_progress := '010';
6248 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
6249
6250 -- Delete Rows that do not have errors
6251 FORALL i IN 1..p_attr_values_tbl.po_line_id.COUNT
6252 DELETE FROM po_attribute_values
6253 WHERE p_attr_values_tbl.has_errors(i) = 'N'
6254 AND p_attr_values_tbl.action(i) = 'DELETE'
6255 AND ( (po_line_id = p_attr_values_tbl.po_line_id(i)
6256 AND p_attr_values_tbl.po_line_id(i) <> g_NOT_REQUIRED_ID)
6257 OR
6258 (req_template_name = p_attr_values_tbl.req_template_name (i)
6259 AND req_template_line_num = p_attr_values_tbl.req_template_line_num(i)
6260 AND org_id = p_attr_values_tbl.org_id(i)
6261 AND p_attr_values_tbl.req_template_line_num(i) <> g_NOT_REQUIRED_ID));
6262
6263 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Attr deleted='||SQL%rowcount); END IF;
6264
6265 l_progress := '020';
6266 -- Mark interface attr rows as PROCESSED
6267 -- Bug 5677911: Added the hint for performance reason.
6268 FORALL i IN 1..p_attr_values_tbl.po_line_id.COUNT
6269 UPDATE /*+ INDEX(POATRI, PO_ATTR_VALUES_INT_N3)*/
6270 PO_ATTR_VALUES_INTERFACE POATRI
6271 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
6272 WHERE p_attr_values_tbl.has_errors(i) = 'N'
6273 AND p_attr_values_tbl.action(i) = 'DELETE'
6274 AND ( (po_line_id = p_attr_values_tbl.po_line_id(i)
6275 AND p_attr_values_tbl.po_line_id(i) <> g_NOT_REQUIRED_ID)
6276 OR
6277 (req_template_name = p_attr_values_tbl.req_template_name (i)
6278 AND req_template_line_num = p_attr_values_tbl.req_template_line_num(i)
6279 AND org_id = p_attr_values_tbl.org_id(i)
6280 AND p_attr_values_tbl.req_template_line_num(i) <> g_NOT_REQUIRED_ID));
6281
6282 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Interface Attr rows PROCESSED='||SQL%rowcount); END IF;
6283
6284 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
6285 EXCEPTION
6286 WHEN OTHERS THEN
6287 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
6288 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
6289 END delete_attributes;
6290
6291 --------------------------------------------------------------------------------
6292 --Start of Comments
6293 --Name: migrate_attributes_tlp
6294 --Pre-reqs:
6295 -- The iP catalog data is populated in PO Interface tables.
6296 --Modifies:
6297 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
6298 -- to the Interface tables.
6299 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
6300 -- failed the migration.
6301 -- c) FND_MSG_PUB on unhandled exceptions.
6302 --Locks:
6303 -- None.
6304 --Function:
6305 -- Migrate the attribute tlp values from interface to draft tables.
6306 -- This API should be called during the upgrade phase only.
6307 --Parameters:
6308 --IN:
6309 --p_validate_only_mode
6310 -- Indicates if the API is being called in a Validate Only mode or not
6311 --OUT:
6312 --
6313 --End of Comments
6314 --------------------------------------------------------------------------------
6315 PROCEDURE migrate_attributes_tlp
6316 (
6317 p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
6318 )
6319 IS
6320 l_api_name CONSTANT VARCHAR2(30) := 'migrate_attributes_tlp';
6321 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
6322 l_progress VARCHAR2(3) := '000';
6323
6324 -- SQL What: Cursor to attribute TLP values
6325 -- SQL Why : To migrate data to PO txn tables
6326 -- SQL Join: processing_id, action
6327 -- Bug 5677911: Added the hint for performance reason.
6328 CURSOR load_attrib_tlp_csr(request_processing_id NUMBER) IS
6329 SELECT /*+ INDEX(attrib_tlp, PO_ATTR_VALUES_TLP_INT_N2)*/
6330 attrib_tlp.interface_attr_values_tlp_id,
6331 attrib_tlp.interface_header_id,
6332 attrib_tlp.interface_line_id,
6333 attrib_tlp.action,
6334 attrib_tlp.process_code,
6335 -- The po_line_id would be stamped on PO_LINES_INTERFACE for successfully migrated lines
6336 NVL(DECODE(attrib_tlp.po_line_id,
6337 g_NOT_REQUIRED_ID, POLI.po_line_id,
6338 NULL, POLI.po_line_id,
6339 attrib_tlp.po_line_id),
6340 g_NOT_REQUIRED_ID),
6341 attrib_tlp.req_template_name,
6342 attrib_tlp.req_template_line_num,
6343 attrib_tlp.ip_category_id,
6344 attrib_tlp.inventory_item_id,
6345 attrib_tlp.org_id,
6346 attrib_tlp.language,
6347 attrib_tlp.description,
6348 attrib_tlp.manufacturer,
6349 attrib_tlp.comments,
6350 attrib_tlp.alias,
6351 attrib_tlp.long_description,
6352 attrib_tlp.tl_text_base_attribute1,
6353 attrib_tlp.tl_text_base_attribute2,
6354 attrib_tlp.tl_text_base_attribute3,
6355 attrib_tlp.tl_text_base_attribute4,
6356 attrib_tlp.tl_text_base_attribute5,
6357 attrib_tlp.tl_text_base_attribute6,
6358 attrib_tlp.tl_text_base_attribute7,
6359 attrib_tlp.tl_text_base_attribute8,
6360 attrib_tlp.tl_text_base_attribute9,
6361 attrib_tlp.tl_text_base_attribute10,
6362 attrib_tlp.tl_text_base_attribute11,
6363 attrib_tlp.tl_text_base_attribute12,
6364 attrib_tlp.tl_text_base_attribute13,
6365 attrib_tlp.tl_text_base_attribute14,
6366 attrib_tlp.tl_text_base_attribute15,
6367 attrib_tlp.tl_text_base_attribute16,
6368 attrib_tlp.tl_text_base_attribute17,
6369 attrib_tlp.tl_text_base_attribute18,
6370 attrib_tlp.tl_text_base_attribute19,
6371 attrib_tlp.tl_text_base_attribute20,
6372 attrib_tlp.tl_text_base_attribute21,
6373 attrib_tlp.tl_text_base_attribute22,
6374 attrib_tlp.tl_text_base_attribute23,
6375 attrib_tlp.tl_text_base_attribute24,
6376 attrib_tlp.tl_text_base_attribute25,
6377 attrib_tlp.tl_text_base_attribute26,
6378 attrib_tlp.tl_text_base_attribute27,
6379 attrib_tlp.tl_text_base_attribute28,
6380 attrib_tlp.tl_text_base_attribute29,
6381 attrib_tlp.tl_text_base_attribute30,
6382 attrib_tlp.tl_text_base_attribute31,
6383 attrib_tlp.tl_text_base_attribute32,
6384 attrib_tlp.tl_text_base_attribute33,
6385 attrib_tlp.tl_text_base_attribute34,
6386 attrib_tlp.tl_text_base_attribute35,
6387 attrib_tlp.tl_text_base_attribute36,
6388 attrib_tlp.tl_text_base_attribute37,
6389 attrib_tlp.tl_text_base_attribute38,
6390 attrib_tlp.tl_text_base_attribute39,
6391 attrib_tlp.tl_text_base_attribute40,
6392 attrib_tlp.tl_text_base_attribute41,
6393 attrib_tlp.tl_text_base_attribute42,
6394 attrib_tlp.tl_text_base_attribute43,
6395 attrib_tlp.tl_text_base_attribute44,
6396 attrib_tlp.tl_text_base_attribute45,
6397 attrib_tlp.tl_text_base_attribute46,
6398 attrib_tlp.tl_text_base_attribute47,
6399 attrib_tlp.tl_text_base_attribute48,
6400 attrib_tlp.tl_text_base_attribute49,
6401 attrib_tlp.tl_text_base_attribute50,
6402 attrib_tlp.tl_text_base_attribute51,
6403 attrib_tlp.tl_text_base_attribute52,
6404 attrib_tlp.tl_text_base_attribute53,
6405 attrib_tlp.tl_text_base_attribute54,
6406 attrib_tlp.tl_text_base_attribute55,
6407 attrib_tlp.tl_text_base_attribute56,
6408 attrib_tlp.tl_text_base_attribute57,
6409 attrib_tlp.tl_text_base_attribute58,
6410 attrib_tlp.tl_text_base_attribute59,
6411 attrib_tlp.tl_text_base_attribute60,
6412 attrib_tlp.tl_text_base_attribute61,
6413 attrib_tlp.tl_text_base_attribute62,
6414 attrib_tlp.tl_text_base_attribute63,
6415 attrib_tlp.tl_text_base_attribute64,
6416 attrib_tlp.tl_text_base_attribute65,
6417 attrib_tlp.tl_text_base_attribute66,
6418 attrib_tlp.tl_text_base_attribute67,
6419 attrib_tlp.tl_text_base_attribute68,
6420 attrib_tlp.tl_text_base_attribute69,
6421 attrib_tlp.tl_text_base_attribute70,
6422 attrib_tlp.tl_text_base_attribute71,
6423 attrib_tlp.tl_text_base_attribute72,
6424 attrib_tlp.tl_text_base_attribute73,
6425 attrib_tlp.tl_text_base_attribute74,
6426 attrib_tlp.tl_text_base_attribute75,
6427 attrib_tlp.tl_text_base_attribute76,
6428 attrib_tlp.tl_text_base_attribute77,
6429 attrib_tlp.tl_text_base_attribute78,
6430 attrib_tlp.tl_text_base_attribute79,
6431 attrib_tlp.tl_text_base_attribute80,
6432 attrib_tlp.tl_text_base_attribute81,
6433 attrib_tlp.tl_text_base_attribute82,
6434 attrib_tlp.tl_text_base_attribute83,
6435 attrib_tlp.tl_text_base_attribute84,
6436 attrib_tlp.tl_text_base_attribute85,
6437 attrib_tlp.tl_text_base_attribute86,
6438 attrib_tlp.tl_text_base_attribute87,
6439 attrib_tlp.tl_text_base_attribute88,
6440 attrib_tlp.tl_text_base_attribute89,
6441 attrib_tlp.tl_text_base_attribute90,
6442 attrib_tlp.tl_text_base_attribute91,
6443 attrib_tlp.tl_text_base_attribute92,
6444 attrib_tlp.tl_text_base_attribute93,
6445 attrib_tlp.tl_text_base_attribute94,
6446 attrib_tlp.tl_text_base_attribute95,
6447 attrib_tlp.tl_text_base_attribute96,
6448 attrib_tlp.tl_text_base_attribute97,
6449 attrib_tlp.tl_text_base_attribute98,
6450 attrib_tlp.tl_text_base_attribute99,
6451 attrib_tlp.tl_text_base_attribute100,
6452 attrib_tlp.tl_text_cat_attribute1,
6453 attrib_tlp.tl_text_cat_attribute2,
6454 attrib_tlp.tl_text_cat_attribute3,
6455 attrib_tlp.tl_text_cat_attribute4,
6456 attrib_tlp.tl_text_cat_attribute5,
6457 attrib_tlp.tl_text_cat_attribute6,
6458 attrib_tlp.tl_text_cat_attribute7,
6459 attrib_tlp.tl_text_cat_attribute8,
6460 attrib_tlp.tl_text_cat_attribute9,
6461 attrib_tlp.tl_text_cat_attribute10,
6462 attrib_tlp.tl_text_cat_attribute11,
6463 attrib_tlp.tl_text_cat_attribute12,
6464 attrib_tlp.tl_text_cat_attribute13,
6465 attrib_tlp.tl_text_cat_attribute14,
6466 attrib_tlp.tl_text_cat_attribute15,
6467 attrib_tlp.tl_text_cat_attribute16,
6468 attrib_tlp.tl_text_cat_attribute17,
6469 attrib_tlp.tl_text_cat_attribute18,
6470 attrib_tlp.tl_text_cat_attribute19,
6471 attrib_tlp.tl_text_cat_attribute20,
6472 attrib_tlp.tl_text_cat_attribute21,
6473 attrib_tlp.tl_text_cat_attribute22,
6474 attrib_tlp.tl_text_cat_attribute23,
6475 attrib_tlp.tl_text_cat_attribute24,
6476 attrib_tlp.tl_text_cat_attribute25,
6477 attrib_tlp.tl_text_cat_attribute26,
6478 attrib_tlp.tl_text_cat_attribute27,
6479 attrib_tlp.tl_text_cat_attribute28,
6480 attrib_tlp.tl_text_cat_attribute29,
6481 attrib_tlp.tl_text_cat_attribute30,
6482 attrib_tlp.tl_text_cat_attribute31,
6483 attrib_tlp.tl_text_cat_attribute32,
6484 attrib_tlp.tl_text_cat_attribute33,
6485 attrib_tlp.tl_text_cat_attribute34,
6486 attrib_tlp.tl_text_cat_attribute35,
6487 attrib_tlp.tl_text_cat_attribute36,
6488 attrib_tlp.tl_text_cat_attribute37,
6489 attrib_tlp.tl_text_cat_attribute38,
6490 attrib_tlp.tl_text_cat_attribute39,
6491 attrib_tlp.tl_text_cat_attribute40,
6492 attrib_tlp.tl_text_cat_attribute41,
6493 attrib_tlp.tl_text_cat_attribute42,
6494 attrib_tlp.tl_text_cat_attribute43,
6495 attrib_tlp.tl_text_cat_attribute44,
6496 attrib_tlp.tl_text_cat_attribute45,
6497 attrib_tlp.tl_text_cat_attribute46,
6498 attrib_tlp.tl_text_cat_attribute47,
6499 attrib_tlp.tl_text_cat_attribute48,
6500 attrib_tlp.tl_text_cat_attribute49,
6501 attrib_tlp.tl_text_cat_attribute50,
6502 attrib_tlp.last_update_login,
6503 attrib_tlp.last_updated_by,
6504 attrib_tlp.last_update_date,
6505 attrib_tlp.created_by,
6506 attrib_tlp.creation_date,
6507 attrib_tlp.request_id,
6508 attrib_tlp.program_application_id,
6509 attrib_tlp.program_id,
6510 attrib_tlp.program_update_date,
6511 attrib_tlp.processing_id,
6512 'N' -- has_errors
6513 FROM PO_ATTR_VALUES_TLP_INTERFACE attrib_tlp,
6514 PO_LINES_INTERFACE POLI
6515 WHERE attrib_tlp.processing_id = request_processing_id
6516 AND attrib_tlp.process_code = PO_R12_CAT_UPG_PVT.g_PROCESS_CODE_NEW
6517 AND attrib_tlp.action IN (PO_R12_CAT_UPG_PVT.g_action_tlp_create, 'UPDATE', 'DELETE')
6518 AND attrib_tlp.interface_line_id = POLI.interface_line_id;
6519
6520 l_attrib_tlp_table record_of_attr_values_tlp_type;
6521
6522 BEGIN
6523 l_progress := '010';
6524 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
6525
6526 -- Algorithm:
6527 -- 1. Load Lines batch (batch_size) into pl/sql table.
6528 -- 2. Call PDOI modules to process data in batches (default, derive, validate).
6529 -- 3. Get the validated pl/sql table for the batch from PDOI.
6530 -- 4. Transfer directly to Transaction tables
6531
6532 OPEN load_attrib_tlp_csr(g_processing_id);
6533
6534 l_progress := '020';
6535 LOOP
6536 BEGIN -- block to handle SNAPSHOT_TOO_OLD exception
6537 l_progress := '025';
6538 FETCH load_attrib_tlp_csr BULK COLLECT INTO
6539 l_attrib_tlp_table.interface_attr_values_tlp_id,
6540 l_attrib_tlp_table.interface_header_id,
6541 l_attrib_tlp_table.interface_line_id,
6542 l_attrib_tlp_table.action,
6543 l_attrib_tlp_table.process_code,
6544 l_attrib_tlp_table.po_line_id,
6545 l_attrib_tlp_table.req_template_name,
6546 l_attrib_tlp_table.req_template_line_num,
6547 l_attrib_tlp_table.ip_category_id,
6548 l_attrib_tlp_table.inventory_item_id,
6549 l_attrib_tlp_table.org_id,
6550 l_attrib_tlp_table.language,
6551 l_attrib_tlp_table.description,
6552 l_attrib_tlp_table.manufacturer,
6553 l_attrib_tlp_table.comments,
6554 l_attrib_tlp_table.alias,
6555 l_attrib_tlp_table.long_description,
6556 l_attrib_tlp_table.tl_text_base_attribute1,
6557 l_attrib_tlp_table.tl_text_base_attribute2,
6558 l_attrib_tlp_table.tl_text_base_attribute3,
6559 l_attrib_tlp_table.tl_text_base_attribute4,
6560 l_attrib_tlp_table.tl_text_base_attribute5,
6561 l_attrib_tlp_table.tl_text_base_attribute6,
6562 l_attrib_tlp_table.tl_text_base_attribute7,
6563 l_attrib_tlp_table.tl_text_base_attribute8,
6564 l_attrib_tlp_table.tl_text_base_attribute9,
6565 l_attrib_tlp_table.tl_text_base_attribute10,
6566 l_attrib_tlp_table.tl_text_base_attribute11,
6567 l_attrib_tlp_table.tl_text_base_attribute12,
6568 l_attrib_tlp_table.tl_text_base_attribute13,
6569 l_attrib_tlp_table.tl_text_base_attribute14,
6570 l_attrib_tlp_table.tl_text_base_attribute15,
6571 l_attrib_tlp_table.tl_text_base_attribute16,
6572 l_attrib_tlp_table.tl_text_base_attribute17,
6573 l_attrib_tlp_table.tl_text_base_attribute18,
6574 l_attrib_tlp_table.tl_text_base_attribute19,
6575 l_attrib_tlp_table.tl_text_base_attribute20,
6576 l_attrib_tlp_table.tl_text_base_attribute21,
6577 l_attrib_tlp_table.tl_text_base_attribute22,
6578 l_attrib_tlp_table.tl_text_base_attribute23,
6579 l_attrib_tlp_table.tl_text_base_attribute24,
6580 l_attrib_tlp_table.tl_text_base_attribute25,
6581 l_attrib_tlp_table.tl_text_base_attribute26,
6582 l_attrib_tlp_table.tl_text_base_attribute27,
6583 l_attrib_tlp_table.tl_text_base_attribute28,
6584 l_attrib_tlp_table.tl_text_base_attribute29,
6585 l_attrib_tlp_table.tl_text_base_attribute30,
6586 l_attrib_tlp_table.tl_text_base_attribute31,
6587 l_attrib_tlp_table.tl_text_base_attribute32,
6588 l_attrib_tlp_table.tl_text_base_attribute33,
6589 l_attrib_tlp_table.tl_text_base_attribute34,
6590 l_attrib_tlp_table.tl_text_base_attribute35,
6591 l_attrib_tlp_table.tl_text_base_attribute36,
6592 l_attrib_tlp_table.tl_text_base_attribute37,
6593 l_attrib_tlp_table.tl_text_base_attribute38,
6594 l_attrib_tlp_table.tl_text_base_attribute39,
6595 l_attrib_tlp_table.tl_text_base_attribute40,
6596 l_attrib_tlp_table.tl_text_base_attribute41,
6597 l_attrib_tlp_table.tl_text_base_attribute42,
6598 l_attrib_tlp_table.tl_text_base_attribute43,
6599 l_attrib_tlp_table.tl_text_base_attribute44,
6600 l_attrib_tlp_table.tl_text_base_attribute45,
6601 l_attrib_tlp_table.tl_text_base_attribute46,
6602 l_attrib_tlp_table.tl_text_base_attribute47,
6603 l_attrib_tlp_table.tl_text_base_attribute48,
6604 l_attrib_tlp_table.tl_text_base_attribute49,
6605 l_attrib_tlp_table.tl_text_base_attribute50,
6606 l_attrib_tlp_table.tl_text_base_attribute51,
6607 l_attrib_tlp_table.tl_text_base_attribute52,
6608 l_attrib_tlp_table.tl_text_base_attribute53,
6609 l_attrib_tlp_table.tl_text_base_attribute54,
6610 l_attrib_tlp_table.tl_text_base_attribute55,
6611 l_attrib_tlp_table.tl_text_base_attribute56,
6612 l_attrib_tlp_table.tl_text_base_attribute57,
6613 l_attrib_tlp_table.tl_text_base_attribute58,
6614 l_attrib_tlp_table.tl_text_base_attribute59,
6615 l_attrib_tlp_table.tl_text_base_attribute60,
6616 l_attrib_tlp_table.tl_text_base_attribute61,
6617 l_attrib_tlp_table.tl_text_base_attribute62,
6618 l_attrib_tlp_table.tl_text_base_attribute63,
6619 l_attrib_tlp_table.tl_text_base_attribute64,
6620 l_attrib_tlp_table.tl_text_base_attribute65,
6621 l_attrib_tlp_table.tl_text_base_attribute66,
6622 l_attrib_tlp_table.tl_text_base_attribute67,
6623 l_attrib_tlp_table.tl_text_base_attribute68,
6624 l_attrib_tlp_table.tl_text_base_attribute69,
6625 l_attrib_tlp_table.tl_text_base_attribute70,
6626 l_attrib_tlp_table.tl_text_base_attribute71,
6627 l_attrib_tlp_table.tl_text_base_attribute72,
6628 l_attrib_tlp_table.tl_text_base_attribute73,
6629 l_attrib_tlp_table.tl_text_base_attribute74,
6630 l_attrib_tlp_table.tl_text_base_attribute75,
6631 l_attrib_tlp_table.tl_text_base_attribute76,
6632 l_attrib_tlp_table.tl_text_base_attribute77,
6633 l_attrib_tlp_table.tl_text_base_attribute78,
6634 l_attrib_tlp_table.tl_text_base_attribute79,
6635 l_attrib_tlp_table.tl_text_base_attribute80,
6636 l_attrib_tlp_table.tl_text_base_attribute81,
6637 l_attrib_tlp_table.tl_text_base_attribute82,
6638 l_attrib_tlp_table.tl_text_base_attribute83,
6639 l_attrib_tlp_table.tl_text_base_attribute84,
6640 l_attrib_tlp_table.tl_text_base_attribute85,
6641 l_attrib_tlp_table.tl_text_base_attribute86,
6642 l_attrib_tlp_table.tl_text_base_attribute87,
6643 l_attrib_tlp_table.tl_text_base_attribute88,
6644 l_attrib_tlp_table.tl_text_base_attribute89,
6645 l_attrib_tlp_table.tl_text_base_attribute90,
6646 l_attrib_tlp_table.tl_text_base_attribute91,
6647 l_attrib_tlp_table.tl_text_base_attribute92,
6648 l_attrib_tlp_table.tl_text_base_attribute93,
6649 l_attrib_tlp_table.tl_text_base_attribute94,
6650 l_attrib_tlp_table.tl_text_base_attribute95,
6651 l_attrib_tlp_table.tl_text_base_attribute96,
6652 l_attrib_tlp_table.tl_text_base_attribute97,
6653 l_attrib_tlp_table.tl_text_base_attribute98,
6654 l_attrib_tlp_table.tl_text_base_attribute99,
6655 l_attrib_tlp_table.tl_text_base_attribute100,
6656 l_attrib_tlp_table.tl_text_cat_attribute1,
6657 l_attrib_tlp_table.tl_text_cat_attribute2,
6658 l_attrib_tlp_table.tl_text_cat_attribute3,
6659 l_attrib_tlp_table.tl_text_cat_attribute4,
6660 l_attrib_tlp_table.tl_text_cat_attribute5,
6661 l_attrib_tlp_table.tl_text_cat_attribute6,
6662 l_attrib_tlp_table.tl_text_cat_attribute7,
6663 l_attrib_tlp_table.tl_text_cat_attribute8,
6664 l_attrib_tlp_table.tl_text_cat_attribute9,
6665 l_attrib_tlp_table.tl_text_cat_attribute10,
6666 l_attrib_tlp_table.tl_text_cat_attribute11,
6667 l_attrib_tlp_table.tl_text_cat_attribute12,
6668 l_attrib_tlp_table.tl_text_cat_attribute13,
6669 l_attrib_tlp_table.tl_text_cat_attribute14,
6670 l_attrib_tlp_table.tl_text_cat_attribute15,
6671 l_attrib_tlp_table.tl_text_cat_attribute16,
6672 l_attrib_tlp_table.tl_text_cat_attribute17,
6673 l_attrib_tlp_table.tl_text_cat_attribute18,
6674 l_attrib_tlp_table.tl_text_cat_attribute19,
6675 l_attrib_tlp_table.tl_text_cat_attribute20,
6676 l_attrib_tlp_table.tl_text_cat_attribute21,
6677 l_attrib_tlp_table.tl_text_cat_attribute22,
6678 l_attrib_tlp_table.tl_text_cat_attribute23,
6679 l_attrib_tlp_table.tl_text_cat_attribute24,
6680 l_attrib_tlp_table.tl_text_cat_attribute25,
6681 l_attrib_tlp_table.tl_text_cat_attribute26,
6682 l_attrib_tlp_table.tl_text_cat_attribute27,
6683 l_attrib_tlp_table.tl_text_cat_attribute28,
6684 l_attrib_tlp_table.tl_text_cat_attribute29,
6685 l_attrib_tlp_table.tl_text_cat_attribute30,
6686 l_attrib_tlp_table.tl_text_cat_attribute31,
6687 l_attrib_tlp_table.tl_text_cat_attribute32,
6688 l_attrib_tlp_table.tl_text_cat_attribute33,
6689 l_attrib_tlp_table.tl_text_cat_attribute34,
6690 l_attrib_tlp_table.tl_text_cat_attribute35,
6691 l_attrib_tlp_table.tl_text_cat_attribute36,
6692 l_attrib_tlp_table.tl_text_cat_attribute37,
6693 l_attrib_tlp_table.tl_text_cat_attribute38,
6694 l_attrib_tlp_table.tl_text_cat_attribute39,
6695 l_attrib_tlp_table.tl_text_cat_attribute40,
6696 l_attrib_tlp_table.tl_text_cat_attribute41,
6697 l_attrib_tlp_table.tl_text_cat_attribute42,
6698 l_attrib_tlp_table.tl_text_cat_attribute43,
6699 l_attrib_tlp_table.tl_text_cat_attribute44,
6700 l_attrib_tlp_table.tl_text_cat_attribute45,
6701 l_attrib_tlp_table.tl_text_cat_attribute46,
6702 l_attrib_tlp_table.tl_text_cat_attribute47,
6703 l_attrib_tlp_table.tl_text_cat_attribute48,
6704 l_attrib_tlp_table.tl_text_cat_attribute49,
6705 l_attrib_tlp_table.tl_text_cat_attribute50,
6706 l_attrib_tlp_table.last_update_login,
6707 l_attrib_tlp_table.last_updated_by,
6708 l_attrib_tlp_table.last_update_date,
6709 l_attrib_tlp_table.created_by,
6710 l_attrib_tlp_table.creation_date,
6711 l_attrib_tlp_table.request_id,
6712 l_attrib_tlp_table.program_application_id,
6713 l_attrib_tlp_table.program_id,
6714 l_attrib_tlp_table.program_update_date,
6715 l_attrib_tlp_table.processing_id,
6716 l_attrib_tlp_table.has_errors
6717 LIMIT g_job.batch_size;
6718
6719 l_progress := '030';
6720
6721 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_attrib_tlp_table.interface_line_id.COUNT='||l_attrib_tlp_table.interface_line_id.COUNT); END IF;
6722
6723 EXIT WHEN l_attrib_tlp_table.interface_line_id.COUNT = 0;
6724
6725 -- Derive + Default + Validation are not required for attribute tlp values
6726
6727 l_progress := '070';
6728 -- Skip transfer if runnning in Validate Only mode.
6729 IF (p_validate_only_mode = FND_API.G_FALSE) THEN
6730 -- Transfer Attribute tlp values
6731 transfer_attributes_tlp(p_attrib_tlp_values_tbl => l_attrib_tlp_table);
6732 END IF; -- IF (p_validate_only_mode = FND_API.G_FALSE)
6733
6734 l_progress := '100';
6735 COMMIT;
6736
6737 l_progress := '110';
6738 IF (l_attrib_tlp_table.interface_attr_values_tlp_id.COUNT
6739 < g_job.batch_size) THEN
6740 EXIT;
6741 END IF;
6742 l_progress := '120';
6743 EXCEPTION
6744 WHEN g_SNAPSHOT_TOO_OLD THEN
6745 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'EXCEPTION: SNAPSHOT_TOO_OLD. Now commiting and re-opening the load_attrib_tlp_csr'); END IF;
6746
6747 -- Commit and re-open the cursor
6748 l_progress := '130';
6749 COMMIT;
6750
6751 l_progress := '140';
6752 CLOSE load_attrib_tlp_csr;
6753
6754 l_progress := '150';
6755 OPEN load_attrib_tlp_csr(g_processing_id);
6756 l_progress := '160';
6757 END; -- block to handle SNAPSHOT_TOO_OLD exception
6758 END LOOP; -- batch loop
6759
6760 l_progress := '170';
6761 IF (load_attrib_tlp_csr%ISOPEN) THEN
6762 CLOSE load_attrib_tlp_csr;
6763 END IF;
6764
6765 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
6766 EXCEPTION
6767 WHEN OTHERS THEN
6768 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
6769 IF (load_attrib_tlp_csr%ISOPEN) THEN
6770 CLOSE load_attrib_tlp_csr;
6771 END IF;
6772 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
6773 END migrate_attributes_tlp;
6774
6775 --------------------------------------------------------------------------------
6776 --Start of Comments
6777 --Name: transfer_attributes_tlp
6778 --Pre-reqs:
6779 -- The iP catalog data is populated in PO Interface tables.
6780 --Modifies:
6781 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
6782 -- to the Interface tables.
6783 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
6784 -- failed the migration.
6785 -- c) FND_MSG_PUB on unhandled exceptions.
6786 --Locks:
6787 -- None.
6788 --Function:
6789 -- Transfers a batch of attribute tlp values given in a plsql table, into the
6790 -- transaction tables.
6791 -- This API should be called during the upgrade phase only.
6792 --Parameters:
6793 --IN:
6794 -- p_attrib_values_tbl
6795 -- A table of plsql records containing a batch of attribute tlp values
6796 --OUT:
6797 --End of Comments
6798 --------------------------------------------------------------------------------
6799 PROCEDURE transfer_attributes_tlp
6800 (
6801 p_attrib_tlp_values_tbl IN record_of_attr_values_tlp_type
6802 )
6803 IS
6804 l_api_name CONSTANT VARCHAR2(30) := 'transfer_attributes_tlp';
6805 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
6806 l_progress VARCHAR2(3) := '000';
6807
6808 BEGIN
6809 l_progress := '010';
6810 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
6811
6812 -- Insert Attributes TLP
6813 insert_attributes_tlp(p_attr_values_tlp_tbl => p_attrib_tlp_values_tbl);
6814
6815 l_progress := '020';
6816 -- Update Attributes TLP
6817 update_attributes_tlp(p_attr_values_tlp_tbl => p_attrib_tlp_values_tbl);
6818
6819 l_progress := '030';
6820 -- Delete Attributes TLP
6821 delete_attributes_tlp(p_attr_values_tlp_tbl => p_attrib_tlp_values_tbl);
6822
6823 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
6824 EXCEPTION
6825 WHEN OTHERS THEN
6826 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
6827 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
6828 END transfer_attributes_tlp;
6829
6830 --------------------------------------------------------------------------------
6831 --Start of Comments
6832 --Name: insert_attributes_tlp
6833 --Pre-reqs:
6834 -- The iP catalog data is populated in PO Interface tables.
6835 --Modifies:
6836 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
6837 -- to the Interface tables.
6838 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
6839 -- failed the migration.
6840 -- c) FND_MSG_PUB on unhandled exceptions.
6841 --Locks:
6842 -- None.
6843 --Function:
6844 -- Inserts a batch of attr values TLP given in a plsql table, into the transaction
6845 -- tables.
6846 -- This API should be called during the upgrade phase only.
6847 --Parameters:
6848 --IN:
6849 -- p_attr_values_tbl
6850 -- A table of plsql records containing a batch of attr values TLP
6851 --OUT:
6852 --End of Comments
6853 --------------------------------------------------------------------------------
6854 PROCEDURE insert_attributes_tlp
6855 (
6856 p_attr_values_tlp_tbl IN record_of_attr_values_tlp_type
6857 )
6858 IS
6859 l_api_name CONSTANT VARCHAR2(30) := 'insert_attributes_tlp';
6860 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
6861 l_progress VARCHAR2(3) := '000';
6862 BEGIN
6863 l_progress := '010';
6864 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
6865
6866 -- SQL What: Insert rows that have no errors, and action = PO_R12_CAT_UPG_PVT.g_action_tlp_create
6867 -- SQL Why : To migrate data to txn tables
6868 -- SQL Join: none
6869 FORALL i IN 1..p_attr_values_tlp_tbl.po_line_id.COUNT
6870 INSERT INTO po_attribute_values_tlp
6871 (attribute_values_tlp_id,
6872 po_line_id,
6873 req_template_name,
6874 req_template_line_num,
6875 ip_category_id,
6876 inventory_item_id,
6877 org_id,
6878 language,
6879 description,
6880 manufacturer,
6881 comments,
6882 alias,
6883 long_description,
6884 tl_text_base_attribute1,
6885 tl_text_base_attribute2,
6886 tl_text_base_attribute3,
6887 tl_text_base_attribute4,
6888 tl_text_base_attribute5,
6889 tl_text_base_attribute6,
6890 tl_text_base_attribute7,
6891 tl_text_base_attribute8,
6892 tl_text_base_attribute9,
6893 tl_text_base_attribute10,
6894 tl_text_base_attribute11,
6895 tl_text_base_attribute12,
6896 tl_text_base_attribute13,
6897 tl_text_base_attribute14,
6898 tl_text_base_attribute15,
6899 tl_text_base_attribute16,
6900 tl_text_base_attribute17,
6901 tl_text_base_attribute18,
6902 tl_text_base_attribute19,
6903 tl_text_base_attribute20,
6904 tl_text_base_attribute21,
6905 tl_text_base_attribute22,
6906 tl_text_base_attribute23,
6907 tl_text_base_attribute24,
6908 tl_text_base_attribute25,
6909 tl_text_base_attribute26,
6910 tl_text_base_attribute27,
6911 tl_text_base_attribute28,
6912 tl_text_base_attribute29,
6913 tl_text_base_attribute30,
6914 tl_text_base_attribute31,
6915 tl_text_base_attribute32,
6916 tl_text_base_attribute33,
6917 tl_text_base_attribute34,
6918 tl_text_base_attribute35,
6919 tl_text_base_attribute36,
6920 tl_text_base_attribute37,
6921 tl_text_base_attribute38,
6922 tl_text_base_attribute39,
6923 tl_text_base_attribute40,
6924 tl_text_base_attribute41,
6925 tl_text_base_attribute42,
6926 tl_text_base_attribute43,
6927 tl_text_base_attribute44,
6928 tl_text_base_attribute45,
6929 tl_text_base_attribute46,
6930 tl_text_base_attribute47,
6931 tl_text_base_attribute48,
6932 tl_text_base_attribute49,
6933 tl_text_base_attribute50,
6934 tl_text_base_attribute51,
6935 tl_text_base_attribute52,
6936 tl_text_base_attribute53,
6937 tl_text_base_attribute54,
6938 tl_text_base_attribute55,
6939 tl_text_base_attribute56,
6940 tl_text_base_attribute57,
6941 tl_text_base_attribute58,
6942 tl_text_base_attribute59,
6943 tl_text_base_attribute60,
6944 tl_text_base_attribute61,
6945 tl_text_base_attribute62,
6946 tl_text_base_attribute63,
6947 tl_text_base_attribute64,
6948 tl_text_base_attribute65,
6949 tl_text_base_attribute66,
6950 tl_text_base_attribute67,
6951 tl_text_base_attribute68,
6952 tl_text_base_attribute69,
6953 tl_text_base_attribute70,
6954 tl_text_base_attribute71,
6955 tl_text_base_attribute72,
6956 tl_text_base_attribute73,
6957 tl_text_base_attribute74,
6958 tl_text_base_attribute75,
6959 tl_text_base_attribute76,
6960 tl_text_base_attribute77,
6961 tl_text_base_attribute78,
6962 tl_text_base_attribute79,
6963 tl_text_base_attribute80,
6964 tl_text_base_attribute81,
6965 tl_text_base_attribute82,
6966 tl_text_base_attribute83,
6967 tl_text_base_attribute84,
6968 tl_text_base_attribute85,
6969 tl_text_base_attribute86,
6970 tl_text_base_attribute87,
6971 tl_text_base_attribute88,
6972 tl_text_base_attribute89,
6973 tl_text_base_attribute90,
6974 tl_text_base_attribute91,
6975 tl_text_base_attribute92,
6976 tl_text_base_attribute93,
6977 tl_text_base_attribute94,
6978 tl_text_base_attribute95,
6979 tl_text_base_attribute96,
6980 tl_text_base_attribute97,
6981 tl_text_base_attribute98,
6982 tl_text_base_attribute99,
6983 tl_text_base_attribute100,
6984 tl_text_cat_attribute1,
6985 tl_text_cat_attribute2,
6986 tl_text_cat_attribute3,
6987 tl_text_cat_attribute4,
6988 tl_text_cat_attribute5,
6989 tl_text_cat_attribute6,
6990 tl_text_cat_attribute7,
6991 tl_text_cat_attribute8,
6992 tl_text_cat_attribute9,
6993 tl_text_cat_attribute10,
6994 tl_text_cat_attribute11,
6995 tl_text_cat_attribute12,
6996 tl_text_cat_attribute13,
6997 tl_text_cat_attribute14,
6998 tl_text_cat_attribute15,
6999 tl_text_cat_attribute16,
7000 tl_text_cat_attribute17,
7001 tl_text_cat_attribute18,
7002 tl_text_cat_attribute19,
7003 tl_text_cat_attribute20,
7004 tl_text_cat_attribute21,
7005 tl_text_cat_attribute22,
7006 tl_text_cat_attribute23,
7007 tl_text_cat_attribute24,
7008 tl_text_cat_attribute25,
7009 tl_text_cat_attribute26,
7010 tl_text_cat_attribute27,
7011 tl_text_cat_attribute28,
7012 tl_text_cat_attribute29,
7013 tl_text_cat_attribute30,
7014 tl_text_cat_attribute31,
7015 tl_text_cat_attribute32,
7016 tl_text_cat_attribute33,
7017 tl_text_cat_attribute34,
7018 tl_text_cat_attribute35,
7019 tl_text_cat_attribute36,
7020 tl_text_cat_attribute37,
7021 tl_text_cat_attribute38,
7022 tl_text_cat_attribute39,
7023 tl_text_cat_attribute40,
7024 tl_text_cat_attribute41,
7025 tl_text_cat_attribute42,
7026 tl_text_cat_attribute43,
7027 tl_text_cat_attribute44,
7028 tl_text_cat_attribute45,
7029 tl_text_cat_attribute46,
7030 tl_text_cat_attribute47,
7031 tl_text_cat_attribute48,
7032 tl_text_cat_attribute49,
7033 tl_text_cat_attribute50,
7034 last_update_login,
7035 last_updated_by,
7036 last_update_date,
7037 created_by,
7038 creation_date,
7039 request_id,
7040 program_application_id,
7041 program_id,
7042 program_update_date,
7043 last_updated_program
7044 )
7045 -- Bug 5677911: Added the hint for performance reason.
7046 SELECT /*+ INDEX(POAVTI, PO_ATTR_VALUES_TLP_INT_U1)*/
7047 PO_ATTRIBUTE_VALUES_TLP_S.nextval,
7048
7049 -- ECO bug 4738058
7050 --p_attr_values_tlp_tbl.po_line_id(i),
7051 --bug 7245624 added nvl cond
7052 Nvl( POLI.po_line_id,-2),
7053 p_attr_values_tlp_tbl.req_template_name(i),
7054 p_attr_values_tlp_tbl.req_template_line_num(i),
7055 p_attr_values_tlp_tbl.ip_category_id(i),
7056 p_attr_values_tlp_tbl.inventory_item_id(i),
7057 p_attr_values_tlp_tbl.org_id(i),
7058 p_attr_values_tlp_tbl.language(i),
7059 p_attr_values_tlp_tbl.description(i),
7060 p_attr_values_tlp_tbl.manufacturer(i),
7061 p_attr_values_tlp_tbl.comments(i),
7062 p_attr_values_tlp_tbl.alias(i),
7063 p_attr_values_tlp_tbl.long_description(i),
7064 p_attr_values_tlp_tbl.tl_text_base_attribute1(i),
7065 p_attr_values_tlp_tbl.tl_text_base_attribute2(i),
7066 p_attr_values_tlp_tbl.tl_text_base_attribute3(i),
7067 p_attr_values_tlp_tbl.tl_text_base_attribute4(i),
7068 p_attr_values_tlp_tbl.tl_text_base_attribute5(i),
7069 p_attr_values_tlp_tbl.tl_text_base_attribute6(i),
7070 p_attr_values_tlp_tbl.tl_text_base_attribute7(i),
7071 p_attr_values_tlp_tbl.tl_text_base_attribute8(i),
7072 p_attr_values_tlp_tbl.tl_text_base_attribute9(i),
7073 p_attr_values_tlp_tbl.tl_text_base_attribute10(i),
7074 p_attr_values_tlp_tbl.tl_text_base_attribute11(i),
7075 p_attr_values_tlp_tbl.tl_text_base_attribute12(i),
7076 p_attr_values_tlp_tbl.tl_text_base_attribute13(i),
7077 p_attr_values_tlp_tbl.tl_text_base_attribute14(i),
7078 p_attr_values_tlp_tbl.tl_text_base_attribute15(i),
7079 p_attr_values_tlp_tbl.tl_text_base_attribute16(i),
7080 p_attr_values_tlp_tbl.tl_text_base_attribute17(i),
7081 p_attr_values_tlp_tbl.tl_text_base_attribute18(i),
7082 p_attr_values_tlp_tbl.tl_text_base_attribute19(i),
7083 p_attr_values_tlp_tbl.tl_text_base_attribute20(i),
7084 p_attr_values_tlp_tbl.tl_text_base_attribute21(i),
7085 p_attr_values_tlp_tbl.tl_text_base_attribute22(i),
7086 p_attr_values_tlp_tbl.tl_text_base_attribute23(i),
7087 p_attr_values_tlp_tbl.tl_text_base_attribute24(i),
7088 p_attr_values_tlp_tbl.tl_text_base_attribute25(i),
7089 p_attr_values_tlp_tbl.tl_text_base_attribute26(i),
7090 p_attr_values_tlp_tbl.tl_text_base_attribute27(i),
7091 p_attr_values_tlp_tbl.tl_text_base_attribute28(i),
7092 p_attr_values_tlp_tbl.tl_text_base_attribute29(i),
7093 p_attr_values_tlp_tbl.tl_text_base_attribute30(i),
7094 p_attr_values_tlp_tbl.tl_text_base_attribute31(i),
7095 p_attr_values_tlp_tbl.tl_text_base_attribute32(i),
7096 p_attr_values_tlp_tbl.tl_text_base_attribute33(i),
7097 p_attr_values_tlp_tbl.tl_text_base_attribute34(i),
7098 p_attr_values_tlp_tbl.tl_text_base_attribute35(i),
7099 p_attr_values_tlp_tbl.tl_text_base_attribute36(i),
7100 p_attr_values_tlp_tbl.tl_text_base_attribute37(i),
7101 p_attr_values_tlp_tbl.tl_text_base_attribute38(i),
7102 p_attr_values_tlp_tbl.tl_text_base_attribute39(i),
7103 p_attr_values_tlp_tbl.tl_text_base_attribute40(i),
7104 p_attr_values_tlp_tbl.tl_text_base_attribute41(i),
7105 p_attr_values_tlp_tbl.tl_text_base_attribute42(i),
7106 p_attr_values_tlp_tbl.tl_text_base_attribute43(i),
7107 p_attr_values_tlp_tbl.tl_text_base_attribute44(i),
7108 p_attr_values_tlp_tbl.tl_text_base_attribute45(i),
7109 p_attr_values_tlp_tbl.tl_text_base_attribute46(i),
7110 p_attr_values_tlp_tbl.tl_text_base_attribute47(i),
7111 p_attr_values_tlp_tbl.tl_text_base_attribute48(i),
7112 p_attr_values_tlp_tbl.tl_text_base_attribute49(i),
7113 p_attr_values_tlp_tbl.tl_text_base_attribute50(i),
7114 p_attr_values_tlp_tbl.tl_text_base_attribute51(i),
7115 p_attr_values_tlp_tbl.tl_text_base_attribute52(i),
7116 p_attr_values_tlp_tbl.tl_text_base_attribute53(i),
7117 p_attr_values_tlp_tbl.tl_text_base_attribute54(i),
7118 p_attr_values_tlp_tbl.tl_text_base_attribute55(i),
7119 p_attr_values_tlp_tbl.tl_text_base_attribute56(i),
7120 p_attr_values_tlp_tbl.tl_text_base_attribute57(i),
7121 p_attr_values_tlp_tbl.tl_text_base_attribute58(i),
7122 p_attr_values_tlp_tbl.tl_text_base_attribute59(i),
7123 p_attr_values_tlp_tbl.tl_text_base_attribute60(i),
7124 p_attr_values_tlp_tbl.tl_text_base_attribute61(i),
7125 p_attr_values_tlp_tbl.tl_text_base_attribute62(i),
7126 p_attr_values_tlp_tbl.tl_text_base_attribute63(i),
7127 p_attr_values_tlp_tbl.tl_text_base_attribute64(i),
7128 p_attr_values_tlp_tbl.tl_text_base_attribute65(i),
7129 p_attr_values_tlp_tbl.tl_text_base_attribute66(i),
7130 p_attr_values_tlp_tbl.tl_text_base_attribute67(i),
7131 p_attr_values_tlp_tbl.tl_text_base_attribute68(i),
7132 p_attr_values_tlp_tbl.tl_text_base_attribute69(i),
7133 p_attr_values_tlp_tbl.tl_text_base_attribute70(i),
7134 p_attr_values_tlp_tbl.tl_text_base_attribute71(i),
7135 p_attr_values_tlp_tbl.tl_text_base_attribute72(i),
7136 p_attr_values_tlp_tbl.tl_text_base_attribute73(i),
7137 p_attr_values_tlp_tbl.tl_text_base_attribute74(i),
7138 p_attr_values_tlp_tbl.tl_text_base_attribute75(i),
7139 p_attr_values_tlp_tbl.tl_text_base_attribute76(i),
7140 p_attr_values_tlp_tbl.tl_text_base_attribute77(i),
7141 p_attr_values_tlp_tbl.tl_text_base_attribute78(i),
7142 p_attr_values_tlp_tbl.tl_text_base_attribute79(i),
7143 p_attr_values_tlp_tbl.tl_text_base_attribute80(i),
7144 p_attr_values_tlp_tbl.tl_text_base_attribute81(i),
7145 p_attr_values_tlp_tbl.tl_text_base_attribute82(i),
7146 p_attr_values_tlp_tbl.tl_text_base_attribute83(i),
7147 p_attr_values_tlp_tbl.tl_text_base_attribute84(i),
7148 p_attr_values_tlp_tbl.tl_text_base_attribute85(i),
7149 p_attr_values_tlp_tbl.tl_text_base_attribute86(i),
7150 p_attr_values_tlp_tbl.tl_text_base_attribute87(i),
7151 p_attr_values_tlp_tbl.tl_text_base_attribute88(i),
7152 p_attr_values_tlp_tbl.tl_text_base_attribute89(i),
7153 p_attr_values_tlp_tbl.tl_text_base_attribute90(i),
7154 p_attr_values_tlp_tbl.tl_text_base_attribute91(i),
7155 p_attr_values_tlp_tbl.tl_text_base_attribute92(i),
7156 p_attr_values_tlp_tbl.tl_text_base_attribute93(i),
7157 p_attr_values_tlp_tbl.tl_text_base_attribute94(i),
7158 p_attr_values_tlp_tbl.tl_text_base_attribute95(i),
7159 p_attr_values_tlp_tbl.tl_text_base_attribute96(i),
7160 p_attr_values_tlp_tbl.tl_text_base_attribute97(i),
7161 p_attr_values_tlp_tbl.tl_text_base_attribute98(i),
7162 p_attr_values_tlp_tbl.tl_text_base_attribute99(i),
7163 p_attr_values_tlp_tbl.tl_text_base_attribute100(i),
7164 p_attr_values_tlp_tbl.tl_text_cat_attribute1(i),
7165 p_attr_values_tlp_tbl.tl_text_cat_attribute2(i),
7166 p_attr_values_tlp_tbl.tl_text_cat_attribute3(i),
7167 p_attr_values_tlp_tbl.tl_text_cat_attribute4(i),
7168 p_attr_values_tlp_tbl.tl_text_cat_attribute5(i),
7169 p_attr_values_tlp_tbl.tl_text_cat_attribute6(i),
7170 p_attr_values_tlp_tbl.tl_text_cat_attribute7(i),
7171 p_attr_values_tlp_tbl.tl_text_cat_attribute8(i),
7172 p_attr_values_tlp_tbl.tl_text_cat_attribute9(i),
7173 p_attr_values_tlp_tbl.tl_text_cat_attribute10(i),
7174 p_attr_values_tlp_tbl.tl_text_cat_attribute11(i),
7175 p_attr_values_tlp_tbl.tl_text_cat_attribute12(i),
7176 p_attr_values_tlp_tbl.tl_text_cat_attribute13(i),
7177 p_attr_values_tlp_tbl.tl_text_cat_attribute14(i),
7178 p_attr_values_tlp_tbl.tl_text_cat_attribute15(i),
7179 p_attr_values_tlp_tbl.tl_text_cat_attribute16(i),
7180 p_attr_values_tlp_tbl.tl_text_cat_attribute17(i),
7181 p_attr_values_tlp_tbl.tl_text_cat_attribute18(i),
7182 p_attr_values_tlp_tbl.tl_text_cat_attribute19(i),
7183 p_attr_values_tlp_tbl.tl_text_cat_attribute20(i),
7184 p_attr_values_tlp_tbl.tl_text_cat_attribute21(i),
7185 p_attr_values_tlp_tbl.tl_text_cat_attribute22(i),
7186 p_attr_values_tlp_tbl.tl_text_cat_attribute23(i),
7187 p_attr_values_tlp_tbl.tl_text_cat_attribute24(i),
7188 p_attr_values_tlp_tbl.tl_text_cat_attribute25(i),
7189 p_attr_values_tlp_tbl.tl_text_cat_attribute26(i),
7190 p_attr_values_tlp_tbl.tl_text_cat_attribute27(i),
7191 p_attr_values_tlp_tbl.tl_text_cat_attribute28(i),
7192 p_attr_values_tlp_tbl.tl_text_cat_attribute29(i),
7193 p_attr_values_tlp_tbl.tl_text_cat_attribute30(i),
7194 p_attr_values_tlp_tbl.tl_text_cat_attribute31(i),
7195 p_attr_values_tlp_tbl.tl_text_cat_attribute32(i),
7196 p_attr_values_tlp_tbl.tl_text_cat_attribute33(i),
7197 p_attr_values_tlp_tbl.tl_text_cat_attribute34(i),
7198 p_attr_values_tlp_tbl.tl_text_cat_attribute35(i),
7199 p_attr_values_tlp_tbl.tl_text_cat_attribute36(i),
7200 p_attr_values_tlp_tbl.tl_text_cat_attribute37(i),
7201 p_attr_values_tlp_tbl.tl_text_cat_attribute38(i),
7202 p_attr_values_tlp_tbl.tl_text_cat_attribute39(i),
7203 p_attr_values_tlp_tbl.tl_text_cat_attribute40(i),
7204 p_attr_values_tlp_tbl.tl_text_cat_attribute41(i),
7205 p_attr_values_tlp_tbl.tl_text_cat_attribute42(i),
7206 p_attr_values_tlp_tbl.tl_text_cat_attribute43(i),
7207 p_attr_values_tlp_tbl.tl_text_cat_attribute44(i),
7208 p_attr_values_tlp_tbl.tl_text_cat_attribute45(i),
7209 p_attr_values_tlp_tbl.tl_text_cat_attribute46(i),
7210 p_attr_values_tlp_tbl.tl_text_cat_attribute47(i),
7211 p_attr_values_tlp_tbl.tl_text_cat_attribute48(i),
7212 p_attr_values_tlp_tbl.tl_text_cat_attribute49(i),
7213 p_attr_values_tlp_tbl.tl_text_cat_attribute50(i),
7214 FND_GLOBAL.login_id, -- last_update_login
7215 FND_GLOBAL.user_id, -- last_updated_by
7216 sysdate, -- last_update_date
7217 g_R12_UPGRADE_USER, -- created_by
7218 sysdate, -- creation_date
7219 FND_GLOBAL.conc_request_id, -- request_id
7220 p_attr_values_tlp_tbl.program_application_id(i),
7221 p_attr_values_tlp_tbl.program_id(i),
7222 p_attr_values_tlp_tbl.program_update_date(i),
7223 g_R12_MIGRATION_PROGRAM -- last_updated_program
7224 FROM PO_ATTR_VALUES_TLP_INTERFACE POAVTI,
7225 PO_LINES_INTERFACE POLI -- ECO bug 4738058
7226 WHERE POAVTI.interface_attr_values_tlp_id = p_attr_values_tlp_tbl.interface_attr_values_tlp_id(i)
7227 AND p_attr_values_tlp_tbl.has_errors(i) = 'N'
7228 AND p_attr_values_tlp_tbl.action(i) = PO_R12_CAT_UPG_PVT.g_action_tlp_create
7229 -- ECO bug 4738058
7230 AND POLI.interface_line_id = POAVTI.interface_line_id;
7231
7232 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of TLP inserted='||SQL%rowcount); END IF;
7233
7234 l_progress := '020';
7235 -- SQL What: Update the process_code in interface table as PROCESSED
7236 -- SQL Why : To mark the rows as successfully inserted
7237 -- SQL Join: interface_attr_values_tlp_id
7238 -- Bug 5677911: Added the hint for performance reason.
7239 FORALL i IN 1..p_attr_values_tlp_tbl.po_line_id.COUNT
7240 UPDATE PO_ATTR_VALUES_TLP_INTERFACE POAVTI
7241 SET /*+ INDEX(POAVTI, PO_ATTR_VALUES_TLP_INT_U1)*/
7242 process_code = g_PROCESS_CODE_PROCESSED
7243 -- ECO bug 4738058
7244 , po_line_id = (SELECT POLI.po_line_id
7245 FROM PO_LINES_INTERFACE POLI
7246 WHERE POLI.interface_line_id = POAVTI.interface_line_id)
7247 WHERE POAVTI.interface_attr_values_tlp_id = p_attr_values_tlp_tbl.interface_attr_values_tlp_id(i)
7248 AND p_attr_values_tlp_tbl.has_errors(i) = 'N'
7249 AND p_attr_values_tlp_tbl.action(i) = PO_R12_CAT_UPG_PVT.g_action_tlp_create;
7250
7251 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Interface TLP rows PROCESSED='||SQL%rowcount); END IF;
7252
7253 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
7254 EXCEPTION
7255 WHEN OTHERS THEN
7256 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
7257 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
7258 END insert_attributes_tlp;
7259
7260 --------------------------------------------------------------------------------
7261 --Start of Comments
7262 --Name: update_attributes_tlp
7263 --Pre-reqs:
7264 -- The iP catalog data is populated in PO Interface tables.
7265 --Modifies:
7266 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
7267 -- to the Interface tables.
7268 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
7269 -- failed the migration.
7270 -- c) FND_MSG_PUB on unhandled exceptions.
7271 --Locks:
7272 -- None.
7273 --Function:
7274 -- Updates a batch of attr values TLP given in a plsql table, into the transaction
7275 -- tables.
7276 -- This API should be called during the upgrade phase only.
7277 --Parameters:
7278 --IN:
7279 -- p_attr_values_tlp_tbl
7280 -- A table of plsql records containing a batch of attr values TLP
7281 --OUT:
7282 --End of Comments
7283 --------------------------------------------------------------------------------
7284 PROCEDURE update_attributes_tlp
7285 (
7286 p_attr_values_tlp_tbl IN record_of_attr_values_tlp_type
7287 )
7288 IS
7289 l_api_name CONSTANT VARCHAR2(30) := 'update_attributes_tlp';
7290 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
7291 l_progress VARCHAR2(3) := '000';
7292 BEGIN
7293 l_progress := '010';
7294 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
7295
7296 -- SQL What: Update Rows that do not have errors. Overwrite all values
7297 -- from interface table to transaction table
7298 -- SQL Why : To update the po_attribute_tlp_values columns
7299 -- SQL Join: po_line_id
7300 -- Bug#5389286: Removed unnecessary OR conditions in the criteria
7301 -- For an update action, iP will always populate the
7302 -- po_line_id/req_template_name/req_template_line_num/org_id in the
7303 -- attr/attr_tlp interface tables
7304 FORALL i IN 1..p_attr_values_tlp_tbl.po_line_id.COUNT
7305 UPDATE po_attribute_values_tlp
7306 SET
7307 ip_category_id = p_attr_values_tlp_tbl.ip_category_id(i),
7308 inventory_item_id = p_attr_values_tlp_tbl.inventory_item_id(i),
7309 language = p_attr_values_tlp_tbl.language(i),
7310 description = DECODE(p_attr_values_tlp_tbl.description(i),
7311 NULL, description,
7312 g_NULLIFY_VARCHAR, NULL,
7313 p_attr_values_tlp_tbl.description(i)),
7314 manufacturer = p_attr_values_tlp_tbl.manufacturer(i),
7315 comments = p_attr_values_tlp_tbl.comments(i),
7316 alias = p_attr_values_tlp_tbl.alias(i),
7317 long_description = p_attr_values_tlp_tbl.long_description(i),
7318 tl_text_base_attribute1 = p_attr_values_tlp_tbl.tl_text_base_attribute1(i),
7319 tl_text_base_attribute2 = p_attr_values_tlp_tbl.tl_text_base_attribute2(i),
7320 tl_text_base_attribute3 = p_attr_values_tlp_tbl.tl_text_base_attribute3(i),
7321 tl_text_base_attribute4 = p_attr_values_tlp_tbl.tl_text_base_attribute4(i),
7322 tl_text_base_attribute5 = p_attr_values_tlp_tbl.tl_text_base_attribute5(i),
7323 tl_text_base_attribute6 = p_attr_values_tlp_tbl.tl_text_base_attribute6(i),
7324 tl_text_base_attribute7 = p_attr_values_tlp_tbl.tl_text_base_attribute7(i),
7325 tl_text_base_attribute8 = p_attr_values_tlp_tbl.tl_text_base_attribute8(i),
7326 tl_text_base_attribute9 = p_attr_values_tlp_tbl.tl_text_base_attribute9(i),
7327 tl_text_base_attribute10 = p_attr_values_tlp_tbl.tl_text_base_attribute10(i),
7328 tl_text_base_attribute11 = p_attr_values_tlp_tbl.tl_text_base_attribute11(i),
7329 tl_text_base_attribute12 = p_attr_values_tlp_tbl.tl_text_base_attribute12(i),
7330 tl_text_base_attribute13 = p_attr_values_tlp_tbl.tl_text_base_attribute13(i),
7331 tl_text_base_attribute14 = p_attr_values_tlp_tbl.tl_text_base_attribute14(i),
7332 tl_text_base_attribute15 = p_attr_values_tlp_tbl.tl_text_base_attribute15(i),
7333 tl_text_base_attribute16 = p_attr_values_tlp_tbl.tl_text_base_attribute16(i),
7334 tl_text_base_attribute17 = p_attr_values_tlp_tbl.tl_text_base_attribute17(i),
7335 tl_text_base_attribute18 = p_attr_values_tlp_tbl.tl_text_base_attribute18(i),
7336 tl_text_base_attribute19 = p_attr_values_tlp_tbl.tl_text_base_attribute19(i),
7337 tl_text_base_attribute20 = p_attr_values_tlp_tbl.tl_text_base_attribute20(i),
7338 tl_text_base_attribute21 = p_attr_values_tlp_tbl.tl_text_base_attribute21(i),
7339 tl_text_base_attribute22 = p_attr_values_tlp_tbl.tl_text_base_attribute22(i),
7340 tl_text_base_attribute23 = p_attr_values_tlp_tbl.tl_text_base_attribute23(i),
7341 tl_text_base_attribute24 = p_attr_values_tlp_tbl.tl_text_base_attribute24(i),
7342 tl_text_base_attribute25 = p_attr_values_tlp_tbl.tl_text_base_attribute25(i),
7343 tl_text_base_attribute26 = p_attr_values_tlp_tbl.tl_text_base_attribute26(i),
7344 tl_text_base_attribute27 = p_attr_values_tlp_tbl.tl_text_base_attribute27(i),
7345 tl_text_base_attribute28 = p_attr_values_tlp_tbl.tl_text_base_attribute28(i),
7346 tl_text_base_attribute29 = p_attr_values_tlp_tbl.tl_text_base_attribute29(i),
7347 tl_text_base_attribute30 = p_attr_values_tlp_tbl.tl_text_base_attribute30(i),
7348 tl_text_base_attribute31 = p_attr_values_tlp_tbl.tl_text_base_attribute31(i),
7349 tl_text_base_attribute32 = p_attr_values_tlp_tbl.tl_text_base_attribute32(i),
7350 tl_text_base_attribute33 = p_attr_values_tlp_tbl.tl_text_base_attribute33(i),
7351 tl_text_base_attribute34 = p_attr_values_tlp_tbl.tl_text_base_attribute34(i),
7352 tl_text_base_attribute35 = p_attr_values_tlp_tbl.tl_text_base_attribute35(i),
7353 tl_text_base_attribute36 = p_attr_values_tlp_tbl.tl_text_base_attribute36(i),
7354 tl_text_base_attribute37 = p_attr_values_tlp_tbl.tl_text_base_attribute37(i),
7355 tl_text_base_attribute38 = p_attr_values_tlp_tbl.tl_text_base_attribute38(i),
7356 tl_text_base_attribute39 = p_attr_values_tlp_tbl.tl_text_base_attribute39(i),
7357 tl_text_base_attribute40 = p_attr_values_tlp_tbl.tl_text_base_attribute40(i),
7358 tl_text_base_attribute41 = p_attr_values_tlp_tbl.tl_text_base_attribute41(i),
7359 tl_text_base_attribute42 = p_attr_values_tlp_tbl.tl_text_base_attribute42(i),
7360 tl_text_base_attribute43 = p_attr_values_tlp_tbl.tl_text_base_attribute43(i),
7361 tl_text_base_attribute44 = p_attr_values_tlp_tbl.tl_text_base_attribute44(i),
7362 tl_text_base_attribute45 = p_attr_values_tlp_tbl.tl_text_base_attribute45(i),
7363 tl_text_base_attribute46 = p_attr_values_tlp_tbl.tl_text_base_attribute46(i),
7364 tl_text_base_attribute47 = p_attr_values_tlp_tbl.tl_text_base_attribute47(i),
7365 tl_text_base_attribute48 = p_attr_values_tlp_tbl.tl_text_base_attribute48(i),
7366 tl_text_base_attribute49 = p_attr_values_tlp_tbl.tl_text_base_attribute49(i),
7367 tl_text_base_attribute50 = p_attr_values_tlp_tbl.tl_text_base_attribute50(i),
7368 tl_text_base_attribute51 = p_attr_values_tlp_tbl.tl_text_base_attribute51(i),
7369 tl_text_base_attribute52 = p_attr_values_tlp_tbl.tl_text_base_attribute52(i),
7370 tl_text_base_attribute53 = p_attr_values_tlp_tbl.tl_text_base_attribute53(i),
7371 tl_text_base_attribute54 = p_attr_values_tlp_tbl.tl_text_base_attribute54(i),
7372 tl_text_base_attribute55 = p_attr_values_tlp_tbl.tl_text_base_attribute55(i),
7373 tl_text_base_attribute56 = p_attr_values_tlp_tbl.tl_text_base_attribute56(i),
7374 tl_text_base_attribute57 = p_attr_values_tlp_tbl.tl_text_base_attribute57(i),
7375 tl_text_base_attribute58 = p_attr_values_tlp_tbl.tl_text_base_attribute58(i),
7376 tl_text_base_attribute59 = p_attr_values_tlp_tbl.tl_text_base_attribute59(i),
7377 tl_text_base_attribute60 = p_attr_values_tlp_tbl.tl_text_base_attribute60(i),
7378 tl_text_base_attribute61 = p_attr_values_tlp_tbl.tl_text_base_attribute61(i),
7379 tl_text_base_attribute62 = p_attr_values_tlp_tbl.tl_text_base_attribute62(i),
7380 tl_text_base_attribute63 = p_attr_values_tlp_tbl.tl_text_base_attribute63(i),
7381 tl_text_base_attribute64 = p_attr_values_tlp_tbl.tl_text_base_attribute64(i),
7382 tl_text_base_attribute65 = p_attr_values_tlp_tbl.tl_text_base_attribute65(i),
7383 tl_text_base_attribute66 = p_attr_values_tlp_tbl.tl_text_base_attribute66(i),
7384 tl_text_base_attribute67 = p_attr_values_tlp_tbl.tl_text_base_attribute67(i),
7385 tl_text_base_attribute68 = p_attr_values_tlp_tbl.tl_text_base_attribute68(i),
7386 tl_text_base_attribute69 = p_attr_values_tlp_tbl.tl_text_base_attribute69(i),
7387 tl_text_base_attribute70 = p_attr_values_tlp_tbl.tl_text_base_attribute70(i),
7388 tl_text_base_attribute71 = p_attr_values_tlp_tbl.tl_text_base_attribute71(i),
7389 tl_text_base_attribute72 = p_attr_values_tlp_tbl.tl_text_base_attribute72(i),
7390 tl_text_base_attribute73 = p_attr_values_tlp_tbl.tl_text_base_attribute73(i),
7391 tl_text_base_attribute74 = p_attr_values_tlp_tbl.tl_text_base_attribute74(i),
7392 tl_text_base_attribute75 = p_attr_values_tlp_tbl.tl_text_base_attribute75(i),
7393 tl_text_base_attribute76 = p_attr_values_tlp_tbl.tl_text_base_attribute76(i),
7394 tl_text_base_attribute77 = p_attr_values_tlp_tbl.tl_text_base_attribute77(i),
7395 tl_text_base_attribute78 = p_attr_values_tlp_tbl.tl_text_base_attribute78(i),
7396 tl_text_base_attribute79 = p_attr_values_tlp_tbl.tl_text_base_attribute79(i),
7397 tl_text_base_attribute80 = p_attr_values_tlp_tbl.tl_text_base_attribute80(i),
7398 tl_text_base_attribute81 = p_attr_values_tlp_tbl.tl_text_base_attribute81(i),
7399 tl_text_base_attribute82 = p_attr_values_tlp_tbl.tl_text_base_attribute82(i),
7400 tl_text_base_attribute83 = p_attr_values_tlp_tbl.tl_text_base_attribute83(i),
7401 tl_text_base_attribute84 = p_attr_values_tlp_tbl.tl_text_base_attribute84(i),
7402 tl_text_base_attribute85 = p_attr_values_tlp_tbl.tl_text_base_attribute85(i),
7403 tl_text_base_attribute86 = p_attr_values_tlp_tbl.tl_text_base_attribute86(i),
7404 tl_text_base_attribute87 = p_attr_values_tlp_tbl.tl_text_base_attribute87(i),
7405 tl_text_base_attribute88 = p_attr_values_tlp_tbl.tl_text_base_attribute88(i),
7406 tl_text_base_attribute89 = p_attr_values_tlp_tbl.tl_text_base_attribute89(i),
7407 tl_text_base_attribute90 = p_attr_values_tlp_tbl.tl_text_base_attribute90(i),
7408 tl_text_base_attribute91 = p_attr_values_tlp_tbl.tl_text_base_attribute91(i),
7409 tl_text_base_attribute92 = p_attr_values_tlp_tbl.tl_text_base_attribute92(i),
7410 tl_text_base_attribute93 = p_attr_values_tlp_tbl.tl_text_base_attribute93(i),
7411 tl_text_base_attribute94 = p_attr_values_tlp_tbl.tl_text_base_attribute94(i),
7412 tl_text_base_attribute95 = p_attr_values_tlp_tbl.tl_text_base_attribute95(i),
7413 tl_text_base_attribute96 = p_attr_values_tlp_tbl.tl_text_base_attribute96(i),
7414 tl_text_base_attribute97 = p_attr_values_tlp_tbl.tl_text_base_attribute97(i),
7415 tl_text_base_attribute98 = p_attr_values_tlp_tbl.tl_text_base_attribute98(i),
7416 tl_text_base_attribute99 = p_attr_values_tlp_tbl.tl_text_base_attribute99(i),
7417 tl_text_base_attribute100 = p_attr_values_tlp_tbl.tl_text_base_attribute100(i),
7418 tl_text_cat_attribute1 = p_attr_values_tlp_tbl.tl_text_cat_attribute1(i),
7419 tl_text_cat_attribute2 = p_attr_values_tlp_tbl.tl_text_cat_attribute2(i),
7420 tl_text_cat_attribute3 = p_attr_values_tlp_tbl.tl_text_cat_attribute3(i),
7421 tl_text_cat_attribute4 = p_attr_values_tlp_tbl.tl_text_cat_attribute4(i),
7422 tl_text_cat_attribute5 = p_attr_values_tlp_tbl.tl_text_cat_attribute5(i),
7423 tl_text_cat_attribute6 = p_attr_values_tlp_tbl.tl_text_cat_attribute6(i),
7424 tl_text_cat_attribute7 = p_attr_values_tlp_tbl.tl_text_cat_attribute7(i),
7425 tl_text_cat_attribute8 = p_attr_values_tlp_tbl.tl_text_cat_attribute8(i),
7426 tl_text_cat_attribute9 = p_attr_values_tlp_tbl.tl_text_cat_attribute9(i),
7427 tl_text_cat_attribute10 = p_attr_values_tlp_tbl.tl_text_cat_attribute10(i),
7428 tl_text_cat_attribute11 = p_attr_values_tlp_tbl.tl_text_cat_attribute11(i),
7429 tl_text_cat_attribute12 = p_attr_values_tlp_tbl.tl_text_cat_attribute12(i),
7430 tl_text_cat_attribute13 = p_attr_values_tlp_tbl.tl_text_cat_attribute13(i),
7431 tl_text_cat_attribute14 = p_attr_values_tlp_tbl.tl_text_cat_attribute14(i),
7432 tl_text_cat_attribute15 = p_attr_values_tlp_tbl.tl_text_cat_attribute15(i),
7433 tl_text_cat_attribute16 = p_attr_values_tlp_tbl.tl_text_cat_attribute16(i),
7434 tl_text_cat_attribute17 = p_attr_values_tlp_tbl.tl_text_cat_attribute17(i),
7435 tl_text_cat_attribute18 = p_attr_values_tlp_tbl.tl_text_cat_attribute18(i),
7436 tl_text_cat_attribute19 = p_attr_values_tlp_tbl.tl_text_cat_attribute19(i),
7437 tl_text_cat_attribute20 = p_attr_values_tlp_tbl.tl_text_cat_attribute20(i),
7438 tl_text_cat_attribute21 = p_attr_values_tlp_tbl.tl_text_cat_attribute21(i),
7439 tl_text_cat_attribute22 = p_attr_values_tlp_tbl.tl_text_cat_attribute22(i),
7440 tl_text_cat_attribute23 = p_attr_values_tlp_tbl.tl_text_cat_attribute23(i),
7441 tl_text_cat_attribute24 = p_attr_values_tlp_tbl.tl_text_cat_attribute24(i),
7442 tl_text_cat_attribute25 = p_attr_values_tlp_tbl.tl_text_cat_attribute25(i),
7443 tl_text_cat_attribute26 = p_attr_values_tlp_tbl.tl_text_cat_attribute26(i),
7444 tl_text_cat_attribute27 = p_attr_values_tlp_tbl.tl_text_cat_attribute27(i),
7445 tl_text_cat_attribute28 = p_attr_values_tlp_tbl.tl_text_cat_attribute28(i),
7446 tl_text_cat_attribute29 = p_attr_values_tlp_tbl.tl_text_cat_attribute29(i),
7447 tl_text_cat_attribute30 = p_attr_values_tlp_tbl.tl_text_cat_attribute30(i),
7448 tl_text_cat_attribute31 = p_attr_values_tlp_tbl.tl_text_cat_attribute31(i),
7449 tl_text_cat_attribute32 = p_attr_values_tlp_tbl.tl_text_cat_attribute32(i),
7450 tl_text_cat_attribute33 = p_attr_values_tlp_tbl.tl_text_cat_attribute33(i),
7451 tl_text_cat_attribute34 = p_attr_values_tlp_tbl.tl_text_cat_attribute34(i),
7452 tl_text_cat_attribute35 = p_attr_values_tlp_tbl.tl_text_cat_attribute35(i),
7453 tl_text_cat_attribute36 = p_attr_values_tlp_tbl.tl_text_cat_attribute36(i),
7454 tl_text_cat_attribute37 = p_attr_values_tlp_tbl.tl_text_cat_attribute37(i),
7455 tl_text_cat_attribute38 = p_attr_values_tlp_tbl.tl_text_cat_attribute38(i),
7456 tl_text_cat_attribute39 = p_attr_values_tlp_tbl.tl_text_cat_attribute39(i),
7457 tl_text_cat_attribute40 = p_attr_values_tlp_tbl.tl_text_cat_attribute40(i),
7458 tl_text_cat_attribute41 = p_attr_values_tlp_tbl.tl_text_cat_attribute41(i),
7459 tl_text_cat_attribute42 = p_attr_values_tlp_tbl.tl_text_cat_attribute42(i),
7460 tl_text_cat_attribute43 = p_attr_values_tlp_tbl.tl_text_cat_attribute43(i),
7461 tl_text_cat_attribute44 = p_attr_values_tlp_tbl.tl_text_cat_attribute44(i),
7462 tl_text_cat_attribute45 = p_attr_values_tlp_tbl.tl_text_cat_attribute45(i),
7463 tl_text_cat_attribute46 = p_attr_values_tlp_tbl.tl_text_cat_attribute46(i),
7464 tl_text_cat_attribute47 = p_attr_values_tlp_tbl.tl_text_cat_attribute47(i),
7465 tl_text_cat_attribute48 = p_attr_values_tlp_tbl.tl_text_cat_attribute48(i),
7466 tl_text_cat_attribute49 = p_attr_values_tlp_tbl.tl_text_cat_attribute49(i),
7467 tl_text_cat_attribute50 = p_attr_values_tlp_tbl.tl_text_cat_attribute50(i),
7468 last_update_login = FND_GLOBAL.login_id,
7469 last_updated_by = FND_GLOBAL.user_id,
7470 last_update_date = sysdate,
7471 created_by = g_R12_UPGRADE_USER,
7472 creation_date = sysdate,
7473 request_id = FND_GLOBAL.conc_request_id,
7474 program_application_id = p_attr_values_tlp_tbl.program_application_id(i),
7475 program_id = p_attr_values_tlp_tbl.program_id(i),
7476 program_update_date = p_attr_values_tlp_tbl.program_update_date(i),
7477 last_updated_program = g_R12_MIGRATION_PROGRAM
7478 WHERE p_attr_values_tlp_tbl.has_errors(i) = 'N'
7479 AND p_attr_values_tlp_tbl.action(i) = 'UPDATE'
7480 AND language = p_attr_values_tlp_tbl.language(i)
7481 AND po_line_id = p_attr_values_tlp_tbl.po_line_id(i)
7482 AND req_template_name = p_attr_values_tlp_tbl.req_template_name (i)
7483 AND req_template_line_num = p_attr_values_tlp_tbl.req_template_line_num(i)
7484 AND org_id = p_attr_values_tlp_tbl.org_id(i);
7485
7486 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of TLP updated='||SQL%rowcount); END IF;
7487
7488 l_progress := '020';
7489 -- SQL What: Update the process_code in interface table as PROCESSED
7490 -- SQL Why : To mark the rows as successfully updated
7491 -- SQL Join: language, po_line_id, req_template_name, req_template_line_num
7492 -- Bug#5389286: Removed unnecessary OR conditions in the criteria
7493 -- For an update action, iP will always populate the
7494 -- po_line_id/req_template_name/req_template_line_num/org_id in the
7495 -- attr/attr_tlp interface tables
7496 -- Bug 5677911: Added the hint for performance reason.
7497 FORALL i IN 1..p_attr_values_tlp_tbl.po_line_id.COUNT
7498 UPDATE /*+ INDEX(POTLPI, PO_ATTR_VALUES_TLP_INT_N3)*/
7499 PO_ATTR_VALUES_TLP_INTERFACE POTLPI
7500 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
7501 WHERE p_attr_values_tlp_tbl.has_errors(i) = 'N'
7502 AND p_attr_values_tlp_tbl.action(i) = 'UPDATE'
7503 AND language = p_attr_values_tlp_tbl.language(i)
7504 AND po_line_id = p_attr_values_tlp_tbl.po_line_id(i)
7505 AND req_template_name = p_attr_values_tlp_tbl.req_template_name (i)
7506 AND req_template_line_num = p_attr_values_tlp_tbl.req_template_line_num(i)
7507 AND org_id = p_attr_values_tlp_tbl.org_id(i);
7508
7509 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of interface TLP rows PROCESSED='||SQL%rowcount); END IF;
7510
7511 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
7512 EXCEPTION
7513 WHEN OTHERS THEN
7514 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
7515 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
7516 END update_attributes_tlp;
7517
7518 --------------------------------------------------------------------------------
7519 --Start of Comments
7520 --Name: delete_attributes_tlp
7521 --Pre-reqs:
7522 -- The iP catalog data is populated in PO Interface tables.
7523 --Modifies:
7524 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
7525 -- to the Interface tables.
7526 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
7527 -- failed the migration.
7528 -- c) FND_MSG_PUB on unhandled exceptions.
7529 --Locks:
7530 -- None.
7531 --Function:
7532 -- Deletes a batch of attr values TLP given in a plsql table, from the transaction
7533 -- tables:
7534 --Parameters:
7535 --IN:
7536 -- p_attr_values_tlp_tbl
7537 -- A table of plsql records containing a batch of attr values TLP
7538 --OUT:
7539 --End of Comments
7540 --------------------------------------------------------------------------------
7541 PROCEDURE delete_attributes_tlp
7542 (
7543 p_attr_values_tlp_tbl IN record_of_attr_values_tlp_type
7544 )
7545 IS
7546 l_api_name CONSTANT VARCHAR2(30) := 'delete_attributes_tlp';
7547 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
7548 l_progress VARCHAR2(3) := '000';
7549 BEGIN
7550 l_progress := '010';
7551 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
7552
7553 -- Delete Rows that do not have errors
7554 FORALL i IN 1..p_attr_values_tlp_tbl.po_line_id.COUNT
7555 DELETE FROM po_attribute_values_tlp
7556 WHERE p_attr_values_tlp_tbl.has_errors(i) = 'N'
7557 AND p_attr_values_tlp_tbl.action(i) = 'DELETE'
7558 AND language = p_attr_values_tlp_tbl.language(i)
7559 AND ( (po_line_id = p_attr_values_tlp_tbl.po_line_id(i)
7560 AND p_attr_values_tlp_tbl.po_line_id(i) <> g_NOT_REQUIRED_ID)
7561 OR
7562 (req_template_name = p_attr_values_tlp_tbl.req_template_name (i)
7563 AND req_template_line_num = p_attr_values_tlp_tbl.req_template_line_num(i)
7564 AND org_id = p_attr_values_tlp_tbl.org_id(i)
7565 AND p_attr_values_tlp_tbl.req_template_line_num(i) <> g_NOT_REQUIRED_ID));
7566
7567 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of TLP deleted='||SQL%rowcount); END IF;
7568
7569 l_progress := '020';
7570 -- Delete Rows that do not have errors
7571 -- Bug 5677911: Added the hint for performance reason.
7572 FORALL i IN 1..p_attr_values_tlp_tbl.po_line_id.COUNT
7573 UPDATE /*+ INDEX(POTLPI, PO_ATTR_VALUES_TLP_INT_N3)*/
7574 PO_ATTR_VALUES_TLP_INTERFACE POTLPI
7575 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
7576 WHERE p_attr_values_tlp_tbl.has_errors(i) = 'N'
7577 AND p_attr_values_tlp_tbl.action(i) = 'DELETE'
7578 AND language = p_attr_values_tlp_tbl.language(i)
7579 AND ( (po_line_id = p_attr_values_tlp_tbl.po_line_id(i)
7580 AND p_attr_values_tlp_tbl.po_line_id(i) <> g_NOT_REQUIRED_ID)
7581 OR
7582 (req_template_name = p_attr_values_tlp_tbl.req_template_name (i)
7583 AND req_template_line_num = p_attr_values_tlp_tbl.req_template_line_num(i)
7584 AND org_id = p_attr_values_tlp_tbl.org_id(i)
7585 AND p_attr_values_tlp_tbl.req_template_line_num(i) <> g_NOT_REQUIRED_ID));
7586
7587 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of Interface TLP rows PROCESSED='||SQL%rowcount); END IF;
7588
7589 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
7590 EXCEPTION
7591 WHEN OTHERS THEN
7592 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
7593 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
7594 END delete_attributes_tlp;
7595
7596 --------------------------------------------------------------------------------
7597 --Start of Comments
7598 --Name: update_req_templates
7599 --Pre-reqs:
7600 -- The iP catalog data is populated in PO Interface tables.
7601 --Modifies:
7602 -- a) PO Interface Tables (inserts new po_header_id for successful rows, back
7603 -- to the Interface tables.
7604 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
7605 -- failed the migration.
7606 -- c) FND_MSG_PUB on unhandled exceptions.
7607 --Locks:
7608 -- None.
7609 --Function:
7610 -- Migrate the lines for Requisition Templates. The Unique Key for Req Template
7611 -- Lines is:
7612 --
7613 -- (EXPRESS_NAME, SEQUENCE_NUM, ORG_ID)
7614 --
7615 -- Update the following columns in the Requisition Templates with data from
7616 -- the TLP tables. (The TLP tables were migrated already in the previous
7617 -- steps of the migration program).
7618 --
7619 -- ip_category_id
7620 -- ITEM_DESCRIPTION
7621 --
7622 -- This API should be called during the upgrade phase only.
7623 --Parameters:
7624 --p_batch_size
7625 -- The maximum number of rows that should be processed at a time, to avoid
7626 -- exceeding rollback segment. The transaction would be committed after
7627 -- processing each batch.
7628 --p_validate_only_mode
7629 -- Indicates if the API is being called in a Validate Only mode or not
7630 --OUT:
7631 --x_return_status
7632 -- Apps API Std
7633 -- FND_API.g_ret_sts_success - if the procedure completed successfully
7634 -- FND_API.g_ret_sts_error - if an error occurred
7635 -- FND_API.g_ret_sts_unexp_error - unexpected error occurred
7636 --
7637 --End of Comments
7638 --------------------------------------------------------------------------------
7639 PROCEDURE update_req_templates
7640 (
7641 p_batch_size IN NUMBER default 2500
7642 , p_validate_only_mode IN VARCHAR2 default FND_API.G_FALSE
7643 , x_return_status OUT NOCOPY VARCHAR2
7644 )
7645 IS
7646 l_api_name CONSTANT VARCHAR2(30) := 'update_req_templates';
7647 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
7648 l_progress VARCHAR2(3) := '000';
7649
7650 -- SQL What: Cursor to load RT lines
7651 -- SQL Why : To migrate data to PO txn tables
7652 -- SQL Join: processing_id, interface_line_id, language, req_template_name
7653 -- req_template_line_num
7654 -- Bug 5677911: Added the hint for performance reason.
7655 CURSOR load_rt_lines_csr(p_request_processing_id NUMBER,
7656 p_base_lang VARCHAR2) IS
7657 SELECT /*+ INDEX(intf_tlp, PO_ATTR_VALUES_TLP_INT_N2)*/
7658 intf_tlp.interface_attr_values_tlp_id,
7659 intf_tlp.interface_header_id,
7660 intf_tlp.interface_line_id,
7661 intf_tlp.req_template_name,
7662 intf_tlp.req_template_line_num,
7663 intf_tlp.org_id,
7664 intf_tlp.ip_category_id,
7665 intf_tlp.description
7666 FROM PO_ATTR_VALUES_TLP_INTERFACE intf_tlp
7667 -- Not negative, means it was migrated successfully in prev steps
7668 WHERE intf_tlp.processing_id = p_request_processing_id
7669 AND intf_tlp.process_code = g_PROCESS_CODE_PROCESSED
7670 AND intf_tlp.action IN (PO_R12_CAT_UPG_PVT.g_action_tlp_create, 'UPDATE')
7671 AND intf_tlp.language = p_base_lang
7672 AND intf_tlp.req_template_name is not null
7673 AND intf_tlp.req_template_line_num is not null
7674 AND intf_tlp.req_template_line_num <> g_NOT_REQUIRED_ID
7675 AND intf_tlp.org_id is not null;
7676
7677 l_rt_lines_table record_of_rt_lines_type;
7678
7679 BEGIN
7680 l_progress := '010';
7681 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
7682
7683 -- Initialize API return status to success
7684 x_return_status := FND_API.G_RET_STS_SUCCESS;
7685
7686 l_progress := '010';
7687
7688 -- Algorithm:
7689 -- 1. Load Lines batch (batch_size) into pl/sql table.
7690 -- 2. Transfer directly to Transaction tables
7691
7692 OPEN load_rt_lines_csr(g_processing_id,
7693 PO_R12_CAT_UPG_UTL.get_base_lang());
7694
7695 l_progress := '020';
7696 LOOP
7697 BEGIN -- block to handle SNAPSHOT_TOO_OLD exception
7698 l_progress := '025';
7699 FETCH load_rt_lines_csr BULK COLLECT INTO
7700 l_rt_lines_table.interface_attr_values_tlp_id,
7701 l_rt_lines_table.interface_header_id,
7702 l_rt_lines_table.interface_line_id,
7703 l_rt_lines_table.req_template_name,
7704 l_rt_lines_table.req_template_line_num,
7705 l_rt_lines_table.org_id,
7706 l_rt_lines_table.ip_category_id,
7707 l_rt_lines_table.description
7708 LIMIT p_batch_size;
7709
7710 l_progress := '030';
7711
7712 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'l_rt_lines_table.req_template_name.COUNT='||l_rt_lines_table.req_template_name.COUNT); END IF;
7713
7714 EXIT WHEN l_rt_lines_table.req_template_name.COUNT = 0;
7715
7716 l_progress := '070';
7717 -- Skip transfer if runnning in Validate Only mode.
7718 IF (p_validate_only_mode = FND_API.G_FALSE) THEN
7719 -- Transfer Lines
7720 update_req_template_batch(p_rt_lines_rec => l_rt_lines_table);
7721 END IF; -- IF (p_validate_only_mode = FND_API.G_FALSE)
7722
7723 l_progress := '100';
7724 COMMIT;
7725
7726 l_progress := '110';
7727 IF (l_rt_lines_table.req_template_name.COUNT
7728 < g_job.batch_size) THEN
7729 EXIT;
7730 END IF;
7731 l_progress := '120';
7732 EXCEPTION
7733 WHEN g_SNAPSHOT_TOO_OLD THEN
7734 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'EXCEPTION: SNAPSHOT_TOO_OLD. Now commiting and re-opening the load_rt_lines_csr'); END IF;
7735
7736 -- Commit and re-open the cursor
7737 l_progress := '130';
7738 COMMIT;
7739
7740 l_progress := '140';
7741 CLOSE load_rt_lines_csr;
7742
7743 l_progress := '150';
7744 OPEN load_rt_lines_csr(g_processing_id,
7745 PO_R12_CAT_UPG_UTL.get_base_lang());
7746 l_progress := '160';
7747 END; -- block to handle SNAPSHOT_TOO_OLD exception
7748 END LOOP; -- batch loop
7749
7750 l_progress := '170';
7751 IF (load_rt_lines_csr%ISOPEN) THEN
7752 CLOSE load_rt_lines_csr;
7753 END IF;
7754
7755 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
7756 EXCEPTION
7757 WHEN OTHERS THEN
7758 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
7759 IF (load_rt_lines_csr%ISOPEN) THEN
7760 CLOSE load_rt_lines_csr;
7761 END IF;
7762 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
7763 END update_req_templates;
7764
7765 --------------------------------------------------------------------------------
7766 --Start of Comments
7767 --Name: update_req_template_batch
7768 --Pre-reqs:
7769 -- The iP catalog data is populated in PO Interface tables.
7770 --Modifies:
7771 -- a) PO Interface Tables (inserts new po_line_id for successful rows, back
7772 -- to the Interface tables.
7773 -- b) PO_INTERFACE_ERRORS table: Inserts error messages for those rows that
7774 -- failed the migration.
7775 -- c) FND_MSG_PUB on unhandled exceptions.
7776 --Locks:
7777 -- None.
7778 --Function:
7779 -- Updates a batch of ReqTemplate lines given in a plsql table, into the transaction
7780 -- tables.
7781 -- This API should be called during the upgrade phase only.
7782 --Parameters:
7783 --IN:
7784 -- p_doc_lines_rec
7785 -- A table of plsql records containing a batch of RT line information
7786 --OUT:
7787 --End of Comments
7788 --------------------------------------------------------------------------------
7789 PROCEDURE update_req_template_batch
7790 (
7791 p_rt_lines_rec IN record_of_rt_lines_type
7792 )
7793 IS
7794 l_api_name CONSTANT VARCHAR2(30) := 'update_req_template_batch';
7795 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
7796 l_progress VARCHAR2(3) := '000';
7797 BEGIN
7798 l_progress := '010';
7799 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
7800
7801 -- SQL What: Update all the ReqTemplate lines.
7802 -- For these, only the IP_CATEGORY_ID and DESCRIPTION is allowed
7803 -- to be updated. The other columns, if provided in the interface
7804 -- tables, will be ignored. Here, g_NULL_IP_CATEGORY_ID is -2.
7805 -- SQL Why : To update the po_reqexpress_lines_all columns
7806 -- SQL Join: express_name, sequence_num (They form the PK)
7807 FORALL i IN 1..p_rt_lines_rec.ip_category_id.COUNT
7808 UPDATE PO_REQEXPRESS_LINES_ALL
7809 SET
7810 ip_category_id = DECODE(p_rt_lines_rec.ip_category_id(i),
7811 NULL, ip_category_id,
7812 g_NULLIFY_NUM, g_NULL_IP_CATEGORY_ID,
7813 p_rt_lines_rec.ip_category_id(i)),
7814 item_description = DECODE(p_rt_lines_rec.description(i),
7815 NULL, item_description,
7816 g_NULLIFY_VARCHAR, NULL,
7817 p_rt_lines_rec.description(i))
7818 WHERE express_name = p_rt_lines_rec.req_template_name(i)
7819 AND sequence_num = p_rt_lines_rec.req_template_line_num(i)
7820 AND org_id = p_rt_lines_rec.org_id(i);
7821
7822 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of RT updated='||SQL%rowcount); END IF;
7823
7824 -- Now update the upper level Line and Header Records to mark them PROCESSED
7825 FORALL i IN 1..p_rt_lines_rec.interface_attr_values_tlp_id.COUNT
7826 UPDATE PO_LINES_INTERFACE
7827 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
7828 WHERE interface_line_id = p_rt_lines_rec.interface_line_id(i);
7829
7830 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of LinesInterface rows marked PROCESSED='||SQL%rowcount); END IF;
7831
7832 FORALL i IN 1..p_rt_lines_rec.interface_attr_values_tlp_id.COUNT
7833 UPDATE PO_HEADERS_INTERFACE
7834 SET PROCESS_CODE = g_PROCESS_CODE_PROCESSED
7835 WHERE interface_header_id = p_rt_lines_rec.interface_header_id(i);
7836
7837 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of HeadersInterface rows marked PROCESSED='||SQL%rowcount); END IF;
7838
7839 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
7840 EXCEPTION
7841 WHEN OTHERS THEN
7842 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
7843 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
7844 END update_req_template_batch;
7845
7846 --------------------------------------------------------------------------------
7847 --Start of Comments
7848 --Name: get_distinct_orgs
7849 --Pre-reqs:
7850 -- The iP catalog data is populated in PO Interface tables.
7851 --Modifies:
7852 -- a) FND_MSG_PUB on unhandled exceptions.
7853 --Locks:
7854 -- None.
7855 --Function:
7856 -- Finds the list of distinct org_id's for which the data has been populated
7857 -- in the interface headers table for the given batch.
7858 --Parameters:
7859 --IN:
7860 --p_batch_id
7861 -- Batch ID to identify the data in interface tables that needs to be migrated.
7862 --IN/OUT:
7863 --x_org_id_list
7864 -- A plsql table containing a list of distinct org id's.
7865 --End of Comments
7866 --------------------------------------------------------------------------------
7867 PROCEDURE get_distinct_orgs
7868 (
7869 p_batch_id IN NUMBER
7870 , p_batch_size IN NUMBER
7871 , p_validate_only_mode IN VARCHAR2
7872 , x_org_id_list IN OUT NOCOPY PO_R12_CAT_UPG_TYPES.PO_TBL_NUMBER
7873 )
7874 IS
7875 l_api_name CONSTANT VARCHAR2(30) := 'get_distinct_orgs';
7876 l_log_head CONSTANT VARCHAR2(100) := g_module_prefix || l_api_name;
7877 l_progress VARCHAR2(3) := '000';
7878 BEGIN
7879 l_progress := '010';
7880 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'START'); END IF;
7881
7882 -- Validate the org_id's. For invalid orgs, mark all associated records as REJECTED.
7883 PO_R12_CAT_UPG_VAL_PVT.validate_org_ids(
7884 p_batch_id => p_batch_id
7885 , p_batch_size => p_batch_size
7886 , p_validate_only_mode => p_validate_only_mode);
7887
7888 -- SQL What: Finds the list of distinct org_id's for which the data has been
7889 -- populated in the interface headers table for the given batch.
7890 -- SQL Why : It will be used to migrate data per org.
7891 -- SQL Join: batch_id
7892 SELECT distinct org_id
7893 BULK COLLECT INTO x_org_id_list
7894 FROM po_headers_interface
7895 WHERE batch_id = p_batch_id
7896 AND process_code = g_PROCESS_CODE_NEW;
7897
7898 l_progress := '020';
7899 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Number of distinct orgs='||x_org_id_list.COUNT); END IF;
7900
7901 l_progress := '030';
7902 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'END'); END IF;
7903 EXCEPTION
7904 WHEN OTHERS THEN
7905 IF g_debug THEN PO_R12_CAT_UPG_DEBUG.log_stmt(l_log_head,l_progress,'Unexpected exception'); END IF;
7906 RAISE_APPLICATION_ERROR(g_err_num,l_log_head||','||l_progress || ','|| SQLERRM);
7907 END get_distinct_orgs;
7908
7909 END PO_R12_CAT_UPG_PVT;