1 PACKAGE BODY RCV_TRANSACTION_SV AS
2 /* $Header: RCVTXPQB.pls 120.5.12010000.5 2010/02/02 09:39:26 honwei ship $ */
3
4 PROCEDURE DISTRIBUTION_DETAIL( x_rcv_transaction_id IN NUMBER,
5 x_destination_type_code OUT NOCOPY VARCHAR2,
6 x_destination_context OUT NOCOPY VARCHAR2,
7 x_destination_type_dsp OUT NOCOPY VARCHAR2,
8 x_wip_entity_id OUT NOCOPY NUMBER,
9 x_wip_line_id OUT NOCOPY NUMBER,
10 x_wip_repetitive_schedule_id OUT NOCOPY NUMBER,
11 x_deliver_to_person_id OUT NOCOPY NUMBER,
12 x_deliver_to_location_id OUT NOCOPY NUMBER,
13 x_po_distribution_id OUT NOCOPY NUMBER,
14 v_currency_conv_rate IN OUT NOCOPY NUMBER,
15 v_currency_conv_date IN OUT NOCOPY DATE,
16 -- <RCV ENH FPI START>
17 x_kanban_card_number OUT NOCOPY VARCHAR2,
18 x_project_number OUT NOCOPY VARCHAR2,
19 x_task_number OUT NOCOPY VARCHAR2,
20 x_charge_account OUT NOCOPY VARCHAR2) is
21 -- <RCV ENH FPI END>
22
23
24 x_progress VARCHAR2(3) := NULL;
25
26 -- <RCV ENH FPI START>
27 l_code_combination_id PO_DISTRIBUTIONS.code_combination_id%TYPE;
28 -- <RCV ENH FPI END>
29
30 x_project_id PO_DISTRIBUTIONS.project_id%type; -- bug 5220069
31 x_task_id PO_DISTRIBUTIONS.task_id%type; -- bug 5220069
32 begin
33 x_progress := 10;
34
35 /* Bug 4753498: Replaced pa_tasks_expend_v with pa_tasks in following query */
36
37 select pod.destination_type_code,
38 pod.destination_type_code,
39 plc.displayed_field,
40 pod.wip_entity_id,
41 pod.wip_line_id,
42 pod.wip_repetitive_schedule_id,
43 pod.deliver_to_person_id,
44 pod.deliver_to_location_id,
45 pod.po_distribution_id,
46 round(pod.rate,28), -- Bug 409020
47 pod.rate_date, -- Bug 409020
48 mkc.kanban_card_number, -- <RCV ENH FPI>
49 pod.project_id, -- bug 5220069
50 pod.task_id, -- bug 5220069
51 pod.code_combination_id
52 into x_destination_type_code,
53 x_destination_context,
54 x_destination_type_dsp,
55 x_wip_entity_id,
56 x_wip_line_id,
57 x_wip_repetitive_schedule_id,
58 x_deliver_to_person_id,
59 x_deliver_to_location_id,
60 x_po_distribution_id,
61 v_currency_conv_rate,
62 v_currency_conv_date,
63 x_kanban_card_number, -- <RCV ENH FPI>
64 x_project_id, -- bug 5220069
65 x_task_id, -- bug 5220069
66 l_code_combination_id -- <RCV ENH FPI>
67 from po_distributions pod,
68 po_lookup_codes plc,
69 mtl_supply ms,
70 mtl_kanban_cards mkc -- <RCV ENH FPI>
71 where ms.supply_type_code = 'RECEIVING'
72 and ms.supply_source_id = x_rcv_transaction_id
73 and pod.po_distribution_id = ms.po_distribution_id
74 and plc.lookup_type = 'RCV DESTINATION TYPE'
75 and plc.lookup_code = pod.destination_type_code
76 AND pod.kanban_card_id = mkc.kanban_card_id (+); -- <RCV ENH FPI>
77
78 -- <RCV ENH FPI START>
79 x_progress := 20;
80 /* Bug 5220069 START
81 Due to performance problems because of outer joins on project_id and
82 task_id related conditions in the above sql, writing a separate select
83 to retrieve the project and task numbers. This sql will be executed
84 only when project/task references are there in the PO distribution.
85 */
86
87 x_project_number := NULL;
88 x_task_number := NULL;
89 IF (x_project_id is not null AND x_task_id is not null) THEN
90 BEGIN
91 x_progress := 21;
92 select PPA.SEGMENT1 PROJECT_NUMBER ,
93 PT.TASK_NUMBER
94 into x_project_number,
95 x_task_number
96 from PA_PROJECTS_ALL PPA,
97 PA_TASKS PT
98 where PPA.PROJECT_ID = PT.PROJECT_ID
99 and PPA.project_id = x_project_id
100 and PT.task_id = x_task_id;
101 EXCEPTION
102 WHEN NO_DATA_FOUND THEN
103 x_project_number := NULL;
104 x_task_number := NULL;
105 END;
106 --Bug 9080608 When the project_id is not null but task id is null we should retieve only project info.
107 ELSIF ( X_project_id IS NOT NULL AND X_task_id IS NULL ) THEN
108
109 Begin
110 select SEGMENT1 PROJECT_NUMBER
111 into x_project_number
112 from PA_PROJECTS_ALL
113 where project_id = X_project_id;
114 Exception
115 when no_data_found then
116 x_project_number := NULL;
117 End;
118 END IF;
119
120 x_progress := 23;
121 IF x_project_id is not null AND x_project_number is null THEN --if x_project_number is still null then it could be in PJM_SEIBAN_NUMBERS
122 BEGIN
123 x_progress := 25;
124 select PSN.PROJECT_NUMBER ,
125 NULL
126 into x_project_number,
127 x_task_number
128 from PJM_SEIBAN_NUMBERS PSN
129 where PSN.project_id = x_project_id;
130 EXCEPTION
131 WHEN NO_DATA_FOUND THEN
132 x_project_number := NULL;
133 x_task_number := NULL;
134 END;
135 END IF;
136 x_progress := 30;
137 /* Bug 5220069 END */
138
139 x_charge_account :=
140 PO_COMPARE_REVISIONS.get_charge_account(l_code_combination_id);
141 -- <RCV ENH FPI END>
142
143 EXCEPTION
144 when others then
145 po_message_s.sql_error('DISTRIBUTION_DETAIL',x_progress,sqlcode);
146 raise;
147 end DISTRIBUTION_DETAIL;
148
149 FUNCTION GET_RECEIVING_DISPLAY_VALUE RETURN VARCHAR2 IS
150 x_receiving VARCHAR2(80);
151 x_progress VARCHAR2(3) := NULL;
152 begin
153
154 x_progress := 10;
155 select displayed_field
156 into x_receiving
157 from po_lookup_codes
158 where lookup_type = 'RCV DESTINATION TYPE'
159 and lookup_code = 'RECEIVING';
160
161 RETURN(x_receiving);
162
163 EXCEPTION
164 when others then
165 po_message_s.sql_error('GET_RECEIVING_DISPLAY_VALUE ',x_progress,sqlcode);
166 raise;
167 end GET_RECEIVING_DISPLAY_VALUE;
168
169 FUNCTION GET_LOCATION (x_location_id IN NUMBER, x_line_location_id IN NUMBER) RETURN VARCHAR2 IS
170
171 x_progress VARCHAR2(3) := NULL;
172
173 /** PO UTF8 Column Expansion Project 9/23/2002 tpoon **/
174 /** Changed x_location_code to use %TYPE **/
175 -- x_location_code VARCHAR2(30);
176 x_location_code hr_locations_all.location_code%TYPE;
177
178 /* bug2199615 */
179 x_oe_line_id NUMBER;
180 BEGIN
181
182
183 /* bug fix : 2199615 - regression from 2288234
184 fix for 2288234 caused regression - removed lot of code from version 115.13
185 for clarity. Replaced bad code that caused regression with call to OE api to
186 check if drop_ship
187 */
188
189 x_progress := 10;
190
191 x_oe_line_id := OE_DROP_SHIP_GRP.PO_Line_Location_Is_Drop_Ship(x_line_location_id);
192
193 IF (x_oe_line_id IS NOT NULL) THEN /* drop ship */
194 SELECT substr(rtrim(address1) || '-' || rtrim(city),1,20)
195 INTO x_location_code
196 FROM hz_locations
197 WHERE location_id = x_location_id;
198 ELSE /* not a drop ship */
199 SELECT location_code
200 INTO x_location_code
201 FROM hr_locations
202 WHERE location_id = x_location_id;
203 END IF;
204
205 RETURN (x_location_code);
206 EXCEPTION
207 /*Begin Bug 3284237. Added the exception part.Drop ship created in 11.0 and then
208 customer upgraded to 11i*/
209 when no_data_found then
210 BEGIN
211 if (x_oe_line_id IS NOT NULL) THEN
212 select location_code
213 into x_location_code
214 from hr_locations
215 where location_id = x_location_id;
216 RETURN(x_location_code);
217 end if;
218 END;
219 /*End Bug 3284237*/
220 WHEN OTHERS THEN
221 po_message_s.sql_error('GET_LOCATION',x_progress,sqlcode);
222
223 END GET_LOCATION;
224
225 FUNCTION GET_DELIVER_PERSON (x_employee_id IN NUMBER) RETURN VARCHAR2 IS
226
227 x_progress VARCHAR2(3) := NULL;
228 x_name VARCHAR2(240);
229
230 BEGIN
231 x_progress := 10;
232
233 -- Bug 8270296
234
235 /*select full_name
236 into x_name
237 from per_employees_current_x -- Bug 7257731: Changed the view name from hr_employees to per_employees_current_x
238 where employee_id = x_employee_id; */
239
240 SELECT full_name
241 INTO x_name
242 FROM per_workforce_current_x -- Changed the view name from per_employees_current_x to per_workforce_current_x
243 WHERE person_id = x_employee_id
244 AND ROWNUM = 1;
245
246 -- End of Bug 8270296
247
248 RETURN(x_name);
249
250 EXCEPTION
251 when others then
252 po_message_s.sql_error('GET_DELIVER_PERSON',x_progress,sqlcode);
253 raise;
254 end GET_DELIVER_PERSON;
255
256 PROCEDURE HAZARD_CLASS_INFO (x_hazard_id IN NUMBER,
257 x_hazard_class OUT NOCOPY VARCHAR2) is
258 x_progress VARCHAR2(3) := NULL;
259 BEGIN
260 x_progress := 10;
261 select hazard_class
262 into x_hazard_class
263 from po_hazard_classes
264 where hazard_class_id = x_hazard_id;
265 EXCEPTION
266 when others then
267 po_message_s.sql_error('HAZARD_CLASS_INFO',x_progress,sqlcode);
268 raise;
269 end HAZARD_CLASS_INFO;
270
271 PROCEDURE UN_NUMBER_INFO (x_un_number_id IN NUMBER,
272 x_un_number OUT NOCOPY VARCHAR2) is
273 x_progress VARCHAR2(3) := NULL;
274 BEGIN
275 x_progress := 10;
276 select un_number
277 into x_un_number
278 from po_un_numbers
279 where un_number_id = x_un_number_id;
280 EXCEPTION
281 when others then
282 po_message_s.sql_error('UN_NUMBER_INFO',x_progress,sqlcode);
283 raise;
284 end UN_NUMBER_INFO;
285
286 PROCEDURE DEFAULT_SUBINV_LOCATOR (x_subinventory IN OUT NOCOPY VARCHAR2 ,
287 x_item_id IN NUMBER,
288 x_org_id IN NUMBER,
289 x_po_distribution_id IN NUMBER,
290 x_oe_order_line_id IN NUMBER,
291 x_locator_id OUT NOCOPY NUMBER ) is
292 x_progress VARCHAR2(3) := NULL;
293 begin
294 if x_subinventory is null then
295 x_progress := 10;
296
297 -- Need this if condition for rma receipts
298
299 if X_po_distribution_id is not null then
300 select destination_subinventory
301 into x_subinventory
302 from po_distributions
303 where po_distribution_id = X_po_distribution_id;
304
305 -- Bug 3378162: for rma receipts, default subinventory from oe line.
306 elsif x_oe_order_line_id is not null then
307 select subinventory
308 into x_subinventory
309 from oe_order_lines_all
310 where line_id = x_oe_order_line_id;
311 end if;
312
313 IF x_subinventory is null then
314
315 x_progress := 20;
316
317 select subinventory_code
318 into x_subinventory
319 from mtl_item_sub_defaults
320 where inventory_item_id = x_item_id
321 and organization_id = x_org_id
322 and default_type = 2;
323
324 END IF;
325
326 end if;
327 if x_subinventory is not null then
328 select locator_id
329 into x_locator_id
330 from mtl_item_loc_defaults
331 where inventory_item_id = x_item_id
332 and organization_id = x_org_id
333 and subinventory_code = x_subinventory
334 and default_type = 2;
335 end if;
336
337 EXCEPTION
338 when no_data_found then
339 null;
340 when others then
341 po_message_s.sql_error('DEFAULT_SUBINV_LOCATOR',x_progress,sqlcode);
342 raise;
343 end DEFAULT_SUBINV_LOCATOR;
344
345 PROCEDURE VALIDATE_ID ( x_deliver_to_location_id IN OUT NOCOPY NUMBER,
346 x_location_id IN OUT NOCOPY NUMBER,
347 x_deliver_to_person_id IN OUT NOCOPY NUMBER,
348 x_subinventory IN OUT NOCOPY VARCHAR2,
349 x_org_id IN NUMBER,
350 x_date IN DATE) is
351 x_del_loc_val VARCHAR2(60);
352 x_loc_val VARCHAR2(60);
353 x_del_per_val VARCHAR2(60);
354 x_subinv VARCHAR2(60);
355 x_progress VARCHAR2(3) := NULL;
356 begin
357 x_progress := 10;
358 begin
359
360 /* 1942696*/
361
362 /** Bug#6497729:
363 ** When NO_DATA_FOUND exception occurs, we are setting 'deliver to person'/'deliver to location'
364 ** to Zero and this Zero is getting stored in rcv_transactions table for deliver_to_person_id
365 ** and deliver_to_location_id and causes data corruption.
366 ** So, we have set 'null' instead of setting it to Zero and we have to fire queries,
367 ** only if 'deliver to person'/'deliver to location' is not null.
368 */
369 begin
370 if x_deliver_to_location_id is not null then--Bug#6497729
371 select 'Check to see if deliver_to_location_id is valid'
372 INTO x_del_loc_val
373 from hr_locations
374 WHERE nvl(inventory_organization_id,x_org_id) = x_org_id
375 AND (inactive_date IS NULL
376 OR
377 inactive_date > x_date)
378 AND location_id = x_deliver_to_location_id;
379 end if;--Bug#6497729
380 exception
381 when NO_DATA_FOUND then
382 select 'Check to see if deliver_to_location_id is valid'
383 INTO x_del_loc_val
384 from hz_locations
385 WHERE (address_expiration_date IS NULL
386 OR
387 address_expiration_date > x_date)
388 AND location_id = x_deliver_to_location_id;
389
390 end;
391
392 EXCEPTION
393 when no_data_found then
394 x_deliver_to_location_id := null;--Bug#6497729
395 when others then
396 po_message_s.sql_error('VALIDATE_ID',x_progress,sqlcode);
397 raise;
398 END;
399
400 x_progress := 20;
401
402 /* 1942696*/
403 begin
404 begin
405 if x_location_id is not null then--Bug#6497729
406 select 'Check to see if location_id is valid'
407 into x_loc_val
408 from hr_locations
409 WHERE nvl(inventory_organization_id,x_org_id) = x_org_id
410 AND receiving_site_flag = 'Y'
411 AND (inactive_date IS NULL
412 OR
413 inactive_date > x_date)
414 AND location_id = x_location_id;
415 end if;--Bug#6497729
416 exception
417 when NO_DATA_FOUND then
418 select 'Check to see if location_id is valid'
419 into x_loc_val
420 from hz_locations
421 WHERE (address_expiration_date IS NULL
422 OR
423 address_expiration_date > x_date)
424 AND location_id = x_location_id;
425 end;
426
427 EXCEPTION
428 when no_data_found then
429 x_location_id := null;--Bug#6497729
430 when others then
431 po_message_s.sql_error('VALIDATE_ID',x_progress,sqlcode);
432 raise;
433 END;
434
435 x_progress := 30;
436 BEGIN
437
438 /* Replace view hr_employees_current_v with view
439 per_workforce_current_x to enable requester from
440 another BG for bug 9157396
441 */
442 if x_deliver_to_person_id is not null then--Bug#6497729
443 select 'Check to see if deliver_to_person_id is valid'
444 into x_del_per_val
445 from per_workforce_current_x
446 WHERE (termination_date IS NULL
447 OR
448 termination_date > x_date)
449 AND person_id = x_deliver_to_person_id;
450 end if;--Bug#6497729
451 EXCEPTION
452 when no_data_found then
453 x_deliver_to_person_id := null;--Bug#6497729
454 when others then
455 po_message_s.sql_error('VALIDATE_ID',x_progress,sqlcode);
456 raise;
457 END;
458
459 BEGIN
460 x_progress := 40;
461 select 'Check to see if subinventory is valid'
462 into x_subinv
463 from mtl_secondary_inventories
464 WHERE (disable_date IS NULL
465 OR
466 disable_date > x_date)
467 AND organization_id = x_org_id
468 AND secondary_inventory_name = x_subinventory;
469
470 EXCEPTION
471 when no_data_found then
472 x_subinventory := '';
473 when others then
474 po_message_s.sql_error('VALIDATE_ID',x_progress,sqlcode);
475 raise;
476 END;
477
478
479 end VALIDATE_ID;
480
481 FUNCTION LOCATOR_TYPE (x_org_id IN NUMBER ,
482 x_subinv IN VARCHAR2) RETURN VARCHAR2 is
483 x_progress VARCHAR2(3) := NULL;
484 x_locator_type VARCHAR2(30);
485 begin
486 x_progress := 10;
487 select locator_type
488 into x_locator_type
489 from mtl_secondary_inventories
490 where organization_id = x_org_id
491 and secondary_inventory_name = x_subinv;
492 RETURN(x_locator_type);
493 EXCEPTION
494 when no_data_found then
495 RETURN(NULL);
496 when others then
497 po_message_s.sql_error('LOCATOR_TYPE',x_progress,sqlcode);
498 raise;
499 end LOCATOR_TYPE;
500
501 --Bug#2109106. This function has been overloaded.
502 procedure POST_QUERY ( x_transaction_id IN NUMBER,
503 x_receipt_source_code IN VARCHAR2,
504 x_organization_id IN NUMBER,
505 x_hazard_class_id IN NUMBER,
506 x_un_number_id IN NUMBER,
507 x_shipment_header_id IN NUMBER,
508 x_shipment_line_id IN NUMBER,
509 x_po_line_location_id IN NUMBER,
510 x_po_line_id IN NUMBER,
511 x_po_header_id IN NUMBER,
512 x_po_release_id IN NUMBER,
513 x_vendor_id IN NUMBER,
514 x_item_id IN NUMBER,
515 x_item_revision IN VARCHAR2,
516 x_transaction_date IN DATE,
517 x_creation_date IN DATE,
518 x_location_id IN NUMBER,
519 x_subinventory IN VARCHAR2,
520 x_destination_type_code IN VARCHAR2,
521 x_destination_type_dsp IN VARCHAR2,
522 x_primary_uom IN VARCHAR2,
523 x_routing_id IN NUMBER,
524 x_po_distribution_id IN OUT NOCOPY NUMBER,
525 x_final_dest_type_code IN OUT NOCOPY VARCHAR2,
526 x_final_dest_type_dsp IN OUT NOCOPY VARCHAR2,
527 x_final_location_id IN OUT NOCOPY NUMBER,
528 x_final_subinventory IN OUT NOCOPY VARCHAR2,
529 x_destination_context IN OUT NOCOPY VARCHAR2,
530 x_wip_entity_id IN OUT NOCOPY NUMBER,
531 x_wip_line_id IN OUT NOCOPY NUMBER,
532 x_wip_repetitive_schedule_id IN OUT NOCOPY NUMBER,
533 x_outside_processing IN OUT NOCOPY VARCHAR2,
534 x_job_schedule_dsp IN OUT NOCOPY VARCHAR2,
535 x_op_seq_num_dsp IN OUT NOCOPY VARCHAR2,
536 x_department_code IN OUT NOCOPY VARCHAR2 ,
537 x_production_line_dsp IN OUT NOCOPY VARCHAR2,
538 x_bom_resource_id IN OUT NOCOPY NUMBER,
539 x_final_deliver_to_person_id IN OUT NOCOPY NUMBER,
540 x_final_deliver_to_location_id IN OUT NOCOPY NUMBER,
541 x_person IN OUT NOCOPY VARCHAR2,
542 x_location IN OUT NOCOPY VARCHAR2,
543 x_hazard_class IN OUT NOCOPY VARCHAR2,
544 x_un_number IN OUT NOCOPY VARCHAR2,
545 x_sub_locator_control IN OUT NOCOPY VARCHAR2 ,
546 x_count IN OUT NOCOPY NUMBER ,
547 x_locator_id IN OUT NOCOPY NUMBER ,
548 x_available_qty IN OUT NOCOPY NUMBER,
549 x_primary_available_qty IN OUT NOCOPY NUMBER,
550 x_tolerable_qty IN OUT NOCOPY NUMBER ,
551 x_uom IN OUT NOCOPY VARCHAR2,
552 x_count_po_distribution IN OUT NOCOPY NUMBER,
553 x_receiving_dsp_value IN OUT NOCOPY VARCHAR2,
554 x_po_operation_seq_num IN OUT NOCOPY NUMBER,
555 x_po_resource_seq_num IN OUT NOCOPY NUMBER,
556 x_currency_conv_rate IN OUT NOCOPY NUMBER,
557 x_currency_conv_date IN OUT NOCOPY DATE,
558 x_oe_order_line_id IN NUMBER ,
559 /* Bug# 1548597 */
560 x_secondary_available_qty IN OUT NOCOPY NUMBER,
561 -- <RCV ENH FPI START>
562 p_req_line_id IN NUMBER,
563 p_req_distribution_id IN NUMBER,
564 x_kanban_card_number OUT NOCOPY VARCHAR2,
565 x_project_number OUT NOCOPY VARCHAR2,
566 x_task_number OUT NOCOPY VARCHAR2,
567 x_charge_account OUT NOCOPY VARCHAR2
568 -- <RCV ENH FPI END>
569 ) is
570
571 x_progress VARCHAR2(3) ;
572 l_creation_date DATE;
573 l_destination_type_code VARCHAR2(30);
574 l_destination_type_dsp VARCHAR2(80);
575 l_subinventory VARCHAR2(30);
576 l_deliver_to_person_id NUMBER;
577 l_po_distribution_id NUMBER;
578 l_location_id NUMBER;
579 l_deliver_to_location_id NUMBER;
580 l_wip_entity_id NUMBER;
581 l_available_qty NUMBER;
582 l_primary_available_qty NUMBER;
583 l_tolerable_qty NUMBER;
584 l_locator_id NUMBER;
585 l_uom VARCHAR2(30);
586 X_success BOOLEAN := FALSE;
587 X_project_id NUMBER ; -- bug 1662321
588 X_task_id NUMBER ; -- bug 1662321
589
590
591 -- <RCV ENH FPI START>
592 l_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
593 l_dest_subinv PO_DISTRIBUTIONS.destination_subinventory%TYPE;
594 l_dummy_rate PO_DISTRIBUTIONS.rate%TYPE;
595 l_dummy_rate_date PO_DISTRIBUTIONS.rate_date%TYPE;
596 l_dummy_person HR_EMPLOYEES.full_name%TYPE;
597 l_dummy_subinv PO_REQUISITION_LINES.destination_subinventory%TYPE;
598 -- <RCV ENH FPI END>
599
600 BEGIN
601
602 /* Chk avaliable qty for the transaction */
603 RCV_QUANTITIES_S.GET_AVAILABLE_QUANTITY ('TRANSFER',
604 x_transaction_id,
605 x_receipt_source_code,
606 null,
607 x_transaction_id,
608 null,
609 l_available_qty,
610 l_tolerable_qty,
611 l_uom,
612 /*Bug# 1548597 */
613 x_secondary_available_qty);
614
615 /* Chk if available qty greater than 0 */
616 if nvl(l_available_qty,0) > 0 then
617
618 /* Get the available qty in PRIMARY UOM */
619 PO_UOM_S.UOM_CONVERT (l_available_qty,
620 l_uom,
621 x_item_id,
622 x_primary_uom,
623 l_primary_available_qty );
624
625 /* Copy initial destination type code and destination type dsp item
626 into local variables so that final updated values could be returned
627 */
628 l_destination_type_code := x_destination_type_code;
629 l_destination_type_dsp := x_destination_type_dsp;
630 l_location_id := x_location_id;
631 l_subinventory := x_subinventory;
632 if x_receipt_source_code = 'VENDOR' then
633 if l_destination_type_code = 'SINGLE' then
634 x_progress := 20;
635 DISTRIBUTION_DETAIL( x_transaction_id,
636 l_destination_type_code,
637 x_destination_context,
638 l_destination_type_dsp,
639 l_wip_entity_id,
640 x_wip_line_id,
641 x_wip_repetitive_schedule_id,
642 l_deliver_to_person_id,
643 l_deliver_to_location_id,
644 l_po_distribution_id,
645 x_currency_conv_rate,
646 x_currency_conv_date,
647 -- <RCV ENH FPI START>
648 x_kanban_card_number,
649 x_project_number,
650 x_task_number,
651 x_charge_account );
652 -- <RCV ENH FPI END>
653
654 /* Get outside processing details, only if valid wip_entity_id
655 has been entered
656 */
657 if nvl(l_wip_entity_id,0) <> 0 then
658 x_progress := 30;
659 RCV_CORE_S.GET_OUTSIDE_PROCESSING_INFO(l_po_distribution_id,
660 x_organization_id,
661 x_job_schedule_dsp,
662 x_op_seq_num_dsp,
663 x_department_code,
664 x_production_line_dsp,
665 x_bom_resource_id,
666 x_po_operation_seq_num,
667 x_po_resource_seq_num);
668 x_outside_processing := 'Y';
669 else
670 x_outside_processing := 'N';
671 end if;
672 -- <RCV ENH FPI START>
673 ELSIF (l_destination_type_code = 'MULTIPLE') THEN
674 x_progress := 35;
675
676 RCV_DISTRIBUTIONS_S.get_misc_distr_info(
677 x_return_status => l_status,
678 p_line_location_id => x_po_line_location_id,
679 p_po_distribution_id => NULL,
680 x_kanban_card_number => x_kanban_card_number,
681 x_project_number => x_project_number,
682 x_task_number => x_task_number,
683 x_charge_account => x_charge_account,
684 x_deliver_to_person => x_person,
685 x_job => x_job_schedule_dsp,
686 x_outside_line_num => x_production_line_dsp,
687 x_sequence => x_op_seq_num_dsp,
688 x_department => x_department_code,
689 x_dest_subinv => l_dest_subinv,
690 x_rate => l_dummy_rate,
691 x_rate_date => l_dummy_rate_date);
692
693 IF (l_status <> FND_API.G_RET_STS_SUCCESS) THEN
694 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
695 END IF;
696
697 -- <RCV ENH FPI END>
698 end if;
699
700 elsif x_receipt_source_code = 'CUSTOMER' then
701 -- Final destination is always inventory for rma receitps.
702 x_outside_processing := 'N';
703 l_destination_type_code := 'INVENTORY';
704 x_destination_context := 'INVENTORY';
705
706 select plc.displayed_field
707 into l_destination_type_dsp
708 from po_lookup_codes plc
709 where plc.lookup_type = 'RCV DESTINATION TYPE'
710 and plc.lookup_code = l_destination_type_code;
711
712 /* Bug#4684017.Project and task info was not getting defaulted for a RMA.
713 Fix is to get the project information from OM tables */
714
715 IF (x_oe_order_line_id IS NOT NULL) THEN
716
717 SELECT project_id, task_id
718 INTO X_project_id,X_task_id
719 FROM oe_order_lines_all
720 WHERE line_id = x_oe_order_line_id;
721
722 IF ( X_project_id IS NOT NULL AND
723 X_task_id IS NOT NULL ) THEN
724
725 Begin
726
727 select pa.project_number,pt.task_number
728 into x_project_number,x_task_number
729 from pjm_projects_all_v pa,
730 pa_tasks_expend_v pt
731 where pa.project_id = X_project_id
732 and pt.task_id = X_task_id
733 and pa.project_id=pt.project_id;
734
735
736 Exception
737 when no_data_found then
738 null;
739 End;
740
741 ELSIF ( X_project_id IS NOT NULL AND
742 X_task_id IS NULL ) THEN
743
744 Begin
745 select project_number
746 into x_project_number
747 from pjm_projects_all_v
748 where project_id = X_project_id;
749
750 Exception
751 when no_data_found then
752 null;
753 End;
754
755 END IF;
756
757 END IF;
758
759 /* Bug#4684017 END */
760
761 -- <RCV ENH FPI START>
762 ELSIF x_receipt_source_code = 'INTERNAL ORDER' THEN
763
764 -- We do not need subinv from this procedure because it will be provided
765 -- from the view for this case.
766 RCV_DISTRIBUTIONS_S.get_misc_req_distr_info(
767 x_return_status => l_status,
768 p_requisition_line_id => p_req_line_id,
769 p_req_distribution_id => p_req_distribution_id,
770 x_kanban_card_number => x_kanban_card_number,
771 x_project_number => x_project_number,
772 x_task_number => x_task_number,
773 x_charge_account => x_charge_account,
774 x_deliver_to_person => l_dummy_person,
775 x_dest_subinv => l_dummy_subinv);
776
777 IF (x_final_deliver_to_person_id IS NOT NULL) THEN
778 l_deliver_to_person_id := x_final_deliver_to_person_id;
779 END IF;
780
781 IF (l_status <> FND_API.G_RET_STS_SUCCESS) THEN
782 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
783 END IF;
784
785 -- <RCV ENH FPI END>
786
787 end if;
788
789 /* Bug 2436516 - The hazard class was not getting displayed for
790 multiple distributions in the Receiving Transactions form.
791 The hazard class was retrieved only for single distributions.
792 Modified the code to get hazard class for multiple distributions also
793 */
794
795 if nvl(x_hazard_class_id,0) <> 0 then
796 x_progress := 40;
797 HAZARD_CLASS_INFO (x_hazard_class_id,
798 x_hazard_class );
799 end if;
800
801 if l_destination_type_code <> 'MULTIPLE' then
802 if nvl(x_un_number_id,0) <> 0 then
803 x_progress := 50;
804 UN_NUMBER_INFO (x_un_number_id,
805 x_un_number);
806 end if;
807 x_progress := 60;
808
809 if x_receipt_source_code <> 'CUSTOMER' then
810
811 x_count := RCV_CORE_S.GET_NOTE_COUNT (x_shipment_header_id,
812 x_shipment_line_id,
813 x_po_line_location_id,
814 x_po_line_id,
815 x_po_release_id,
816 x_po_header_id,
817 x_item_id );
818 end if;
819
820 if l_destination_type_code = 'INVENTORY' then
821 x_progress := 70;
822 DEFAULT_SUBINV_LOCATOR (l_subinventory,
823 x_item_id,
824 x_organization_id,
825 l_po_distribution_id,
826 x_oe_order_line_id,
827 x_locator_id );
828
829 /* Bug 3537022.
830 * Get locator_id from rcv_shipment_lines for intransit
831 * shipments.
832 */
833 x_progress := 80;
834
835 if (x_receipt_source_code = 'INVENTORY') then
836 select locator_id
837 into x_locator_id
838 from rcv_shipment_lines
839 where shipment_line_id = x_shipment_line_id;
840 end if;
841
842 x_progress := 90;
843
844 -- default deliver_to_location_id for rma deliver
845 if x_receipt_source_code = 'CUSTOMER' then
846
847 select haou.location_id
848 into l_deliver_to_location_id
849 from hr_all_organization_units haou
850 where haou.organization_id = (select ship_from_org_id
851 from oe_order_lines_all
852 where line_id = x_oe_order_line_id);
853
854 end if;
855 elsif x_destination_type_code = 'RECEIVING' then
856 po_message_s.app_error(x_destination_type_code);
857 l_subinventory := '';
858 x_locator_id := NULL;
859
860 end if;
861 /* l_creation_date := x_creation_date;
862 if x_transaction_date is not null then
863 l_creation_date := x_transaction_date;
864 end if; */
865 l_creation_date := sysdate;
866 x_progress := 80;
867 VALIDATE_ID (l_deliver_to_location_id,
868 l_location_id,
869 l_deliver_to_person_id,
870 l_subinventory,
871 x_organization_id,
872 l_creation_date );
873 x_progress := 90;
874 x_sub_locator_control := LOCATOR_TYPE (x_organization_id,
875 l_subinventory );
876
877 --get deliver to location name
878 if nvl(l_deliver_to_location_id,0) <> 0 then
879 x_progress := 100;
880
881 /* bug2199615 */
882 x_location := GET_LOCATION (l_deliver_to_location_id, x_po_line_location_id );
883 end if;
884
885 --get person name
886 if nvl(l_deliver_to_person_id,0) <> 0 then
887 x_progress := 110;
888 x_person := GET_DELIVER_PERSON (l_deliver_to_person_id);
889 end if;
890 else /* Destination type = 'Multiple' */
891 --retreive no_of_distributions for the shipment
892 x_progress := 115;
893 select count(*)
894 into x_count_po_distribution
895 from po_distributions
896 where line_location_id = x_po_line_location_id;
897
898 end if;
899
900 x_progress := 120;
901 x_receiving_dsp_value := GET_RECEIVING_DISPLAY_VALUE;
902
903 end if;
904
905 /* copy the local values to final parameters */
906 x_final_dest_type_code := l_destination_type_code;
907 x_final_dest_type_dsp := l_destination_type_dsp;
908 x_final_deliver_to_person_id := l_deliver_to_person_id;
909 x_final_deliver_to_location_id := l_deliver_to_location_id;
910 x_final_location_id := l_location_id;
911 x_final_subinventory := l_subinventory;
912 x_available_qty := l_available_qty;
913 x_tolerable_qty := l_tolerable_qty;
914 x_uom := l_uom;
915 x_primary_available_qty := l_primary_available_qty;
916 x_wip_entity_id := l_wip_entity_id;
917 x_po_distribution_id := l_po_distribution_id;
918
919 l_subinventory := x_final_subinventory;
920 l_locator_id := x_locator_id;
921
922 X_success := rcv_sub_locator_sv.put_away_api (
923 x_po_line_location_id ,
924 l_po_distribution_id ,
925 x_shipment_line_id ,
926 x_receipt_source_code ,
927 x_organization_id ,
928 x_organization_id ,
929 x_item_id ,
930 x_item_revision ,
931 x_vendor_id ,
932 x_location_id ,
933 l_deliver_to_location_id,
934 l_deliver_to_person_id ,
935 x_available_qty ,
936 l_primary_available_qty,
937 x_primary_uom ,
938 x_tolerable_qty ,
939 x_uom ,
940 x_routing_id ,
941 l_subinventory ,
942 l_locator_id ,
943 x_final_subinventory ,
944 x_locator_id);
945
946 -- <RCV ENH FPI START>
947 -- Want to skip all validations fro fields coming out from get_misc_distr_info.
948 -- Therefore the assignment are put here.
949
950 IF (l_dest_subinv IS NOT NULL) THEN
951 x_final_subinventory := l_dest_subinv;
952 END IF;
953
954 -- <RCV ENH FPI END>
955
956 IF (x_receipt_source_code <> 'CUSTOMER') THEN
957
958 IF (l_po_distribution_id IS NOT NULL AND
959 x_locator_id IS NOT NULL) THEN
960
961 X_progress := '133';
962
963 SELECT project_id, task_id
964 INTO X_project_id, X_task_id
965 FROM po_distributions
966 WHERE po_distribution_id = l_po_distribution_id;
967 END IF;
968
969 ELSE
970 X_progress := '135';
971 /* Locator field defaulting for rma's */
972 IF (x_oe_order_line_id IS NOT NULL AND
973 x_locator_id IS NOT NULL) THEN
974
975 SELECT project_id, task_id
976 INTO X_project_id,X_task_id
977 FROM oe_order_lines_all
978 WHERE line_id = x_oe_order_line_id;
979
980 END IF;
981
982 /* Bug# 1717095 - Need to get the Currency details for the Order */
983
984 SELECT currency_conversion_rate,currency_conversion_date
985 INTO x_currency_conv_rate,x_currency_conv_date
986 FROM rcv_transactions
987 WHERE transaction_id = x_transaction_id;
988
989 END IF;
990 /*
991 ** Set the default values for the locator based on a
992 ** project manufacturing call. If the default locator
993 ** does not have the project and task that is specified
994 ** on the po and the locator control is dynamic then
995 ** project manufacturing will create a new locator row
996 ** copying all values from the existing locator row while
997 ** adding the new project and task is values
998 */
999 /*bug 1349864 added begin and end statement. This fix was
1000 * made as part of the bug fix 1662321
1001 */
1002 IF X_project_id IS NOT NULL then
1003 -- x_sub_locator_control = 3) THEN - fixed bug: 588172
1004
1005 begin
1006 x_progress := '150';
1007 l_locator_id := X_locator_id; -- Bug 2772050
1008 PJM_PROJECT_LOCATOR.Get_DefaultProjectLocator(
1009 X_organization_id,
1010 l_locator_id, -- Bug 2772050
1011 X_project_id,
1012 X_task_id,
1013 X_locator_id);
1014 exception
1015 when others then
1016 null;
1017 end;
1018
1019 END IF;
1020
1021 EXCEPTION
1022 WHEN OTHERS THEN
1023 po_message_s.sql_error('POST_QUERY',x_progress,sqlcode);
1024 raise;
1025 END POST_QUERY;
1026
1027 -- Bug#2109106. This function has been overloaded.This has been done because
1028 -- the change done for OPM to include the parameter x_secondary_available_qty
1029 -- breaks the inventory api call to this procedure.x_secondary_available_qty
1030 -- has been removed from the parameters.
1031 -- This change has been done for WMS only.
1032
1033 procedure POST_QUERY ( x_transaction_id IN NUMBER,
1034 x_receipt_source_code IN VARCHAR2,
1035 x_organization_id IN NUMBER,
1036 x_hazard_class_id IN NUMBER,
1037 x_un_number_id IN NUMBER,
1038 x_shipment_header_id IN NUMBER,
1039 x_shipment_line_id IN NUMBER,
1040 x_po_line_location_id IN NUMBER,
1041 x_po_line_id IN NUMBER,
1042 x_po_header_id IN NUMBER,
1043 x_po_release_id IN NUMBER,
1044 x_vendor_id IN NUMBER,
1045 x_item_id IN NUMBER,
1046 x_item_revision IN VARCHAR2,
1047 x_transaction_date IN DATE,
1048 x_creation_date IN DATE,
1049 x_location_id IN NUMBER,
1050 x_subinventory IN VARCHAR2,
1051 x_destination_type_code IN VARCHAR2,
1052 x_destination_type_dsp IN VARCHAR2,
1053 x_primary_uom IN VARCHAR2,
1054 x_routing_id IN NUMBER,
1055 x_po_distribution_id IN OUT NOCOPY NUMBER,
1056 x_final_dest_type_code IN OUT NOCOPY VARCHAR2,
1057 x_final_dest_type_dsp IN OUT NOCOPY VARCHAR2,
1058 x_final_location_id IN OUT NOCOPY NUMBER,
1059 x_final_subinventory IN OUT NOCOPY VARCHAR2,
1060 x_destination_context IN OUT NOCOPY VARCHAR2,
1061 x_wip_entity_id IN OUT NOCOPY NUMBER,
1062 x_wip_line_id IN OUT NOCOPY NUMBER,
1063 x_wip_repetitive_schedule_id IN OUT NOCOPY NUMBER,
1064 x_outside_processing IN OUT NOCOPY VARCHAR2,
1065 x_job_schedule_dsp IN OUT NOCOPY VARCHAR2,
1066 x_op_seq_num_dsp IN OUT NOCOPY VARCHAR2,
1067 x_department_code IN OUT NOCOPY VARCHAR2 ,
1068 x_production_line_dsp IN OUT NOCOPY VARCHAR2,
1069 x_bom_resource_id IN OUT NOCOPY NUMBER,
1070 x_final_deliver_to_person_id IN OUT NOCOPY NUMBER,
1071 x_final_deliver_to_location_id IN OUT NOCOPY NUMBER,
1072 x_person IN OUT NOCOPY VARCHAR2,
1073 x_location IN OUT NOCOPY VARCHAR2,
1074 x_hazard_class IN OUT NOCOPY VARCHAR2,
1075 x_un_number IN OUT NOCOPY VARCHAR2,
1076 x_sub_locator_control IN OUT NOCOPY VARCHAR2 ,
1077 x_count IN OUT NOCOPY NUMBER ,
1078 x_locator_id IN OUT NOCOPY NUMBER ,
1079 x_available_qty IN OUT NOCOPY NUMBER,
1080 x_primary_available_qty IN OUT NOCOPY NUMBER,
1081 x_tolerable_qty IN OUT NOCOPY NUMBER ,
1082 x_uom IN OUT NOCOPY VARCHAR2,
1083 x_count_po_distribution IN OUT NOCOPY NUMBER,
1084 x_receiving_dsp_value IN OUT NOCOPY VARCHAR2,
1085 x_po_operation_seq_num IN OUT NOCOPY NUMBER,
1086 x_po_resource_seq_num IN OUT NOCOPY NUMBER,
1087 x_currency_conv_rate IN OUT NOCOPY NUMBER,
1088 x_currency_conv_date IN OUT NOCOPY DATE,
1089 x_oe_order_line_id IN NUMBER ) IS
1090
1091 x_progress VARCHAR2(3) ;
1092 l_creation_date DATE;
1093 l_destination_type_code VARCHAR2(30);
1094 l_destination_type_dsp VARCHAR2(80);
1095 l_subinventory VARCHAR2(30);
1096 l_deliver_to_person_id NUMBER;
1097 l_po_distribution_id NUMBER;
1098 l_location_id NUMBER;
1099 l_deliver_to_location_id NUMBER;
1100 l_wip_entity_id NUMBER;
1101 l_available_qty NUMBER;
1102 l_primary_available_qty NUMBER;
1103 l_tolerable_qty NUMBER;
1104 l_locator_id NUMBER;
1105 l_uom VARCHAR2(30);
1106 X_success BOOLEAN := FALSE;
1107 X_project_id NUMBER ; -- bug 1662321
1108 X_task_id NUMBER ; -- bug 1662321
1109
1110 -- <RCV ENH FPI START>
1111 l_po_kanban_card_number MTL_KANBAN_CARDS.kanban_card_number%TYPE;
1112 l_po_project_number PJM_PROJECTS_ALL_V.project_number%TYPE;
1113 l_po_task_number PA_TASKS_EXPEND_V.task_number%TYPE;
1114 l_po_charge_account GL_CODE_COMBINATIONS_KFV.concatenated_segments%TYPE;
1115 -- <RCV ENH FPI END>
1116
1117 BEGIN
1118 /* Chk avaliable qty for the transaction */
1119
1120 -- Bug#2109106 The parameter x_secondary_available_qty has been removed.
1121 RCV_QUANTITIES_S.GET_AVAILABLE_QUANTITY ('TRANSFER',
1122 x_transaction_id,
1123 x_receipt_source_code,
1124 null,
1125 x_transaction_id,
1126 null,
1127 l_available_qty,
1128 l_tolerable_qty,
1129 l_uom);
1130
1131 /* Chk if available qty greater than 0 */
1132 if nvl(l_available_qty,0) > 0 then
1133
1134 /* Get the available qty in PRIMARY UOM */
1135 PO_UOM_S.UOM_CONVERT (l_available_qty,
1136 l_uom,
1137 x_item_id,
1138 x_primary_uom,
1139 l_primary_available_qty );
1140
1141 /* Copy initial destination type code and destination type dsp item
1142 into local variables so that final updated values could be returned
1143 */
1144 l_destination_type_code := x_destination_type_code;
1145 l_destination_type_dsp := x_destination_type_dsp;
1146 l_location_id := x_location_id;
1147 l_subinventory := x_subinventory;
1148 if x_receipt_source_code = 'VENDOR' then
1149 if l_destination_type_code = 'SINGLE' then
1150 x_progress := 20;
1151 DISTRIBUTION_DETAIL( x_transaction_id,
1152 l_destination_type_code,
1153 x_destination_context,
1154 l_destination_type_dsp,
1155 l_wip_entity_id,
1156 x_wip_line_id,
1157 x_wip_repetitive_schedule_id,
1158 l_deliver_to_person_id,
1159 l_deliver_to_location_id,
1160 l_po_distribution_id,
1161 x_currency_conv_rate,
1162 x_currency_conv_date,
1163 -- <RCV ENH FPI START>
1164 l_po_kanban_card_number,
1165 l_po_project_number,
1166 l_po_task_number,
1167 l_po_charge_account);
1168 -- <RCV ENH FPI END>
1169
1170 /* Get outside processing details, only if valid wip_entity_id
1171 has been entered
1172 */
1173 if nvl(l_wip_entity_id,0) <> 0 then
1174 x_progress := 30;
1175 RCV_CORE_S.GET_OUTSIDE_PROCESSING_INFO(l_po_distribution_id,
1176 x_organization_id,
1177 x_job_schedule_dsp,
1178 x_op_seq_num_dsp,
1179 x_department_code,
1180 x_production_line_dsp,
1181 x_bom_resource_id,
1182 x_po_operation_seq_num,
1183 x_po_resource_seq_num);
1184 x_outside_processing := 'Y';
1185 else
1186 x_outside_processing := 'N';
1187 end if;
1188 end if;
1189
1190 elsif x_receipt_source_code = 'CUSTOMER' then
1191
1192 x_outside_processing := 'N';
1193 l_destination_type_code := 'RECEIVING';
1194 x_destination_context := 'RECEIVING';
1195
1196 select plc.displayed_field
1197 into l_destination_type_dsp
1198 from po_lookup_codes plc
1199 where plc.lookup_type = 'RCV DESTINATION TYPE'
1200 and plc.lookup_code = l_destination_type_code;
1201
1202
1203 end if;
1204
1205 if l_destination_type_code <> 'MULTIPLE' then
1206 if nvl(x_hazard_class_id,0) <> 0 then
1207 x_progress := 40;
1208 HAZARD_CLASS_INFO (x_hazard_class_id,
1209 x_hazard_class );
1210 end if;
1211 if nvl(x_un_number_id,0) <> 0 then
1212 x_progress := 50;
1213 UN_NUMBER_INFO (x_un_number_id,
1214 x_un_number);
1215 end if;
1216 x_progress := 60;
1217
1218 if x_receipt_source_code <> 'CUSTOMER' then
1219
1220 x_count := RCV_CORE_S.GET_NOTE_COUNT (x_shipment_header_id,
1221 x_shipment_line_id,
1222 x_po_line_location_id,
1223 x_po_line_id,
1224 x_po_release_id,
1225 x_po_header_id,
1226 x_item_id );
1227 end if;
1228
1229 if l_destination_type_code = 'INVENTORY' then
1230
1231 x_progress := 70;
1232 DEFAULT_SUBINV_LOCATOR (l_subinventory,
1233 x_item_id,
1234 x_organization_id,
1235 l_po_distribution_id,
1236 x_oe_order_line_id,
1237 x_locator_id );
1238
1239 /* Bug 3537022.
1240 * Get locator_id from rcv_shipment_lines for intransit
1241 * shipments.
1242 */
1243 x_progress := 80;
1244
1245 if (x_receipt_source_code = 'INVENTORY') then
1246 select locator_id
1247 into x_locator_id
1248 from rcv_shipment_lines
1249 where shipment_line_id = x_shipment_line_id;
1250 end if;
1251
1252 x_progress := 90;
1253 end if;
1254
1255 /* l_creation_date := x_creation_date;
1256 if x_transaction_date is not null then
1257 l_creation_date := x_transaction_date;
1258 end if; */
1259 l_creation_date := sysdate;
1260 x_progress := 80;
1261 VALIDATE_ID (l_deliver_to_location_id,
1262 l_location_id,
1263 l_deliver_to_person_id,
1264 l_subinventory,
1265 x_organization_id,
1266 l_creation_date );
1267 x_progress := 90;
1268 x_sub_locator_control := LOCATOR_TYPE (x_organization_id,
1269 l_subinventory );
1270
1271 --get deliver to location name
1272 if nvl(l_deliver_to_location_id,0) <> 0 then
1273 x_progress := 100;
1274
1275 /* bug2199615 */
1276 x_location := GET_LOCATION (l_deliver_to_location_id, x_po_line_location_id );
1277 end if;
1278
1279 --get person name
1280 if nvl(l_deliver_to_person_id,0) <> 0 then
1281 x_progress := 110;
1282 x_person := GET_DELIVER_PERSON (l_deliver_to_person_id);
1283 end if;
1284 else /* Destination type = 'Multiple' */
1285 --retreive no_of_distributions for the shipment
1286 x_progress := 115;
1287 select count(*)
1288 into x_count_po_distribution
1289 from po_distributions
1290 where line_location_id = x_po_line_location_id;
1291
1292 end if;
1293
1294 x_progress := 120;
1295 x_receiving_dsp_value := GET_RECEIVING_DISPLAY_VALUE;
1296
1297 end if;
1298
1299 /* copy the local values to final parameters */
1300 x_final_dest_type_code := l_destination_type_code;
1301 x_final_dest_type_dsp := l_destination_type_dsp;
1302 x_final_deliver_to_person_id := l_deliver_to_person_id;
1303 x_final_deliver_to_location_id := l_deliver_to_location_id;
1304 x_final_location_id := l_location_id;
1305 x_final_subinventory := l_subinventory;
1306 x_available_qty := l_available_qty;
1307 x_tolerable_qty := l_tolerable_qty;
1308 x_uom := l_uom;
1309 x_primary_available_qty := l_primary_available_qty;
1310 x_wip_entity_id := l_wip_entity_id;
1311 x_po_distribution_id := l_po_distribution_id;
1312
1313 l_subinventory := x_final_subinventory;
1314 l_locator_id := x_locator_id;
1315
1316 X_success := rcv_sub_locator_sv.put_away_api (
1317 x_po_line_location_id ,
1318 l_po_distribution_id ,
1319 x_shipment_line_id ,
1320 x_receipt_source_code ,
1321 x_organization_id ,
1322 x_organization_id ,
1323 x_item_id ,
1324 x_item_revision ,
1325 x_vendor_id ,
1326 x_location_id ,
1327 l_deliver_to_location_id,
1328 l_deliver_to_person_id ,
1329 x_available_qty ,
1330 l_primary_available_qty,
1331 x_primary_uom ,
1332 x_tolerable_qty ,
1333 x_uom ,
1334 x_routing_id ,
1335 l_subinventory ,
1336 l_locator_id ,
1337 x_final_subinventory ,
1338 x_locator_id);
1339
1340 IF (x_receipt_source_code <> 'CUSTOMER') THEN
1341
1342 IF (l_po_distribution_id IS NOT NULL AND
1343 x_locator_id IS NOT NULL) THEN
1344
1345 X_progress := '133';
1346
1347 SELECT project_id, task_id
1348 INTO X_project_id, X_task_id
1349 FROM po_distributions
1350 WHERE po_distribution_id = l_po_distribution_id;
1351 END IF;
1352
1353 ELSE
1354 X_progress := '135';
1355 /* Locator field defaulting for rma's */
1356 IF (x_oe_order_line_id IS NOT NULL AND
1357 x_locator_id IS NOT NULL) THEN
1358
1359 SELECT project_id, task_id
1360 INTO X_project_id,X_task_id
1361 FROM oe_order_lines_all
1362 WHERE line_id = x_oe_order_line_id;
1363
1364 END IF;
1365
1366 /* Bug# 1717095 - Need to get the Currency details for the Order */
1367
1368 SELECT currency_conversion_rate,currency_conversion_date
1369 INTO x_currency_conv_rate,x_currency_conv_date
1370 FROM rcv_transactions
1371 WHERE transaction_id = x_transaction_id;
1372
1373 END IF;
1374 /*
1375 ** Set the default values for the locator based on a
1376 ** project manufacturing call. If the default locator
1377 ** does not have the project and task that is specified
1378 ** on the po and the locator control is dynamic then
1379 ** project manufacturing will create a new locator row
1380 ** copying all values from the existing locator row while
1381 ** adding the new project and task is values
1382 */
1383 /*bug 1349864 added begin and end statement. This fix was
1384 * made as part of the bug fix 1662321
1385 */
1386 IF X_project_id IS NOT NULL then
1387 -- x_sub_locator_control = 3) THEN - fixed bug: 588172
1388
1389 begin
1390 x_progress := '150';
1391 l_locator_id := X_locator_id; -- Bug 2772050
1392 PJM_PROJECT_LOCATOR.Get_DefaultProjectLocator(
1393 X_organization_id,
1394 l_locator_id, -- Bug 2772050
1395 X_project_id,
1396 X_task_id,
1397 X_locator_id);
1398 exception
1399 when others then
1400 null;
1401 end;
1402
1403 END IF;
1404
1405 EXCEPTION
1406 WHEN OTHERS THEN
1407 po_message_s.sql_error('POST_QUERY',x_progress,sqlcode);
1408 raise;
1409 END POST_QUERY;
1410 End rcv_transaction_sv;
1411