1 PACKAGE BODY rcv_express_sv AS
2 /* $Header: RCVTXEXB.pls 120.17.12020000.2 2012/07/10 09:29:26 ptkumar ship $*/
3
4 /** Bug:5855096
5 Modified the Signature of the function val_rcv_trx_interface to
6 pass the value of X_txn_from_web and X_txn_from_wf which tells
7 whether the call is made from iProcurement page.
8 Reason:
9 -------
10 It is not possible to find out whether the call is made from
11 iProcurement page in val_rcv_trx_interface(), as the rti.transaction_type
12 is modifed in val_express_transactions() and set_trx_defaults()
13 before calling val_rcv_trx_interface().
14 */
15 FUNCTION val_rcv_trx_interface (
16 rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE,
17 X_txn_from_web IN BOOLEAN,--Bug 5855096
18 X_txn_from_wf IN BOOLEAN)--Bug 5855096
19 RETURN BOOLEAN;
20
21 PROCEDURE set_trx_defaults (
22 rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE);
23
24 PROCEDURE print_record (
25 rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE);
26
27 PROCEDURE insert_interface_errors ( rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE,
28 X_column_name IN VARCHAR2,
29 X_err_message IN VARCHAR2);
30
31 /*===========================================================================
32
33 PROCEDURE NAME: val_express_transactions
34
35 ===========================================================================*/
36
37 PROCEDURE val_express_transactions (X_group_id IN NUMBER,
38 X_rows_succeeded OUT NOCOPY NUMBER,
39 X_rows_failed OUT NOCOPY NUMBER) IS
40
41 CURSOR rcv_get_interface_rows IS
42 SELECT *
43 FROM rcv_transactions_interface
44 WHERE group_id = X_group_id
45 AND transaction_status_code in ( 'EXPRESS', 'CONFIRM' )
46 ORDER BY interface_transaction_id;
47
48 rcv_trx rcv_transactions_interface%ROWTYPE;
49 record_num NUMBER := 0;
50 rows_succeeded NUMBER := 0;
51 rows_failed NUMBER := 0;
52 delivery_rows_succeeded NUMBER := 0;
53 delivery_rows_failed NUMBER := 0;
54 done BOOLEAN := FALSE;
55 transaction_ok BOOLEAN := FALSE;
56 x_first_error BOOLEAN := TRUE;
57 X_progress VARCHAR2(4) := '000';
58 x_column_name po_interface_errors.column_name%type;
59 x_message_text fnd_new_messages.message_text%type;
60 x_message_name varchar2(30);
61 X_txn_from_web BOOLEAN := FALSE;
62 X_txn_from_wf BOOLEAN := FALSE;
63 X_language_code varchar2(4);
64 X_language_id number;
65 x_output_message fnd_new_messages.message_text%type := null;
66
67 l_matching_basis po_lines.matching_basis%type ;
68 /* The following variables were added for bug 2734333 */
69 x_base_currency_code varchar2(30) := ''; -- Bug 2734333
70 x_match_option varchar2(25);
71 v_rateDate DATE;
72 v_rate NUMBER;
73 v_sobid NUMBER;
74 --Bugfix5213454: Variable declaration for QA API.
75 l_qa_eval_result VARCHAR2(10);
76 l_qa_return_status VARCHAR2(5);
77 l_qa_msg_count NUMBER;
78 l_qa_msg_data VARCHAR2(2400);
79
80 /*
81 ** The get interface rows cursor is used to select all the rows that
82 ** were inserted during the express transaction from the form. We will
83 ** will loop through each of these rows to ensure that the row can
84 ** be transacted. For now the only feedback that the user will receive
85 ** is how many rows passed validation and how many failed. We should
86 ** add some kind of notification to this so the user can see which records
87 ** had problems.
88 **
89 ** This function assumes that if you are performing an
90 ** express direct receipt or an express delivery that you will insert all
91 ** the distributions into the transaction_interface table.
92 **
93 ** The process is read a record into memory, set defaults in memory,
94 ** validate trx, if transaction passes validation then write it out
95 ** to database with all the defaults and updated values, otherwise
96 ** delete it from the interface.
97 */
98
99 /* Modified this procedure to validate input from the Receive Orders
100 ** Web Page.
101 */
102
103 BEGIN
104
105 X_progress := '010';
106
107 /* Open the cursor for the fetch */
108 OPEN rcv_get_interface_rows;
109
110 /*
111 ** Loop:
112 ** Select the rows from the rcv_transactions_interface table
113 ** that will be transacted with this group_id
114 */
115 X_progress := '020';
116
117 LOOP
118
119 record_num := record_num + 1;
120
121 FETCH rcv_get_interface_rows INTO
122 rcv_trx;
123
124 EXIT WHEN rcv_get_interface_rows%NOTFOUND;
125
126 /*
127 ** DEBUG: Need a lock row routine for both the shipment line and
128 ** the line location. Will locking here collide with a potention
129 ** lock in the form.
130 ** Lock the shipment to prevent two users receiving against the
131 ** PO at the same time. If rows are not locked it is possible to
132 ** over-receive the PO.
133 */
134 X_progress := '030';
135
136 -- po_line_locations_sv.lock_row (line_location_id);
137 /* Bug 4773978: Added the following code for logging error messages
138 in PO_INTERFACE_ERRORS table. */
139 RCV_ERROR_PKG.initialize(rcv_trx.transaction_type,
140 rcv_trx.group_id,
141 rcv_trx.header_interface_id,
142 rcv_trx.interface_transaction_id);
143 /* Bug 4773978 end */
144
145 /*
146 ** Make sure that this is a express transaction that you're
147 ** processing
148 */
149 IF (rcv_trx.transaction_type IN ('EXPRESS RECEIPT','EXPRESS DIRECT','EXPRESS DELIVER','CONFIRM RECEIPT',
150 'CONFIRM RECEIPT(WF)')) then
151
152 /*
153 ** set any default values that might be required for this receipt
154 ** transaction. This should not be done if the transaction type
155 ** is CONFIRM RECEIPT as the quantity and uom would have been
156 ** entered by the user.We should not be defaulting in such a
157 ** case.
158 */
159 X_progress := '040';
160
161 if (rcv_trx.transaction_type = 'CONFIRM RECEIPT') then
162 x_txn_from_web := TRUE;
163 else
164 x_txn_from_web := FALSE;
165 end if;
166
167 -- bug 513848
168 -- Set flag to indicate from workflow
169 if (rcv_trx.transaction_type = 'CONFIRM RECEIPT(WF)') then
170 x_txn_from_wf := TRUE;
171 else
172 x_txn_from_wf := FALSE;
173 end if;
174
175
176 /* FPJ SERVICES.
177 * We support services only through ROI and IP. This part of
178 * the code should work only when it comes through IP. Through
179 * forms we cannot receive Service PO shipments. From IP, we
180 * will have po_line_id. We dont need to call set_trx_defaults
181 * and val_rcv_trx_interface for service based amounts since
182 * they are already done in IP.
183 */
184 /* R12 Complex work.
185 * We get matching_basis from the shipment level and not
186 * from line level.
187 */
188 begin
189 select nvl(matching_basis,'QUANTITY')
190 into l_matching_basis
191 from po_line_locations
192 where line_location_id =rcv_trx.po_line_location_id;
193 exception
194 /* Bug 3417961 : If the receipt_source_code is not PO then the above sql
195 will fetch null in l_matching_basis. This will cause set_trx_defaults()
196 and val_rcv_trx_interface() not getting called for RMA, Internal Order
197 and Intransit shipment Receipts. Defaulting l_matching_basis to 'QUANTITY'
198 */
199
200 when no_data_found then
201 l_matching_basis := 'QUANTITY';
202 end;
203
204 If (l_matching_basis <> 'AMOUNT') then --{
205
206 rcv_express_sv.set_trx_defaults (rcv_trx);
207 else
208 IF (rcv_trx.transaction_type = 'EXPRESS RECEIPT') THEN
209
210 rcv_trx.transaction_type := 'RECEIVE';
211 rcv_trx.auto_transact_code := 'RECEIVE';
212
213 ELSIF (rcv_trx.transaction_type = 'EXPRESS DIRECT') THEN
214
215 rcv_trx.transaction_type := 'RECEIVE';
216 rcv_trx.auto_transact_code := 'DELIVER';
217
218 ELSIF (rcv_trx.transaction_type = 'EXPRESS DELIVER') THEN
219
220 rcv_trx.transaction_type := 'DELIVER';
221 rcv_trx.auto_transact_code := '';
222
223 ELSIF (rcv_trx.transaction_type = 'CONFIRM RECEIPT') THEN
224
225 rcv_trx.transaction_type := 'RECEIVE';
226 rcv_trx.auto_transact_code := 'DELIVER';
227 X_txn_from_web := TRUE;
228
229 ELSIF (rcv_trx.transaction_type = 'CONFIRM RECEIPT(WF)') THEN
230
231 rcv_trx.transaction_type := 'RECEIVE';
232 rcv_trx.auto_transact_code := 'DELIVER';
233 X_txn_from_web := FALSE;
234
235 -- bug 513848
236 X_txn_from_wf := TRUE;
237
238 END IF;
239
240 rcv_trx.processing_status_code := 'PENDING';
241 rcv_trx.transaction_status_code := 'PENDING';
242 end if; --}
243
244 /* Bug 13864622 set the interface_source_code to IP for the receiving txns from iProcurement or workflow. */
245
246 IF ( X_txn_from_wf OR X_txn_from_web) THEN
247 rcv_trx.interface_source_code := 'IP' ;
248
249 END IF;
250
251 /* End of Bug 13864622 */
252
253
254 /* Bug 2734333 - Getting the currency conversion rate for the receipt creation date when the match option is Receipt */
255
256 IF (rcv_trx.source_document_code = 'PO') THEN
257
258 /* Added the following pl/sql block to get the functional currency - Bug 2734333 */
259
260 /* <R12 MOAC START>
261 ** Moved the following Begin-End block into the LOOP and
262 ** added the predicate for Org_id in the where clause
263 */
264
265 BEGIN
266 SELECT GSB.currency_code,FSP.set_of_books_id
267 INTO x_base_currency_code,
268 v_sobid
269 FROM FINANCIALS_SYSTEM_PARAMETERS FSP,
270 GL_SETS_OF_BOOKS GSB
271 WHERE FSP.set_of_books_id = GSB.set_of_books_id
272 AND FSP.org_id = rcv_trx.org_id;
273 EXCEPTION
274 WHEN OTHERS THEN
275 RAISE;
276 END;
277
278 --<R12 MOAC END>
279
280 IF (rcv_trx.currency_code <> nvl(x_base_currency_code,rcv_trx.currency_code)) then
281
282 /* getting the match option from the PO */
283
284 select match_option
285 into x_match_option
286 from po_line_locations
287 where line_location_id = rcv_trx.po_line_location_id;
288
289 /* bug 4356092 - currency conversion rate code was incorrect */
290 IF (x_match_option = 'R') THEN
291 /* For enter receipts form */
292 IF (rcv_trx.parent_transaction_id IS NULL) THEN
293 IF (rcv_trx.currency_conversion_type = 'User') THEN
294 rcv_trx.currency_conversion_date := rcv_trx.creation_date;
295 ELSE --rcv_trx.currency_converstion_type <> 'User'
296 BEGIN
297 /* attempt to to get rate at creation time */
298 v_rate := gl_currency_api.get_rate(v_sobid,
299 rcv_trx.currency_code,
300 rcv_trx.creation_date,
301 rcv_trx.currency_conversion_type
302 );
303 /* if successfull then set the currency_conversion_date to the date used above */
304 rcv_trx.currency_conversion_date := rcv_trx.creation_date;
305 EXCEPTION
306 WHEN OTHERS THEN
307 /* Bug 4773978: Removed the code to get currency conversion rate using currency conversion date
308 defined in PO, if currency conversion rate is not defined for the receipt date.
309 We have to error out the transaction in PO_INTERFACE_ERRORS table for the POs created
310 with invoice match set to 'Receipts', if currency conversion rate is not defined for
311 the receipt date. */
312 v_rate := fnd_api.g_miss_num;
313 /* Bug 4773978 end */
314 END;
315
316 rcv_trx.currency_conversion_rate := v_rate;
317 END IF; -- conversion type is not user
318 ELSE
319 /* For receiving transactions form */
320 SELECT currency_conversion_date,
321 currency_conversion_rate
322 INTO v_ratedate,
323 v_rate
324 FROM rcv_transactions
325 WHERE transaction_id = rcv_trx.parent_transaction_id;
326
327 rcv_trx.currency_conversion_date := v_ratedate;
328 rcv_trx.currency_conversion_rate := v_rate;
329 END IF; -- parent transaction id
330 END IF; -- match option is R
331
332 END IF; --currency code
333
334 END IF; -- source document code is po
335
336 /* Validate that the transaction can be express received */
337
338 If (l_matching_basis <> 'AMOUNT') then
339 transaction_ok := rcv_express_sv.val_rcv_trx_interface (rcv_trx,X_txn_from_web,X_txn_from_wf);--Bug 5855096
340 else
341 /* Set transaction_ok to TRUE since we are not calling
342 * val_rcv_trx_interface.
343 */
344 transaction_ok := TRUE;
345 end if;
346
347 /*
348 ** If the transaction passes all validation requirements
349 ** then go ahead and process the rows so that it gets picked
350 ** up by the transaction procesor
351 */
352 IF (transaction_ok) THEN
353
354 X_progress := '050';
355
356 /*
357 ** Set all the columns for this receipt transaction row`
358 ** so that it can be picked up by the transaction processor
359 */
360 --Bugfix5213454 Start: Called QA API after RTI record validation.
361
362 /* Bugfix 5855096 : Modified the condtion rcv_trx.auto_transact_code <> 'CUSTOMER'
363 with rcv_trx.receipt_source_code = 'VENDOR'*/
364
365 IF (rcv_trx.routing_header_id = 2 AND
366 rcv_trx.receipt_source_code = 'VENDOR' AND --Bug 5855096
367 rcv_trx.quantity > 0) THEN
368
369 QA_SKIPLOT_RCV_GRP.EVALUATE_LOT
370 (p_api_version => 1.0,
371 p_init_msg_list => NULL,
372 p_commit => 'T',
373 p_validation_level => NULL,
374 p_interface_txn_id => rcv_trx.interface_transaction_id,
375 p_organization_id => rcv_trx.to_organization_id,
376 p_vendor_id => rcv_trx.vendor_id,
377 p_vendor_site_id => rcv_trx.vendor_site_id,
378 p_item_id => rcv_trx.item_id,
379 p_item_revision => rcv_trx.item_revision,
380 p_item_category_id => rcv_trx.category_id,
381 p_project_id => rcv_trx.project_id,
382 p_task_id => rcv_trx.task_id,
383 p_manufacturer_id => NULL,
384 p_source_inspected => NULL,
385 p_receipt_qty => rcv_trx.quantity,
386 p_receipt_date => rcv_trx.transaction_date,
387 p_primary_uom => rcv_trx.primary_unit_of_measure,
388 p_transaction_uom => rcv_trx.unit_of_measure,
389 p_po_header_id => rcv_trx.po_header_id,
390 p_po_line_id => rcv_trx.po_line_id,
391 p_po_line_location_id => rcv_trx.po_line_location_id,
392 p_po_distribution_id => rcv_trx.po_distribution_id,
393 x_evaluation_result => l_qa_eval_result,
394 x_return_status => l_qa_return_status,
395 x_msg_count => l_qa_msg_count,
396 x_msg_data => l_qa_msg_data);
397
398 IF l_qa_return_status <> 'S' THEN
399 l_qa_eval_result := 'INSPECT';
400 END IF;
401
402 IF l_qa_eval_result = 'STANDARD' THEN
403 rcv_trx.routing_header_id := 1;
404 END IF;
405 END IF;
406 --Bugfix5213454 End: Called QA API after RTI record validation.
407
408 rcv_trx_interface_trx_upd_pkg.update_rcv_transaction (rcv_trx);
409
410 /*
411 ** If the row passes all validation then set the succeed
412 ** count appropriately
413 */
414
415 -- if (x_txn_from_web) then
416 -- rcv_express_sv.print_record (rcv_trx);
417 -- end if;
418
419 rows_succeeded := rows_succeeded + 1;
420
421 ELSE
422
423 if (x_txn_from_web) then
424
425
426 X_progress := 70;
427
428 --Bug 5230922. Changed the where clause. Previously it was matching
429 --po.interface_transaction_id = rcv_trx.interface_transaction_id
430 --that was wrong because rcv_trx.interface_transaction_id would be
431 --stored as interface_line_id in the table po_interface_errors
432 SELECT column_name, error_message_name
433 INTO x_column_name, x_message_name
434 FROM po_interface_errors po
435 WHERE po.interface_line_id = rcv_trx.interface_transaction_id; --Bug 5230922
436
437 /* Get the translated message for the
438 ** column that failed validation
439 */
440
441 X_message_text := fnd_message.get_string('PO',x_message_name);
442
443 --Bug#2869368.The error in htp call was causing error message not
444 --displayed on the browser for the receipt done through SSP.
445 --Added exception to handle this situation.
446 Begin
447 if (x_first_error) then
448 x_output_message := fnd_message.get_string('PO','RCV_CONFIRM_ERRORS');
449 htp.teletype(x_output_message);
450 htp.nl;
451 htp.teletype('=============================================================================');
452 htp.nl;
453 x_first_error := FALSE;
454 end if;
455
456 htp.teletype(x_column_name); htp.nl;
457 htp.teletype(x_message_text); htp.nl;
458 htp.teletype('------------'); htp.nl;
459
460 Exception
461 When others then null;
462 End;
463
464
465 end if;
466
467 /*
468 ** Bug 3438171 - Don't delete the transaction, update it.
469 ** If the transactions fails validation then update it
470 ** in the interface to error
471 */
472 rcv_trx.processing_status_code := 'COMPLETED';
473 rcv_trx.transaction_status_code := 'ERROR';
474 rcv_trx_interface_trx_upd_pkg.update_rcv_transaction (rcv_trx);
475
476
477 /*
478 ** If the row fails a validation step then set the failure
479 ** count appropriately
480 */
481 rows_failed := rows_failed + 1;
482
483 END IF;
484
485 END IF;
486
487 END LOOP;
488
489 X_rows_succeeded := rows_succeeded;
490 X_rows_failed := rows_failed;
491
492 /* Bug 4891693 fixed. deleting records from RTI which has quantity = 0 */
493 BEGIN
494 DELETE FROM rcv_transactions_interface
495 WHERE group_id = X_group_id
496 AND quantity = 0;
497 EXCEPTION
498 WHEN OTHERS THEN
499 NULL;
500 END;
501
502 RETURN;
503
504 EXCEPTION
505 WHEN OTHERS THEN
506 po_message_s.sql_error('val_express_transactions', X_progress, sqlcode);
507 RAISE;
508
509 END val_express_transactions;
510
511 /*===========================================================================
512
513 FUNCTION NAME: val_rcv_trx_interface
514
515 ===========================================================================*/
516
517 FUNCTION val_rcv_trx_interface (rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE,
518 X_txn_from_web IN BOOLEAN,--Bug 5855096
519 X_txn_from_wf IN BOOLEAN)--Bug 5855096
520 RETURN BOOLEAN IS
521
522 X_progress VARCHAR2(4) := '000';
523 under_lot_control BOOLEAN := FALSE;
524 under_serial_control BOOLEAN := FALSE;
525 valid_receiving_controls NUMBER := 0;
526 valid_deliver_dest NUMBER := 0;
527 valid_wip_info NUMBER :=0;
528 X_column_name VARCHAR2(30);
529 X_err_message VARCHAR2(240);
530 x_sob_id org_organization_definitions.set_of_books_id%type;
531 x_is_val_period BOOLEAN := FALSE; -- bug 626224
532 x_item_name VARCHAR2(50) := ''; --bug 2706571
533 x_stock_enabled_flag VARCHAR2(2) := ''; --bug 2706571
534 x_allow_express_delivery_flag VARCHAR2(2) := ''; --bug 5498095
535 l_transaction_type_id NUMBER;
536 BEGIN
537
538 /* Fix for Bug 5498095
539 If the item is not express allowed in the destination organization
540 for an inventory destination receipt then an error message will be
541 inserted into po_interface errors.
542 */
543
544 /* Bug: 5855096
545 We neeed to by pass the validation for allow_express_delivery flag
546 mentioned at item level for the transactions made through the
547 web page(iProcurement).
548 For the transactions made through iProcurement possible
549 transaction_types are 'CONFIRM RECEIPT' and 'CONFIRM RECEIPT(WF)'
550 and the variables X_txn_from_web or X_txn_from_wf set to TRUE.
551
552 Changed nvl(msi.allow_express_delivery_flag,'N') to
553 nvl(msi.allow_express_delivery_flag,'U'), to bypass the
554 allow_express_delivery flag validation if that flag value
555 is to NULL in the Master Items form.
556 */
557 if ( not(X_txn_from_web or X_txn_from_wf) ) then--Bug 5855096
558 if (nvl(rcv_trx.item_id,0) <> 0) then
559 select nvl(msi.allow_express_delivery_flag,'U') --Bug 5855096
560 into x_allow_express_delivery_flag
561 from mtl_system_items msi
562 where msi.inventory_item_id =rcv_trx.item_id
563 and msi.organization_id = rcv_trx.to_organization_id;
564
565 if x_allow_express_delivery_flag = 'N' then
566 X_column_name := 'ITEM_NUMBER: ' || x_item_name;
567 X_err_message := 'PO_RI_INVALID_EXPRESS_ITEM';
568
569 rcv_express_sv.insert_interface_errors(rcv_trx,
570 X_column_name,
571 X_err_message);
572 return FALSE;
573 end if;
574 end if; /* fix end for Bug 5498095 */
575 end if; /* fix end for Bug 5855096 */
576
577 /* Fix for bug 2706571
578 If the item is not stock enabled in the destination organization
579 for an inventory destination receipt then an error message will be
580 inserted into po_interface errors.
581 */
582
583 if ( (rcv_trx.destination_type_code = 'INVENTORY' or
584 (rcv_trx.source_document_code = 'RMA' and
585 (rcv_trx.transaction_type = 'DELIVER' or rcv_trx.auto_transact_code = 'DELIVER'))) and
586 nvl(rcv_trx.item_id,0) <> 0) then
587
588 select msi.segment1,
589 msi.stock_enabled_flag
590 into x_item_name,
591 x_stock_enabled_flag
592 from mtl_system_items msi
593 where msi.inventory_item_id = rcv_trx.item_id
594 and msi.organization_id = rcv_trx.to_organization_id;
595
596
597 if nvl(x_stock_enabled_flag,'N') = 'N' then
598
599 X_column_name := 'ITEM_NUMBER: ' || x_item_name;
600 X_err_message := 'PO_RI_INVALID_DEST_ORG_ITEM';
601
602 rcv_express_sv.insert_interface_errors(rcv_trx,
603 X_column_name,
604 X_err_message);
605
606 return FALSE;
607 end if;
608
609 end if; /* End of bug 2706571 */
610
611 if (rcv_trx.transaction_date > sysdate) then
612
613 X_column_name := 'TRANSACTION_DATE';
614 X_err_message := 'RCV_TRX_FUTURE_DATE_NA';
615
616 rcv_express_sv.insert_interface_errors(rcv_trx,
617 X_column_name,
618 X_err_message);
619
620 return FALSE;
621
622 end if;
623
624 --Perf bugfix 5220058
625 select GSOB.SET_OF_BOOKS_ID
626 into x_sob_id
627 from
628 GL_SETS_OF_BOOKS GSOB,
629 HR_ORGANIZATION_INFORMATION HOI
630 where
631 HOI.ORGANIZATION_ID = rcv_trx.to_organization_id
632 AND ( HOI.ORG_INFORMATION_CONTEXT || '') ='Accounting Information'
633 AND HOI.ORG_INFORMATION1 = TO_CHAR(GSOB.SET_OF_BOOKS_ID);
634
635 -- bug 626224 if period is not defined, just say it's not open
636
637 BEGIN
638 x_is_val_period := PO_DATES_S.val_open_period(rcv_trx.transaction_date,x_sob_id,'SQLGL',
639 rcv_trx.to_organization_id);
640 EXCEPTION
641 WHEN OTHERS THEN
642 x_is_val_period := FALSE;
643 END;
644
645 if (not x_is_val_period) then
646
647 X_column_name := 'TRANSACTION_DATE';
648 X_err_message := 'PO_PO_ENTER_OPEN_GL_DATE';
649
650 rcv_express_sv.insert_interface_errors(rcv_trx,
651 X_column_name,
652 X_err_message);
653
654 return FALSE;
655
656 end if;
657
658 BEGIN
659 x_is_val_period := PO_DATES_S.val_open_period(rcv_trx.transaction_date,x_sob_id,'INV',
660 rcv_trx.to_organization_id);
661 EXCEPTION
662 WHEN OTHERS THEN
663 x_is_val_period := FALSE;
664 END;
665
666 if (not x_is_val_period) then
667
668 X_column_name := 'TRANSACTION_DATE';
669 X_err_message := 'PO_INV_NO_OPEN_PERIOD';
670
671 rcv_express_sv.insert_interface_errors(rcv_trx,
672 X_column_name,
673 X_err_message);
674
675 return FALSE;
676 end if;
677
678 BEGIN
679 x_is_val_period := PO_DATES_S.val_open_period(rcv_trx.transaction_date,x_sob_id,'PO',
680 rcv_trx.to_organization_id);
681 EXCEPTION
682 WHEN OTHERS THEN
683 x_is_val_period := FALSE;
684 END;
685
686 if (not x_is_val_period) then
687
688 X_column_name := 'TRANSACTION_DATE';
689 X_err_message := 'PO_PO_ENTER_OPEN_GL_DATE';
690
691 rcv_express_sv.insert_interface_errors(rcv_trx,
692 X_column_name,
693 X_err_message);
694
695 return FALSE;
696 end if;
697
698 /*
699 ** Check for 0 transaction quantity. If it's 0 then fail and delete it.
700 */
701 /* Bug 4891693 fixed.
702 No need for validation of zero quantity RTI records since we
703 are deleting them down the line.
704
705 IF (rcv_trx.quantity = 0) THEN
706
707 X_column_name := 'QUANTITY';
708 X_err_message := 'PO_ALL_ENTER_VALUE_GT_ZERO';
709
710 rcv_express_sv.insert_interface_errors(rcv_trx,
711 X_column_name,
712 X_err_message);
713
714
715 return FALSE;
716
717 END IF;
718 */
719
720 /*
721 ** check for valid currency conversion rate. bug 4356092
722 */
723 IF (rcv_trx.currency_conversion_rate = fnd_api.g_miss_num) THEN
724 /*
725 ** Push the failed Row into the interface_errors table
726 ** so we can provide feedback to the user.
727 */
728 X_column_name := 'CURRENCY_CONVERSION_RATE';
729 X_err_message := 'PO_CPO_NO_RATE_FOR_DATE';
730
731 rcv_express_sv.insert_interface_errors(rcv_trx,
732 X_column_name,
733 X_err_message);
734
735
736 return FALSE;
737
738 END IF;
739
740
741 /*
742 ** Check for a receipt transaction. If it is then do all the validation
743 ** required to perform a receipt ncluding:
744 **
745 ** 1. Does the receipt match the receiving controls like date tolerances
746 ** 2. Does the receipt have the required revision value
747 ** 3. If this is an express receipt make sure there are no pending
748 ** transactions for this line.
749 */
750 IF (rcv_trx.transaction_type = 'RECEIVE') THEN
751 /*
752 ** Check the receiving controls for this transaction.
753 */
754 X_progress := '100';
755
756 -- htp.p ('validating receiving controls'); -- htp.nl;
757
758 valid_receiving_controls := rcv_transactions_sv.val_receiving_controls (
759 rcv_trx.transaction_type,
760 rcv_trx.auto_transact_code,
761 rcv_trx.expected_receipt_date,
762 rcv_trx.transaction_date,
763 rcv_trx.routing_header_id,
764 rcv_trx.po_line_location_id,
765 rcv_trx.item_id,
766 rcv_trx.vendor_id,
767 rcv_trx.to_organization_id);
768
769 if valid_receiving_controls<> 0 THEN
770
771 -- htp.p ('receiving controls validation failed'); -- htp.nl;
772
773 /*
774 ** Push the failed Row into the interface_errors table
775 ** so we can provide feedback to the user.The variable valid
776 ** _receiving_controls will hold a 1 if the receipt date
777 ** exceeded tolerance . It will have a value of 2 if the
778 ** routing information was incorrect.If the routing info
779 ** fails, the only way the user can receive is thru the
780 ** 10sc apps. We do not have Routing info as enterable fields
781 ** on the Receive Orders Web Page yet.
782 */
783 if valid_receiving_controls = 1 then
784 X_column_name := 'TRANSACTION_DATE';
785 X_err_message := 'RCV_ALL_DATE_OUT_OF_RANGE';
786 elsif valid_receiving_controls = 2 then
787 X_column_name := 'ROUTING_HEADER_ID';
788 X_err_message := 'RCV_ROUTING_OVERRIDE_NA';
789
790 /* Bug 3724862 : Error handling for dropship case */
791 elsif valid_receiving_controls = 3 then
792 X_column_name := 'ROUTING_HEADER_ID';
793 X_err_message := 'RCV_DROPSHIP_DIRECT_ONLY';
794 end if;
795
796 rcv_express_sv.insert_interface_errors(rcv_trx,
797 X_column_name,
798 X_err_message);
799
800 RETURN (FALSE);
801
802 END IF;
803
804 -- htp.p ('validating item rev controls'); -- htp.nl;
805 /*
806 ** Check that the item rev control matches is satisfied
807 */
808 X_progress := '110';
809 IF (NOT po_items_sv2.val_item_rev_controls (
810 rcv_trx.transaction_type,
811 rcv_trx.auto_transact_code,
812 rcv_trx.po_line_location_id,
813 rcv_trx.shipment_line_id,
814 rcv_trx.to_organization_id,
815 rcv_trx.destination_type_code,
816 rcv_trx.item_id,
817 rcv_trx.item_revision)) THEN
818
819 -- htp.p ('item rev controls validation'); -- htp.nl;
820
821 X_column_name := 'ITEM_REVISION';
822 X_err_message := 'RCV_ITEM_IN_REV_CONTROL';
823
824 rcv_express_sv.insert_interface_errors(rcv_trx,
825 X_column_name,
826 X_err_message);
827
828 RETURN (FALSE);
829
830 END IF;
831
832 /*
833 ** Bug 3417961 : Item revision needs to be validated for an Express Receipt
834 ** against an Internal Order, RMA and Inventory Inter Org Transfers.
835 */
836
837 IF ( rcv_trx.receipt_source_code IN ('INTERNAL ORDER','CUSTOMER','INVENTORY') ) THEN
838
839 DECLARE
840 l_valid_revision NUMBER := NULL;
841 l_item_rev_control NUMBER := NULL;
842 BEGIN
843
844 SELECT msi.revision_qty_control_code
845 INTO l_item_rev_control
846 FROM mtl_system_items_kfv msi
847 WHERE msi.inventory_item_id = rcv_trx.item_id
848 AND msi.organization_id = rcv_trx.to_organization_id;
849
850 IF ( nvl(l_item_rev_control,1) = 2 ) THEN
851
852 SELECT count(*)
853 INTO l_valid_revision
854 FROM mtl_item_revisions
855 WHERE inventory_item_id = rcv_trx.item_id
856 AND organization_id = rcv_trx.to_organization_id
857 AND revision = rcv_trx.item_revision;
858
859 IF ( l_valid_revision = 0 ) THEN
860
861 IF ( rcv_trx.receipt_source_code = 'CUSTOMER') THEN
862 X_column_name := 'ITEM_REVISION';
863 X_err_message := 'PO_RI_INVALID_ITEM_REVISION';
864 ELSE
865 X_column_name := 'ITEM_REVISION';
866 X_err_message := 'PO_RI_INVALID_DEST_REVISION';
867 END IF;
868
869 rcv_express_sv.insert_interface_errors(rcv_trx,
870 X_column_name,
871 X_err_message);
872
873 RETURN (FALSE);
874 END IF;
875 END IF;
876 END;
877 END IF; -- if receipt_source_code = 'INTERNAL ORDER'
878
879 /* End of Bug 3417961 */
880
881 IF (rcv_trx.auto_transact_code = 'RECEIVE') THEN
882
883 -- htp.p ('validating ship to location id'); -- htp.nl;
884 /*
885 ** If this is a express receipt then make sure
886 ** you have a ship_to_location_id
887 */
888 IF (rcv_trx.ship_to_location_id IS NULL OR
889 rcv_trx.ship_to_location_id = 0) THEN
890
891 X_column_name := 'SHIP_TO_LOCATION_ID';
892 X_err_message := 'RCV_SHIP_TO_LOC_NA';
893
894 rcv_express_sv.insert_interface_errors(rcv_trx,
895 X_column_name,
896 X_err_message);
897 RETURN FALSE;
898
899 END IF;
900
901 END IF; -- (rcv_trx.auto_transact_code = 'RECEIVE')
902
903 END IF; -- (rcv_trx.transaction_type = 'RECEIVE')
904
905 IF (rcv_trx.auto_transact_code = 'DELIVER' OR
906 rcv_trx.transaction_type = 'DELIVER') THEN
907
908 -- htp.p ('validating destination info : '); -- htp.nl;
909
910 /*
911 ** Check that the destination information is valid
912 */
913 X_progress := '130';
914 valid_deliver_dest := rcv_transactions_sv.val_deliver_destination (
915 rcv_trx.to_organization_id,
916 rcv_trx.item_id,
917 rcv_trx.destination_type_code,
918 rcv_trx.deliver_to_location_id,
919 rcv_trx.subinventory);
920
921 -- htp.p ('The var Valid_Deliver_dest is :' || to_char(valid_deliver_dest)); -- htp.nl;
922 IF valid_deliver_dest <> 0 THEN
923
924 -- htp.p ('destination info validation failed: '); -- htp.nl;
925
926 if valid_deliver_dest = 10 then
927
928 /* The Destination Org is not defined */
929
930 X_column_name := 'TO_ORGANIZATION_ID';
931 X_err_message := 'RCV_DEST_ORG_NA';
932
933 elsif valid_deliver_dest = 20 then
934
935 /* The Deliver To Location is not defined */
936
937 X_column_name := 'DELIVER_TO_LOCATION_ID';
938 X_err_message := 'RCV_DELIVER_TO_LOC_NA';
939
940 elsif valid_deliver_dest = 30 then
941
942 /* The deliver to Location is invalid */
943
944 X_column_name := 'DELIVER_TO_LOCATION_ID';
945 X_err_message := 'RCV_DELIVER_TO_LOC_INVALID';
946
947 elsif valid_deliver_dest = 40 then
948
949 /* The Sub is not defined */
950
951 X_column_name := 'DESTINATION_SUBINVENTORY';
952 X_err_message := 'RCV_DEST_SUB_NA';
953
954 elsif valid_deliver_dest = 50 then
955
956 /* The Sub is invalid */
957 X_column_name := 'DESTINATION_SUBINVENTORY';
958 X_err_message := 'RCV_DEST_SUB_INVALID';
959
960 elsif valid_deliver_dest = 60 then
961
962 /* Destination Type Code is Invalid */
963 X_column_name := 'DESTINATION_TYPE_CODE';
964 X_err_message := 'RCV_DEST_TYPE_CODE_INVALID';
965
966 end if;
967 rcv_express_sv.insert_interface_errors(rcv_trx,
968 X_column_name,
969 X_err_message);
970 RETURN (FALSE);
971
972 END IF;
973
974
975 /*
976 ** The required info for inventory is the
977 ** subinventory, and locator and that the item not be under
978 ** lot or serial control
979 */
980 /*
981 ** Check if an item/org is under lot and/or
982 ** serial control.
983 */
984 X_progress := '140';
985
986
987 /* Bug# 2166549.We should not validate for expense items which are
988 * lot/serial controlled even when express functionality is used.
989 */
990
991 IF (rcv_trx.destination_type_code <> 'EXPENSE') THEN
992
993 IF rcv_trx.use_mtl_lot in (2, 5) THEN
994
995 -- htp.p ('lot control validation failed: '); -- htp.nl;
996 X_column_name := 'USE_MTL_LOT';
997 X_err_message := 'RCV_MTL_LOT_CONTROL_FAIL';
998 rcv_express_sv.insert_interface_errors(rcv_trx,
999 X_column_name,
1000 X_err_message);
1001 RETURN (FALSE);
1002
1003 END IF;
1004
1005 END IF;
1006
1007
1008 IF (rcv_trx.destination_type_code <> 'EXPENSE') THEN
1009
1010 IF rcv_trx.use_mtl_serial in (2, 5) THEN
1011
1012 -- htp.p ('serial control validation failed: '); -- htp.nl;
1013 X_column_name := 'USE_MTL_SERIAL';
1014 X_err_message := 'RCV_MTL_SERIAL_CONTROL_FAIL';
1015 rcv_express_sv.insert_interface_errors(rcv_trx,
1016 X_column_name,
1017 X_err_message);
1018
1019 RETURN (FALSE);
1020
1021 END IF;
1022
1023 END IF;
1024
1025 -- htp.p ('validating locator control : '); -- htp.nl;
1026
1027 /*
1028 ** Check that a locator is not required for this transaction since a user
1029 ** would never have the opportunity to enter one. The only way a
1030 ** delivery to an inventory destination could work is if a default
1031 ** locator was defined for the subinventory
1032 */
1033 IF (rcv_trx.destination_type_code = 'INVENTORY') THEN
1034
1035 X_progress := '150';
1036 IF (NOT po_subinventories_s.val_locator_control (
1037 rcv_trx.to_organization_id,
1038 rcv_trx.item_id,
1039 rcv_trx.subinventory,
1040 rcv_trx.locator_id)) THEN
1041
1042 X_column_name := 'LOCATOR_ID';
1043 X_err_message := 'RCV_LOCATOR_CONTROL_INVALID';
1044 rcv_express_sv.insert_interface_errors(rcv_trx,
1045 X_column_name,
1046 X_err_message);
1047
1048 -- htp.p ('locator control validation failed: '); -- htp.nl;
1049
1050 RETURN (FALSE);
1051
1052 END IF;
1053
1054 ELSE
1055
1056 /* BUG: 5435353
1057 ** Mark the locator id as null if it is not an inventory transaction
1058 */
1059 rcv_trx.locator_id := NULL;
1060
1061 END IF;
1062
1063 -- htp.p ('validating wip info : '); -- htp.nl;
1064
1065 /*
1066 ** if this is a shop floor destination then make sure that the job
1067 ** information is still valid
1068 */
1069 IF (rcv_trx.destination_type_code = 'SHOP FLOOR') THEN
1070
1071 X_progress := '160';
1072
1073 valid_wip_info := rcv_transactions_sv.val_wip_info (
1074 rcv_trx.to_organization_id,
1075 rcv_trx.wip_entity_id,
1076 rcv_trx.wip_operation_seq_num,
1077 rcv_trx.wip_resource_seq_num,
1078 rcv_trx.wip_line_id,
1079 rcv_trx.wip_repetitive_schedule_id,
1080 rcv_trx.po_line_id); -- bug 2619164
1081
1082 IF (valid_wip_info <> 0) THEN
1083
1084 if valid_wip_info = 10 then
1085
1086 X_column_name := 'TO_ORGANIZATION_ID';
1087 X_err_message := 'RCV_DEST_ORG_NA';
1088
1089 elsif valid_wip_info = 20 then
1090
1091 X_column_name := 'WIP_ENTITY_ID';
1092 X_err_message := 'RCV_WIP_ENTITY_ID_NA';
1093
1094 elsif valid_wip_info = 30 then
1095
1096 X_column_name := 'WIP_OP_SEQ_NUM';
1097 X_err_message := 'RCV_WIP_OP_SEQ_NUM_NA';
1098
1099 elsif valid_wip_info = 40 then
1100
1101 X_column_name := 'WIP_RES_SEQ_NUM';
1102 X_err_message := 'RCV_WIP_RES_SEQ_NUM_NA';
1103
1104 elsif valid_wip_info = 50 then
1105
1106 X_column_name := 'WIP_REPETITIVE_SCHEDULE_ID';
1107 X_err_message := 'RCV_WIP_REP_SCH_JOB_NOT_OPEN';
1108
1109 elsif valid_wip_info = 60 then
1110
1111 X_column_name := '_WIP_ENTITY_ID';
1112 X_err_message := 'RCV_WIP_JOB_NOT_OPEN';
1113
1114 end if;
1115
1116 rcv_express_sv.insert_interface_errors(rcv_trx,
1117 X_column_name,
1118 X_err_message);
1119
1120 -- htp.p ('wip info validation failed : '); -- htp.nl;
1121
1122 RETURN (FALSE);
1123
1124 END IF;
1125
1126 END IF;
1127
1128 /*
1129 ** DEBUG: This needs to be moved out of this function since it's not
1130 ** generic unless we want to pass this function an express flag and
1131 ** then only execute this check if its express.
1132 ** If you're doing an express direct/deliver then make sure that there
1133 ** are no receipts that have not been delivered. Otherwise we
1134 ** won't be able to distribute them properly.
1135 */
1136
1137 -- htp.p ('validating pending delivery transactions'); -- htp.nl;
1138
1139 /*
1140 ** If this is a receipt transaction. Then check that there are is no
1141 ** receipt supply for this line location
1142 **
1143 */
1144 IF (rcv_trx.source_document_code = 'PO' AND
1145 (rcv_trx.transaction_type = 'RECEIVE' OR
1146 rcv_trx.auto_transact_code = 'RECEIVE')) THEN
1147
1148 X_progress := '120';
1149 IF (NOT rcv_transactions_sv.val_pending_receipt_trx (
1150 rcv_trx.po_line_location_id,
1151 rcv_trx.group_id)) THEN
1152
1153 X_column_name := 'PO_LINE_LOCATION_ID';
1154 X_err_message := 'RCV_PENDING_DELIVERY_FAILED';--bug8663187
1155 rcv_express_sv.insert_interface_errors(rcv_trx,
1156 X_column_name,
1157 X_err_message);
1158 -- htp.p ('pending delivery transactions validation failed'); -- htp.nl;
1159
1160 RETURN (FALSE);
1161
1162 END IF; -- (NOT rcv_transactions_sv.val_pending_transactions)
1163
1164 END IF; -- (rcv_trx.source_document_code = 'PO')
1165
1166 END IF; -- (rcv_trx.auto_transact_code = 'DELIVER' ...)
1167
1168 -- Bug 10253000 : Validate material status on subinventory and locator level
1169 IF (rcv_trx.destination_type_code = 'INVENTORY' AND
1170 (rcv_trx.auto_transact_code = 'DELIVER' OR
1171 rcv_trx.transaction_type = 'DELIVER') ) THEN
1172
1173 X_progress := '170';
1174
1175 IF rcv_trx.receipt_source_code = 'VENDOR' THEN
1176 l_transaction_type_id := 18;
1177
1178 ELSIF rcv_trx.receipt_source_code = 'INVENTORY' THEN
1179 l_transaction_type_id := 12;
1180
1181 ELSIF rcv_trx.receipt_source_code = 'INTERNAL ORDER' THEN
1182 l_transaction_type_id := 61;
1183
1184 ELSIF rcv_trx.receipt_source_code = 'CUSTOMER' THEN
1185 l_transaction_type_id := 15;
1186
1187 ELSE
1188 l_transaction_type_id := -99;
1189 END IF;
1190
1191 IF( inv_material_status_grp.is_status_applicable(NULL,
1192 NULL,
1193 l_transaction_type_id,
1194 NULL,
1195 NULL,
1196 rcv_trx.to_organization_id,
1197 NULL,
1198 rcv_trx.subinventory,
1199 NULL,
1200 NULL,
1201 NULL,
1202 'Z') <> 'Y') THEN
1203
1204 X_column_name := 'SUBINVENTORY';
1205 X_err_message := 'RCV_DEST_SUB_INVALID';
1206 rcv_express_sv.insert_interface_errors(rcv_trx,
1207 X_column_name,
1208 X_err_message);
1209 RETURN (FALSE);
1210 END IF;
1211
1212 IF( inv_material_status_grp.is_status_applicable(NULL,
1213 NULL,
1214 l_transaction_type_id,
1215 NULL,
1216 NULL,
1217 rcv_trx.to_organization_id,
1218 NULL,
1219 NULL,
1220 rcv_trx.locator_id,
1221 NULL,
1222 NULL,
1223 'L') <> 'Y') THEN
1224 X_column_name := 'LOCATOR_ID';
1225 X_err_message := 'RCV_ALL_INVALID_LOCATOR';
1226 rcv_express_sv.insert_interface_errors(rcv_trx,
1227 X_column_name,
1228 X_err_message);
1229 RETURN (FALSE);
1230 END IF;
1231
1232 END IF;
1233 -- Bug 10253000: End
1234
1235 RETURN TRUE;
1236
1237 EXCEPTION
1238 WHEN OTHERS THEN
1239 po_message_s.sql_error('val_rcv_trx_interface', x_progress, sqlcode);
1240 RAISE;
1241
1242 END val_rcv_trx_interface;
1243
1244 /*===========================================================================
1245
1246 PROCEDURE NAME: set_trx_defaults
1247
1248 ===========================================================================*/
1249
1250 PROCEDURE set_trx_defaults (
1251 rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE)
1252 IS
1253
1254 inventory_receipt BOOLEAN := FALSE;
1255 item_rev_exists BOOLEAN := FALSE;
1256 X_item_rev_control NUMBER := 1;
1257 X_sysdate DATE;
1258 locator_control NUMBER := 0;
1259 X_parent_id NUMBER := 0;
1260 X_tolerable_quantity NUMBER := 0;
1261 X_transaction_type VARCHAR2(30) := NULL;
1262 X_uom VARCHAR2(30) := NULL;
1263 X_receipt_source_code VARCHAR2(30) := NULL;
1264 X_available_quantity NUMBER := 0;
1265 X_progress VARCHAR2(4) := '000';
1266 x_default_subinventory VARCHAR2(10);
1267 X_default_locator_id NUMBER;
1268 X_SUCCESS BOOLEAN := FALSE;
1269 X_txn_from_web BOOLEAN := FALSE;
1270 X_txn_from_wf BOOLEAN := FALSE;
1271 /*Bug 2869806 */
1272 x_dist_avail_qty NUMBER := 0;
1273 x_dist_tol_qty NUMBER := 0;
1274 x_dist_uom VARCHAR2(30) := NULL;
1275 x_distribution_id NUMBER := 0;
1276 x_dist_qty_in_trx_uom NUMBER := 0;
1277 x_dist_count NUMBER := 0;
1278 x_ship_qty_in_trx_uom NUMBER := 0;
1279 x_trx_uom VARCHAR2(30) := NULL;
1280 /*Bug 1548597 */
1281 X_secondary_available_qty NUMBER := 0;
1282 /* Bug# 2834411 */
1283 x_project_id NUMBER;
1284 x_task_id NUMBER;
1285 /* bug 2994421 */
1286 x_uom_code VARCHAR2(5) := NULL;
1287 /* Bug 9048393 */
1288 x_locator_id NUMBER;
1289 l_project_locator_id number;
1290 l_locator_id number;
1291
1292 l_mp_lcm_flag mtl_parameters.lcm_enabled_flag%TYPE; -- Bug 9575796
1293 l_pre_receive_flag rcv_parameters.pre_receive%TYPE; -- Bug 9575796
1294 l_pll_lcm_flag po_line_locations_all.lcm_flag%TYPE; -- Bug 9575796
1295
1296 BEGIN
1297
1298 /*
1299 ** Set the transaction type and the auto transact code and the
1300 ** quantity
1301 */
1302 IF (rcv_trx.transaction_type = 'EXPRESS RECEIPT') THEN
1303
1304 rcv_trx.transaction_type := 'RECEIVE';
1305 rcv_trx.auto_transact_code := 'RECEIVE';
1306
1307 ELSIF (rcv_trx.transaction_type = 'EXPRESS DIRECT') THEN
1308
1309 rcv_trx.transaction_type := 'RECEIVE';
1310 rcv_trx.auto_transact_code := 'DELIVER';
1311
1312 ELSIF (rcv_trx.transaction_type = 'EXPRESS DELIVER') THEN
1313
1314 rcv_trx.transaction_type := 'DELIVER';
1315 rcv_trx.auto_transact_code := '';
1316
1317 ELSIF (rcv_trx.transaction_type = 'CONFIRM RECEIPT') THEN
1318
1319 rcv_trx.transaction_type := 'RECEIVE';
1320 rcv_trx.auto_transact_code := 'DELIVER';
1321 X_txn_from_web := TRUE;
1322
1323 ELSIF (rcv_trx.transaction_type = 'CONFIRM RECEIPT(WF)') THEN
1324
1325 rcv_trx.transaction_type := 'RECEIVE';
1326 rcv_trx.auto_transact_code := 'DELIVER';
1327 X_txn_from_web := FALSE;
1328
1329 -- bug 513848
1330 X_txn_from_wf := TRUE;
1331
1332 END IF;
1333
1334 /*
1335 ** Set the status of the record to pending
1336 */
1337 -- Bug 9575796 : Start
1338 IF (rcv_trx.source_document_code = 'PO' and rcv_trx.po_line_location_id is not null) THEN
1339 SELECT nvl(mp.lcm_enabled_flag,'N'), nvl(rp.pre_receive,'N'),nvl(pll.lcm_flag,'N')
1340 INTO l_mp_lcm_flag, l_pre_receive_flag, l_pll_lcm_flag
1341 FROM po_line_locations_all pll,
1342 mtl_parameters mp,
1343 rcv_parameters rp
1344 WHERE pll.line_location_id = rcv_trx.po_line_location_id
1345 AND mp.organization_id = rcv_trx.to_organization_id
1346 AND mp.organization_id = rp.organization_id;
1347 END IF;
1348
1349 IF (l_mp_lcm_flag = 'Y' and l_pre_receive_flag = 'N' and l_pll_lcm_flag = 'Y' and rcv_trx.lcm_shipment_line_id IS NULL) THEN
1350 rcv_trx.processing_status_code := 'LC_PENDING';
1351 rcv_trx.processing_mode_code := 'BATCH';
1352 ELSE
1353 rcv_trx.processing_status_code := 'PENDING';
1354 END IF;
1355 -- Bug 9575796: End
1356
1357 rcv_trx.transaction_status_code := 'PENDING';
1358
1359 /*
1360 ** Set the default item rev if one is not set on the transaction
1361 */
1362 inventory_receipt := rcv_transactions_sv.val_if_inventory_destination (
1363 rcv_trx.po_line_location_id, rcv_trx.shipment_line_id);
1364
1365 /*
1366 ** If this is has an inventory destination and there is not item rev
1367 ** specified and it's under item rev control then try to go get the
1368 ** latest implemented item rev
1369 */
1370 IF (inventory_receipt AND
1371 rcv_trx.item_id IS NOT NULL AND
1372 rcv_trx.item_revision IS NULL) THEN
1373
1374 X_progress := 400;
1375
1376 SELECT msi.revision_qty_control_code
1377 INTO X_item_rev_control
1378 FROM mtl_system_items_kfv msi
1379 WHERE rcv_trx.item_id = msi.inventory_item_id
1380 AND rcv_trx.to_organization_id = msi.organization_id;
1381
1382 /*
1383 ** If this item is under rev control which is the code 2
1384 ** then go get the latest implemented version
1385 */
1386 IF (X_item_rev_control = 2 AND rcv_trx.item_revision IS NULL) THEN
1387
1388 X_progress := 410;
1389 po_items_sv2.get_latest_item_rev (rcv_trx.item_id,
1390 rcv_trx.to_organization_id,
1391 rcv_trx.item_revision,
1392 item_rev_exists);
1393 END IF;
1394
1395 END IF; -- (inventory_receipt ...)
1396
1397 X_receipt_source_code := rcv_trx.receipt_source_code;
1398 /*
1399 ** Get the available transaction quantity for this receipt
1400 */
1401 IF (rcv_trx.transaction_type = 'RECEIVE' AND
1402 rcv_trx.auto_transact_code = 'RECEIVE') THEN
1403
1404 /*
1405 ** If this is a vendor receipt then the parent id is the line
1406 ** location id otherwise its an internal shipment so the parent
1407 ** id is the shipment_line_id.
1408 */
1409 IF (rcv_trx.receipt_source_code = 'VENDOR') THEN
1410 X_parent_id := rcv_trx.po_line_location_id;
1411
1412 /*
1413 ** If this is an asn then we need to override the parameters to the
1414 ** get_available call in this case.
1415 */
1416 ELSIF (rcv_trx.receipt_source_code in ('ASN','LCM')) THEN -- lcm changes
1417
1418 X_parent_id := rcv_trx.shipment_line_id;
1419 X_transaction_type := 'RECEIVE';
1420 X_receipt_source_code := 'INVENTORY';
1421
1422 ELSE
1423
1424 X_parent_id := rcv_trx.shipment_line_id;
1425
1426 END IF;
1427
1428 X_transaction_type := 'RECEIVE';
1429
1430 X_progress := '1100';
1431
1432 /*Bug 1548597 */
1433
1434 rcv_quantities_s.get_available_quantity (
1435 X_transaction_type, X_parent_id,
1436 X_receipt_source_code, NULL, 0, NULL, X_available_quantity,
1437 X_tolerable_quantity, X_uom,X_secondary_available_qty);
1438
1439
1440 ELSIF (rcv_trx.transaction_type = 'RECEIVE' AND
1441 rcv_trx.auto_transact_code = 'DELIVER')THEN
1442
1443 /*
1444 ** If this is a vendor receipt then the parent id is the line
1445 ** location id otherwise its an internal shipment so the parent
1446 ** id is the shipment_line_id.
1447 */
1448 IF (rcv_trx.receipt_source_code = 'VENDOR') THEN
1449
1450 X_parent_id := rcv_trx.po_distribution_id;
1451 X_transaction_type := 'DIRECT RECEIPT';
1452
1453 /*
1454 ** If the shipment_line_id is populated then this must be sourced
1455 ** from an asn. We need to override the parameters to the get_available
1456 ** call in this case.
1457 */
1458 ELSIF (rcv_trx.receipt_source_code in ('ASN','LCM')) THEN -- lcm changes
1459
1460
1461 /* Bug 2869806 - Added the following piece of code to get the available
1462 distribution qty if the distribution id is populated.We are also
1463 getting the count(po_distribution_id) to check if this is the last
1464 distribution. When doing a express delivery on an overshipped ASN
1465 we need to allocate the excess qty only to the last distribution.
1466 If the following select returns one then this is the last distribution
1467 and the excess quantity should be allocated against this distribution.
1468 */
1469
1470 select count(po_distribution_id)
1471 into x_dist_count
1472 from rcv_transactions_interface
1473 where transaction_type = 'EXPRESS DIRECT'
1474 and po_line_location_id = rcv_trx.po_line_location_id
1475 and shipment_line_id = rcv_trx.shipment_line_id;
1476
1477
1478 if (rcv_trx.po_distribution_id is not null) then
1479
1480 x_distribution_id := rcv_trx.po_distribution_id;
1481 x_transaction_type := 'DIRECT RECEIPT';
1482
1483 rcv_quantities_s.get_available_quantity (
1484 X_transaction_type, x_distribution_id,
1485 X_receipt_source_code, NULL, 0, NULL, x_dist_avail_qty,
1486 x_dist_tol_qty, x_dist_uom,X_secondary_available_qty);
1487
1488
1489 end if;
1490
1491
1492 X_parent_id := rcv_trx.shipment_line_id;
1493 X_transaction_type := 'RECEIVE';
1494 X_receipt_source_code := 'INVENTORY';
1495
1496
1497 ELSE
1498
1499 X_parent_id := rcv_trx.shipment_line_id;
1500 X_transaction_type := 'RECEIVE';
1501
1502 END IF;
1503
1504 X_progress := '1100';
1505
1506 /*Bug 1548597 */
1507 rcv_quantities_s.get_available_quantity (
1508 X_transaction_type, X_parent_id,
1509 X_receipt_source_code, NULL, 0, NULL, X_available_quantity,
1510 X_tolerable_quantity, X_uom,X_secondary_available_qty);
1511
1512 /*
1513 ** If this is a delivery then you need to give the parent transaction
1514 ** id as the the parent id
1515 */
1516 ELSIF (rcv_trx.transaction_type = 'DELIVER') THEN
1517
1518
1519 /* Chk avaliable qty and UOM for the distribution transaction */
1520 /*Bug 1548597 */
1521
1522 IF (rcv_trx.receipt_source_code = 'VENDOR') THEN
1523
1524 /* Bug 7040004 */
1525 /* Call this API only when receipt_source_code is Vendor */
1526 /* Donot calculate the available quantity in case of internal orders and inter-org transfers */
1527
1528 rcv_quantities_s.get_available_quantity ('STANDARD DELIVER',
1529 rcv_trx.po_distribution_id,
1530 null,
1531 null,
1532 rcv_trx.parent_transaction_id,
1533 null,
1534 X_available_quantity,
1535 X_tolerable_quantity, X_uom,X_secondary_available_qty);
1536 ELSE
1537
1538 /*
1539 ** start of bug 14001648
1540 ** X_available_quantity := rcv_trx.quantity;
1541 ** X_tolerable_quantity := rcv_trx.quantity;
1542 ** X_uom := rcv_trx.unit_of_measure;
1543 ** X_secondary_available_qty:=rcv_trx.secondary_quantity;
1544 ** end of bug 14001648
1545 */
1546
1547 /*
1548 ** start of bug 14001648:pass parameters 'DELIVER' and 'rcv_trx.parent_transaction_id' to
1549 ** rcv_quantities_s.get_available_quantity,so that procedure get_transaction_quantity in
1550 ** package rcv_quantities_s is called finally to get the quantity
1551 */
1552 rcv_quantities_s.get_available_quantity ('DELIVER',
1553 rcv_trx.parent_transaction_id,
1554 null,
1555 null,
1556 0,
1557 null,
1558 X_available_quantity,
1559 X_tolerable_quantity, X_uom,X_secondary_available_qty);
1560 /*end of bug 14001648*/
1561
1562 END IF;
1563
1564 /* End bug 7040004 */
1565
1566 ELSE
1567 null;
1568 -- htp.p ('ERROR: Invalid transaction type' || rcv_trx.receipt_source_code); htp.nl;
1569
1570 END IF;
1571
1572
1573 -- htp.p ('set_trx_defaults : available quantity = ' || TO_CHAR(X_available_quantity)); htp.nl;
1574 -- htp.p ('set_trx_defaults : transaction status code = ' || rcv_trx.transaction_status_code); htp.nl;
1575 /*
1576 ** Set the transactions quantity to the quantity available to transact
1577 ** only if the transaction_status_code is not CONFIRM.
1578 ** If the order is received via the Receive Orders Page on the Web,
1579 ** we set the variable X_txn_from_web to TRUE in the beg. of this procedure.
1580 */
1581
1582 -- bug 513848
1583 -- Do not set the transactions quantity if it is from Confirm Receipt
1584 -- Web page or Workflow
1585
1586 if X_txn_from_web or
1587 X_txn_from_wf then
1588 NULL;
1589 else
1590 rcv_trx.quantity := X_available_quantity;
1591 end if;
1592
1593
1594 /* Bug 3927688.
1595 Passing ASN uom to RTI record for ASN Express Receipt.
1596 */
1597 IF (rcv_trx.transaction_type = 'RECEIVE' AND
1598 rcv_trx.auto_transact_code = 'RECEIVE' AND
1599 rcv_trx.receipt_source_code in ('ASN','LCM'))THEN -- lcm changes
1600
1601 rcv_trx.unit_of_measure := x_uom;
1602
1603 END IF;
1604
1605
1606 /* Bug 2869806 As we have the available qty from ASN,available qunatity from
1607 the distribution and distribtion count we allocate the available qty
1608 from the distribution as transaction qty.*/
1609
1610
1611
1612 IF (rcv_trx.transaction_type = 'RECEIVE' AND
1613 rcv_trx.auto_transact_code = 'DELIVER' AND
1614 rcv_trx.receipt_source_code in ('ASN','LCM'))THEN -- lcm changes
1615
1616 x_trx_uom := x_uom; --3927688
1617
1618 if (x_dist_uom <> x_trx_uom) then
1619
1620 po_uom_s.uom_convert(x_dist_avail_qty, x_dist_uom, rcv_trx.item_id,
1621 x_trx_uom, x_dist_qty_in_trx_uom);
1622
1623 else
1624
1625 x_dist_qty_in_trx_uom := x_dist_avail_qty;
1626
1627 end if;
1628
1629
1630 if(x_uom <> x_trx_uom ) then
1631
1632 po_uom_s.uom_convert(x_available_quantity, x_uom, rcv_trx.item_id,
1633 x_trx_uom, x_ship_qty_in_trx_uom);
1634
1635 else
1636
1637 x_ship_qty_in_trx_uom := x_available_quantity;
1638
1639 end if;
1640
1641
1642
1643 if (rcv_trx.po_distribution_id is not null) then
1644
1645 if((x_ship_qty_in_trx_uom > x_dist_qty_in_trx_uom) and
1646 (x_dist_count > 1)) then
1647
1648 rcv_trx.quantity := x_dist_qty_in_trx_uom;
1649 rcv_trx.unit_of_measure := x_trx_uom; --3927688
1650 else
1651 rcv_trx.quantity := x_ship_qty_in_trx_uom;
1652 rcv_trx.unit_of_measure := x_trx_uom; --3927688
1653
1654 end if;
1655
1656 end if;
1657
1658 END IF;
1659
1660 --It is required to move the bugfix of 2994421 to this
1661 --location after the bugfix of 3927688 to populate the
1662 --correct uom_code in RTI.
1663
1664 /* Fix for bug 2994421.
1665 Populating uom_code into rti. Uom_code is required
1666 for receipts done against drop ship POs as this is
1667 used at the time of Sales Order Issue transaction.
1668 */
1669
1670 if (rcv_trx.uom_code is null) then
1671
1672 select uom_code
1673 into x_uom_code
1674 from mtl_units_of_measure
1675 where unit_of_measure = rcv_trx.unit_of_measure;
1676
1677 rcv_trx.uom_code := x_uom_code;
1678
1679 end if;
1680 -- htp.p ('set_trx_defaults : rcv_trx.quantity = ' || TO_CHAR(rcv_trx.quantity)); htp.nl;
1681
1682 IF (rcv_trx.destination_type_code = 'INVENTORY' AND
1683 (rcv_trx.auto_transact_code = 'DELIVER' OR
1684 rcv_trx.transaction_type = 'DELIVER')) THEN
1685
1686 /*
1687 ** A subinventory must have been defined on the po or a default
1688 ** must be available for the item. If it's not already defined
1689 ** then go get it out of inventory. If you're using express
1690 ** then it's ok to get the default rather than having it be
1691 ** defined on the record
1692 */
1693 IF (rcv_trx.subinventory IS NULL) THEN
1694
1695 /*
1696 ** If you're using express then it's ok to get the default
1697 ** rather than having it be defined on the record
1698 */
1699 X_progress := '1200';
1700 po_subinventories_s.get_default_subinventory (
1701 rcv_trx.to_organization_id,
1702 rcv_trx.item_id,
1703 rcv_trx.subinventory);
1704
1705 END IF; -- (rcv_trx.subinventory IS NULL)
1706
1707 /*
1708 ** See if org/sub/item is under locator control. If the sub is
1709 ** not available then don't do this call since it won't matter
1710 ** because the row will fail without a sub
1711 */
1712 IF (rcv_trx.subinventory IS NOT NULL) THEN
1713
1714 X_progress := '1220';
1715 po_subinventories_s.get_locator_control
1716 (rcv_trx.to_organization_id,
1717 rcv_trx.subinventory,
1718 rcv_trx.item_id,
1719 locator_control);
1720
1721 /*
1722 ** If locator control is 2 which means it is under predefined
1723 ** locator contol or 3 which means it's under dynamic (any value)
1724 ** locator control then you need to go get the default locator id
1725 */
1726 IF (locator_control = 2 OR locator_control = 3) THEN
1727
1728 X_progress := '1230';
1729
1730 /* Bug 9048393 - get locator_id from shipment */
1731 IF ( rcv_trx.source_document_code = 'INVENTORY') THEN
1732 select locator_id
1733 into x_locator_id
1734 from rcv_shipment_lines
1735 where shipment_line_id = rcv_trx.shipment_line_id;
1736
1737 rcv_trx.locator_id := x_locator_id;
1738 END IF;
1739
1740 IF (rcv_trx.locator_id IS NULL) THEN -- Bug 9048393 only locator_id is null then set default value
1741 po_subinventories_s.get_default_locator (
1742 rcv_trx.to_organization_id,
1743 rcv_trx.item_id,
1744 rcv_trx.subinventory,
1745 rcv_trx.locator_id);
1746 END IF;
1747
1748 /* Bug# 2834411 - Added the following logic to default the
1749 project_id and task_id */
1750 IF (rcv_trx.receipt_source_code <> 'CUSTOMER') THEN
1751
1752 IF (rcv_trx.po_distribution_id IS NOT NULL AND
1753 rcv_trx.locator_id IS NOT NULL) THEN
1754
1755 SELECT project_id, task_id
1756 INTO x_project_id, x_task_id
1757 FROM po_distributions
1758 WHERE po_distribution_id = rcv_trx.po_distribution_id;
1759
1760 ELSIF (rcv_trx.requisition_line_id is not null and
1761 rcv_trx.locator_id is not null) then
1762
1763 SELECT project_id, task_id
1764 INTO x_project_id,x_task_id
1765 FROM po_req_distributions
1766 WHERE requisition_line_id = rcv_trx.requisition_line_id;
1767
1768 END IF;
1769
1770 IF (x_project_id IS NOT NULL) THEN
1771 begin
1772 l_locator_id := rcv_trx.locator_id;
1773
1774 PJM_PROJECT_LOCATOR.Get_DefaultProjectLocator(
1775 rcv_trx.to_organization_id,
1776 l_locator_id,
1777 x_project_id,
1778 x_task_id,
1779 l_project_locator_id);
1780
1781 if(l_project_locator_id is not null ) then
1782 rcv_trx.locator_id :=l_project_locator_id ;
1783 end if;
1784 exception
1785 when others then null;
1786 end;
1787
1788 END IF;
1789
1790 END IF;
1791 /* Bug# 2834411 - End */
1792
1793 END IF;
1794
1795
1796 END IF;
1797
1798 END IF; -- (rcv_trx.destination_type_code = 'INVENTORY' AND...)
1799
1800 /*
1801 ** DEBUG: If this is an express direct then check the quantity left
1802 ** on the receipt against what you are attempting to deliver and
1803 ** see if there is enough to deliver. If not, takes what's left
1804 ** and then terminate the loop up above on the distributions.
1805 ** The problem here is that I could have over received a distribution
1806 ** in an earlier manual transaction so we can't assume we can deliver
1807 ** what's on the distribution. Need to modify Sanjay's get quantity
1808 ** routines to perform this function.
1809 */
1810
1811 /*
1812 ** Set all the quantity information.
1813 ** You must also set the primary_quantity and uom properly
1814 */
1815
1816 X_progress := '900';
1817
1818 RCV_QUANTITIES_S.get_primary_qty_uom (
1819 rcv_trx.quantity,
1820 rcv_trx.unit_of_measure,
1821 rcv_trx.item_id,
1822 rcv_trx.to_organization_id,
1823 rcv_trx.primary_quantity,
1824 rcv_trx.primary_unit_of_measure);
1825
1826 /*
1827 ** Override the receipt_source_code if it is set to ASN
1828 */
1829 IF (rcv_trx.receipt_source_code in ('ASN','LCM'))THEN -- lcm changes
1830
1831 rcv_trx.receipt_source_code := 'VENDOR';
1832
1833 END IF;
1834
1835 IF (rcv_trx.destination_type_code = 'INVENTORY' AND
1836 (rcv_trx.auto_transact_code = 'DELIVER' OR
1837 rcv_trx.transaction_type = 'DELIVER')) THEN
1838
1839 X_default_subinventory := rcv_trx.subinventory;
1840 X_default_locator_id := rcv_trx.locator_id;
1841
1842 /*
1843 ** Call the put away function
1844 */
1845 X_success := rcv_sub_locator_sv.put_away_api (
1846 rcv_trx.po_line_location_id,
1847 rcv_trx.po_distribution_id,
1848 rcv_trx.shipment_line_id,
1849 rcv_trx.receipt_source_code ,
1850 rcv_trx.from_organization_id,
1851 rcv_trx.to_organization_id,
1852 rcv_trx.item_id,
1853 rcv_trx.item_revision,
1854 rcv_trx.vendor_id,
1855 rcv_trx.ship_to_location_id,
1856 rcv_trx.deliver_to_location_id,
1857 rcv_trx.deliver_to_person_id ,
1858 rcv_trx.quantity,
1859 rcv_trx.primary_quantity,
1860 rcv_trx.primary_unit_of_measure,
1861 x_tolerable_quantity ,
1862 rcv_trx.unit_of_measure,
1863 rcv_trx.routing_header_id,
1864 x_default_subinventory ,
1865 x_default_locator_id ,
1866 rcv_trx.subinventory,
1867 rcv_trx.locator_id);
1868
1869 END IF;
1870
1871 RETURN;
1872
1873 EXCEPTION
1874 WHEN OTHERS THEN
1875 po_message_s.sql_error('set_trx_defaults', X_progress, sqlcode);
1876 RAISE;
1877
1878 END set_trx_defaults;
1879
1880
1881 /*===========================================================================
1882
1883 PROCEDURE NAME: print_receord
1884
1885 ===========================================================================*/
1886
1887 /*
1888 ** Prints a transaction record
1889 */
1890
1891 PROCEDURE print_record (rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE) IS
1892
1893 BEGIN
1894 htp.code('-------------- Transactions Definition ------------------'); htp.nl;
1895 htp.code('interface_transaction_id : ' ||
1896 to_char(rcv_trx.interface_transaction_id)); htp.nl;
1897 htp.code('transaction_type : ' ||
1898 rcv_trx.transaction_type); htp.nl;
1899 htp.code('auto_transact_code : ' ||
1900 rcv_trx.auto_transact_code); htp.nl;
1901 htp.code('transaction_date : ' ||
1902 to_char(rcv_trx.transaction_date)); htp.nl;
1903 htp.code('quantity : ' ||
1904 TO_CHAR(rcv_trx.quantity)); htp.nl;
1905 htp.code('unit_of_measure : ' ||
1906 rcv_trx.unit_of_measure); htp.nl;
1907 htp.code('po_line_location_id : ' ||
1908 to_char(rcv_trx.po_line_location_id)); htp.nl;
1909 htp.code('shipment_line_id : ' ||
1910 to_char(rcv_trx.shipment_line_id)); htp.nl;
1911 htp.code('item_id : ' ||
1912 to_char(rcv_trx.item_id)); htp.nl;
1913 htp.code('item_revision : ' ||
1914 rcv_trx.item_revision); htp.nl;
1915 htp.code('vendor_id : ' ||
1916 to_char(rcv_trx.vendor_id)); htp.nl;
1917 htp.code('from_organization_id : ' ||
1918 to_char(rcv_trx.from_organization_id)); htp.nl;
1919 htp.code('to_organization_id : ' ||
1920 to_char(rcv_trx.to_organization_id)); htp.nl;
1921 htp.code('expected_receipt_date : ' ||
1922 to_char(rcv_trx.expected_receipt_date)); htp.nl;
1923 htp.code('routing_header_id : ' ||
1924 to_char(rcv_trx.routing_header_id)); htp.nl;
1925 htp.code('destination_type_code : ' ||
1926 rcv_trx.destination_type_code); htp.nl;
1927 htp.code('po_distribution_id : ' ||
1928 TO_CHAR(rcv_trx.po_distribution_id)); htp.nl;
1929 htp.code('deliver_to_person_id : ' ||
1930 TO_CHAR(rcv_trx.deliver_to_person_id)); htp.nl;
1931 htp.code('deliver_to_location_id : ' ||
1932 TO_CHAR(rcv_trx.deliver_to_location_id)); htp.nl;
1933 htp.code('subinventory : ' ||
1934 rcv_trx.subinventory); htp.nl;
1935 htp.code('locator_id : ' ||
1936 TO_CHAR(rcv_trx.locator_id)); htp.nl;
1937 htp.code('wip_entity_id : ' ||
1938 TO_CHAR(rcv_trx.wip_entity_id)); htp.nl;
1939 htp.code('wip_line_id : ' ||
1940 TO_CHAR(rcv_trx.wip_line_id)); htp.nl;
1941 htp.code('wip_repetitive_schedule_id : ' ||
1942 TO_CHAR(rcv_trx.wip_repetitive_schedule_id)); htp.nl;
1943 htp.code('wip_operation_seq_num : ' ||
1944 TO_CHAR(rcv_trx.wip_operation_seq_num)); htp.nl;
1945 htp.code('wip_resource_seq_num : ' ||
1946 TO_CHAR(rcv_trx.wip_resource_seq_num)); htp.nl;
1947 htp.code('bom_resource_id : ' ||
1948 TO_CHAR(rcv_trx.bom_resource_id)); htp.nl; htp.nl;
1949
1950 END print_record;
1951
1952 /*===========================================================================
1953
1954 PROCEDURE NAME: Insert_Interface_Errors
1955
1956 ===========================================================================*/
1957
1958 /*
1959 ** Insert into PO_INTERFACE_ERRORS table
1960 */
1961
1962 PROCEDURE insert_interface_errors ( rcv_trx IN OUT NOCOPY rcv_transactions_interface%ROWTYPE,
1963 X_column_name IN VARCHAR2,
1964 X_err_message IN VARCHAR2) as
1965
1966 X_progress VARCHAR2(3) := '000';
1967
1968 begin
1969
1970 X_progress := '050';
1971
1972 /* Bug 4773978: Added the following code for logging error messages
1973 in PO_INTERFACE_ERRORS table and removed the Insert
1974 statements to insert into PO_INTERFACE_ERRORS
1975 table, as the fields error_message, interface_line_id
1976 and interface_header_id are not populated. */
1977 RCV_ERROR_PKG.set_error_message(X_err_message);
1978 RCV_ERROR_PKG.log_interface_error(X_column_name,FALSE);
1979
1980 end insert_interface_errors;
1981
1982 End rcv_express_sv;