[Home] [Help]
PACKAGE BODY: APPS.OKE_DTS_ACTION_PKG
Source
1 Package Body OKE_DTS_ACTION_PKG As
2 /* $Header: OKEDACTB.pls 120.1.12010000.2 2009/03/16 05:38:54 serukull ship $ */
3 g_Counter Number := 0;
4 Function Get_Org(P_Direction Varchar2
5 , P_Ship_From_Org_Id Number
6 , P_Ship_To_Org_Id Number) Return Number Is
7
8
9 Begin
10
11 If P_Direction = 'IN' Then
12 Return P_Ship_To_Org_Id;
13 Else
14 Return P_Ship_From_Org_Id;
15 End if;
16
17 End Get_Org;
18
19
20 Function Check_Operation_Allowed(P_Sts_Code Varchar2, P_Opn_Code Varchar2) Return Boolean Is
21
22
23 Cursor Opn_C(P_Sts_Code Varchar2, P_Opn_Code Varchar2) Is
24 Select Allowed_YN
25 From okc_assents
26 Where Sts_Code = P_Sts_Code
27 And Opn_Code = P_Opn_Code;
28
29 L_Result Varchar2(1);
30
31 Begin
32
33
34 Open Opn_C(P_Sts_Code, P_Opn_Code);
35 Fetch Opn_C Into L_Result;
36 Close Opn_C;
37
38
39
40 If L_Result = 'Y' Then
41 Return True;
42 Else
43 Return False;
44 End If;
45
46 End Check_Operation_Allowed;
47
48 Function Check_Dependencies(P_Deliverable_Id Number) Return Boolean Is
49
50 Cursor Dependency_C(P_Deliverable_Id Number) Is
51 Select 'x'
52 From dual
53 Where exists( Select 1
54 From oke_dependencies
55 Where Dependent_Id = P_Deliverable_Id);
56
57 L_Result Varchar2(1);
58
59 Begin
60
61 If P_Deliverable_Id Is Not Null Then
62 Open Dependency_C(P_Deliverable_Id);
63 Fetch Dependency_C Into L_Result;
64 Close Dependency_C;
65
66 If L_Result = 'x' Then
67 Return False;
68 Else
69 Return True;
70 End If;
71
72 Else
73
74 Return True;
75
76 End If;
77
78 End Check_Dependencies;
79
80 Function Check_Item_Valid(P_Inventory_Org_Id Number
81 , P_Item_Id Number) Return Boolean Is
82
83 Cursor Item_C(P_Inventory_Org_Id Number
84 , P_Item_Id Number) Is
85
86 Select 'x'
87 From oke_system_items_v
88 Where Organization_Id = P_Inventory_Org_Id
89 And Inventory_Item_Id = P_Item_Id;
90
91 L_Result Varchar2(1);
92
93 Begin
94
95 If P_Inventory_Org_Id Is Not Null And P_Item_Id Is Not Null Then
96 Open Item_C(P_Inventory_Org_Id, P_Item_Id);
97 fetch Item_C Into L_Result;
98 Close Item_C;
99
100 If L_Result = 'x' Then
101 Return True;
102 Else
103 Return False;
104 End If;
105 Else
106 Return True;
107 End If;
108
109 End Check_Item_Valid;
110
111 Function Get_Location(P_Buy_Or_Sell Varchar2
112 , P_Direction Varchar2
113 , P_Id Number) Return Varchar2 Is
114
115 Cursor Location_C1(P_Id Number) Is
116 Select Name
117 From okx_locations_v
118 Where Id1 = P_Id;
119
120 Cursor Location_C2(P_Id Number) Is
121 Select Name
122 From okx_vendor_sites_v
123 Where Id1 = P_Id;
124
125 Cursor Location_C3(P_Id Number) Is
126 Select Name
127 From oke_cust_site_uses_v
128 Where Id1 = P_Id;
129
130 L_Location Varchar2(80);
131
132 Begin
133
134 If P_Direction = 'IN' Then
135 Open Location_C1(P_Id);
136 Fetch Location_C1 Into L_Location;
137 Close Location_C1;
138
139 Else
140 If P_Buy_Or_Sell = 'B' Then
141 Open Location_C2(P_Id);
142 Fetch Location_C2 Into L_Location;
143 Close Location_C2;
144
145 Else
146
147 Open Location_C3(P_Id);
148 Fetch Location_C3 Into L_Location;
149 Close Location_C3;
150 End If;
151 End If;
152
153 Return L_Location;
154
155 End Get_Location;
156
157
158
159
160 Procedure Initiate_Actions(P_Action Varchar2
161 , P_Action_Level Number -- 1 Header, 2 Line, 3 Deliverable
162 , P_Header_Id Number
163 , P_Line_Id Number
164 , P_Deliverable_Id Number
165 , X_Return_Status OUT NOCOPY Varchar2
166 , X_Msg_Data OUT NOCOPY Varchar2
167 , X_Msg_Count OUT NOCOPY Number) Is
168
169
170 L_Ship_To_Location_Id Number;
171 L_Ship_To_Location Varchar2(80);
172 L_WorkDate Date;
173 L_Id Number;
174 L_Po_Id Number;
175 L_Delivery_Id Number;
176
177 L_Msg_Count Number;
178 L_Msg_Data Varchar2(2000);
179 L_Item Varchar2(240);
180 L_Org Varchar2(240);
181 L_Contract_Number Varchar2(450);
182 L_Inventory_Org_Id Number;
183 L_Header_Id Number;
184 L_Line_Number Varchar2(450);
185 L_Return_Status Varchar2(1) := Oke_Api.G_Ret_Sts_Success;
186 Debug_Counter Number := 0;
187 Counter Number := 0;
188
189 Cursor MDS_C1(P_Id Number) Is
190 Select B.Contract_Number
191 , B.Currency_Code
192 , B.Buy_Or_Sell
193 , H.Country_Of_Origin_Code
194 , Deliverable_Id
195 , Deliverable_Num
196 , D.Inspection_Req_Flag
197 , I.Description Item_Description
198 , D.Item_Id
199 , I.Name Item
200 , D.Inventory_Org_Id
201 , D.Project_Id
202 , P.Segment1 Project_Number
203 , D.Quantity
204 , D.Expected_Shipment_Date
205 , D.Ndb_Schedule_Designator
206 , D.ship_to_location_id
207 , D.Task_Id
208 , T.Task_Number
209 , S.Sts_Code
210 , D.Unit_Number
211 , D.Uom_Code
212 , D.Dependency_Flag
213 , D.K_Line_Id
214 , D.Mps_Transaction_Id
215 , D.Ship_From_Org_Id
216 , D.Ship_To_Org_Id
217 , D.Direction
218 From oke_k_deliverables_b d
219 , pa_projects_all p
220 , pa_tasks t
221 , oke_system_items_v i
222 , oke_k_headers h
223 , okc_k_headers_b b
224 , okc_k_lines_b s
225 Where D.K_Header_Id = P_Id
226 And B.Id = D.K_Header_Id
227 And H.K_Header_Id = B.Id
228 And D.Project_Id = P.Project_Id(+)
229 And D.Task_Id = T.Task_Id(+)
230 And D.Item_Id = I.Id1
231 And D.Inventory_Org_Id = I.Id2
232 And D.K_Line_Id = S.Id
233 And D.Create_Demand = 'Y'
234 --bug 8320909 start
235 And Not Exists
236 (SELECT Schedule_quantity
237 FROM mrp_schedule_dates
238 WHERE Mps_Transaction_ID =D. Mps_Transaction_Id
239 AND Schedule_Level = 2
240 AND Supply_Demand_Type = 1
241 AND Schedule_quantity=0);
242 --bug 8320909 end
243 Cursor MDS_C2(P_Id Number) Is
244 Select B.Contract_Number
245 , B.Currency_Code
246 , B.Buy_Or_Sell
247 , H.Country_Of_Origin_Code
248 , Deliverable_Id
249 , Deliverable_Num
250 , D.Inspection_Req_Flag
251 , I.Description Item_Description
252 , D.Item_Id
253 , I.Name Item
254 , D.Inventory_Org_Id
255 , D.Project_Id
256 , P.Segment1 Project_Number
257 , D.Quantity
258 , D.Expected_Shipment_Date
259 , D.Ndb_Schedule_Designator
260 , D.ship_to_location_id
261 , D.Task_Id
262 , T.Task_Number
263 , S.Sts_Code
264 , D.Unit_Number
265 , D.Uom_Code
266 , D.Dependency_Flag
267 , D.K_Line_Id
268 , D.Mps_Transaction_Id
269 , D.Ship_From_Org_Id
270 , D.Ship_To_Org_Id
271 , D.Direction
272 From oke_k_deliverables_b d
273 , pa_projects_all p
274 , pa_tasks t
275 , oke_system_items_v i
276 , oke_k_headers h
277 , okc_k_headers_b b
278 , okc_k_lines_b s
279 Where D.K_Line_Id = P_Id
280 And B.Id = D.K_Header_Id
281 And H.K_Header_Id = B.Id
282 And D.Project_Id = P.Project_Id(+)
283 And D.Task_Id = T.Task_Id(+)
284 And D.Item_Id = I.Id1
285 And D.Inventory_Org_Id = I.Id2
286 And D.K_Line_Id = S.Id
287 And D.Create_Demand = 'Y'
288 --bug 8320909 start
289 And Not Exists
290 (SELECT Schedule_quantity
291 FROM mrp_schedule_dates
292 WHERE Mps_Transaction_ID =D. Mps_Transaction_Id
293 AND Schedule_Level = 2
294 AND Supply_Demand_Type = 1
295 AND Schedule_quantity=0);
296 --bug 8320909 end
297 Cursor MDS_C3(P_Id Number) Is
298 Select B.Contract_Number
299 , B.Currency_Code
300 , B.Buy_Or_Sell
301 , H.Country_Of_Origin_Code
302 , Deliverable_Id
303 , Deliverable_Num
304 , D.Inspection_Req_Flag
305 , I.Description Item_Description
306 , D.Item_Id
307 , I.Name Item
308 , D.Inventory_Org_Id
309 , D.Project_Id
310 , P.Segment1 Project_Number
311 , D.Quantity
312 , D.Expected_Shipment_Date
313 , D.Ndb_Schedule_Designator
314 , D.ship_to_location_id
315 , D.Task_Id
316 , T.Task_Number
317 , S.Sts_Code
318 , D.Unit_Number
319 , D.Uom_Code
320 , D.Dependency_Flag
321 , D.K_Line_Id
322 , D.Mps_Transaction_Id
323 , D.Ship_From_Org_Id
324 , D.Ship_To_Org_Id
325 , D.Direction
326 From oke_k_deliverables_b d
327 , pa_projects_all p
328 , pa_tasks t
329 , oke_system_items_v i
330 , oke_k_headers h
331 , okc_k_headers_b b
332 , okc_k_lines_b s
333 Where D.Deliverable_Id = P_Id
334 And B.Id = D.K_Header_Id
335 And H.K_Header_Id = B.Id
336 And D.Project_Id = P.Project_Id(+)
337 And D.Task_Id = T.Task_Id(+)
338 And D.Item_Id = I.Id1
339 And D.Inventory_Org_Id = I.Id2
340 And D.K_Line_Id = S.Id
341 And D.Create_Demand = 'Y';
342
343 Cursor PO_C1(P_Id Number) Is
344 Select B.Contract_Number
345 , B.Currency_Code
346 , B.Buy_Or_Sell
347 , H.Country_Of_Origin_Code
348 , Deliverable_Id
349 , Deliverable_Num
350 , D.Inspection_Req_Flag
351 , D.Item_Id
352 , Decode(D.Item_Id, Null, Null, I.Name) Item
353 , Decode(D.Item_Id, Null, Null, I.Description) Item_Description
354 , D.Inventory_Org_Id
355 , D.Project_Id
356 , P.Segment1 Project_Number
357 , D.Quantity
358 , D.Expected_Shipment_Date
359 , D.Ndb_Schedule_Designator
360 , D.ship_to_location_id
361 , D.Task_Id
362 , T.Task_Number
363 , S.Sts_Code
364 , D.Unit_Number
365 , D.Uom_Code
366 , D.Dependency_Flag
367 , D.K_Line_Id
368 , D.Mps_Transaction_Id
369 , D.Ship_From_Org_Id
370 , D.Ship_To_Org_Id
371 , D.Direction
372 From oke_k_deliverables_b d
373 , pa_projects_all p
374 , pa_tasks t
375 , oke_system_items_v i
376 , oke_k_headers h
377 , okc_k_headers_b b
378 , okc_k_lines_b s
379 Where D.K_Header_Id = P_Id
380 And B.Id = D.K_Header_Id
381 And H.K_Header_Id = B.Id
382 And D.Project_Id = P.Project_Id(+)
383 And D.Task_Id = T.Task_Id(+)
384 And D.Item_Id = I.Id1(+)
385 And D.Inventory_Org_Id = I.Id2(+)
386 And D.K_Line_Id = S.Id
387 And D.Ready_To_Procure = 'Y'
388 And ( D.Po_Ref_1 Is Null
389 Or Exists ( Select 'X' From po_requisitions_interface_all p
390 Where P.Oke_Contract_Deliverable_ID = D.Deliverable_ID
391 And Nvl(P.Process_Flag, 'S') = 'ERROR'
392 And Nvl(P.Batch_ID, 0) = Nvl(D.Po_Ref_1, 0)));
393
394 Cursor PO_C2(P_Id Number) Is
395 Select B.Contract_Number
396 , B.Currency_Code
397 , B.Buy_Or_Sell
398 , H.Country_Of_Origin_Code
399 , Deliverable_Id
400 , Deliverable_Num
401 , D.Inspection_Req_Flag
402 , D.Item_Id
403 , Decode(D.Item_Id, Null, Null, I.Name) Item
404 , Decode(D.Item_Id, Null, Null, I.Description) Item_Description
405 , D.Inventory_Org_Id
406 , D.Project_Id
407 , P.Segment1 Project_Number
408 , D.Quantity
409 , D.Expected_Shipment_Date
410 , D.Ndb_Schedule_Designator
411 , D.ship_to_location_id
412 , D.Task_Id
413 , T.Task_Number
414 , S.Sts_Code
415 , D.Unit_Number
416 , D.Uom_Code
417 , D.Dependency_Flag
418 , D.K_Line_Id
419 , D.Mps_Transaction_Id
420 , D.Ship_From_Org_Id
421 , D.Ship_To_Org_Id
422 , D.Direction
423 From oke_k_deliverables_b d
424 , pa_projects_all p
425 , pa_tasks t
426 , oke_system_items_v i
427 , oke_k_headers h
428 , okc_k_headers_b b
429 , okc_k_lines_b s
430 Where D.K_Line_Id = P_Id
431 And B.Id = D.K_Header_Id
432 And H.K_Header_Id = B.Id
433 And D.Project_Id = P.Project_Id(+)
434 And D.Task_Id = T.Task_Id(+)
435 And D.Item_Id = I.Id1(+)
436 And D.Inventory_Org_Id = I.Id2(+)
437 And D.K_Line_Id = S.Id
438 And D.Ready_To_Procure = 'Y'
439 And ( D.Po_Ref_1 Is Null
440 Or Exists ( Select 'X' From po_requisitions_interface_all p
441 Where P.Oke_Contract_Deliverable_ID = D.Deliverable_ID
442 And Nvl(P.Process_Flag, 'S') = 'ERROR'
443 And Nvl(P.Batch_ID, 0) = Nvl(D.Po_Ref_1, 0)));
444
445 Cursor PO_C3(P_Id Number) Is
446 Select B.Contract_Number
447 , B.Currency_Code
448 , B.Buy_Or_Sell
449 , H.Country_Of_Origin_Code
450 , Deliverable_Id
451 , Deliverable_Num
452 , D.Inspection_Req_Flag
453 , D.Item_Id
454 , Decode(D.Item_Id, Null, Null, I.Name) Item
455 , Decode(D.Item_Id, Null, Null, I.Description) Item_Description
456 , D.Inventory_Org_Id
457 , D.Project_Id
458 , P.Segment1 Project_Number
459 , D.Quantity
460 , D.Expected_Shipment_Date
461 , D.Ndb_Schedule_Designator
462 , D.ship_to_location_id
463 , D.Task_Id
464 , T.Task_Number
465 , S.Sts_Code
466 , D.Unit_Number
467 , D.Uom_Code
468 , D.Dependency_Flag
469 , D.K_Line_Id
470 , D.Mps_Transaction_Id
471 , D.Ship_From_Org_Id
472 , D.Ship_To_Org_Id
473 , D.Direction
474 From oke_k_deliverables_b d
475 , pa_projects_all p
476 , pa_tasks t
477 , oke_system_items_v i
478 , oke_k_headers h
479 , okc_k_headers_b b
480 , okc_k_lines_b s
481 Where D.Deliverable_Id = P_Id
482 And B.Id = D.K_Header_Id
483 And H.K_Header_Id = B.Id
484 And D.Project_Id = P.Project_Id(+)
485 And D.Task_Id = T.Task_Id(+)
486 And D.Item_Id = I.Id1(+)
487 And D.Inventory_Org_Id = I.Id2(+)
488 And D.K_Line_Id = S.Id
489 And D.Ready_To_Procure = 'Y';
490
491 Cursor Wsh_C1(P_Id Number) Is
492 Select B.Contract_Number
493 , B.Currency_Code
494 , B.Buy_Or_Sell
495 , H.Country_Of_Origin_Code
496 , Deliverable_Id
497 , Deliverable_Num
498 , D.Inspection_Req_Flag
499 , D.Item_Id
500 , Decode(D.Item_Id, Null, Null, I.Name) Item
501 , Decode(D.Item_Id, Null, Null, I.Description) Item_Description
502 , D.Inventory_Org_Id
503 , D.Project_Id
504 , P.Segment1 Project_Number
505 , D.Quantity
506 , D.Expected_Shipment_Date
507 , D.Ndb_Schedule_Designator
508 , D.ship_to_location_id
509 , D.Task_Id
510 , T.Task_Number
511 , S.Sts_Code
512 , D.Unit_Number
513 , D.Uom_Code
514 , D.Dependency_Flag
515 , D.K_Line_Id
516 , D.Mps_Transaction_Id
517 , D.Ship_From_Org_Id
518 , D.Ship_To_Org_Id
519 , D.Direction
520 From oke_k_deliverables_b d
521 , pa_projects_all p
522 , pa_tasks t
523 , oke_system_items_v i
524 , oke_k_headers h
525 , okc_k_headers_b b
526 , okc_k_lines_b s
527 Where D.K_Header_Id = P_Id
528 And B.Id = D.K_Header_Id
529 And H.K_Header_Id = B.Id
530 And D.Project_Id = P.Project_Id(+)
531 And D.Task_Id = T.Task_Id(+)
532 And D.Item_Id = I.Id1(+)
533 And D.Inventory_Org_Id = I.Id2(+)
534 And D.K_Line_Id = S.Id
535 And D.Available_For_Ship_Flag = 'Y'
536 And D.Shipping_Request_Id Is Null;
537
538 Cursor Wsh_C2(P_Id Number) Is
539 Select B.Contract_Number
540 , B.Currency_Code
541 , B.Buy_Or_Sell
542 , H.Country_Of_Origin_Code
543 , Deliverable_Id
544 , Deliverable_Num
545 , D.Inspection_Req_Flag
546 , D.Item_Id
547 , Decode(D.Item_Id, Null, Null, I.Name) Item
548 , Decode(D.Item_Id, Null, Null, I.Description) Item_Description
549 , D.Inventory_Org_Id
550 , D.Project_Id
551 , P.Segment1 Project_Number
552 , D.Quantity
553 , D.Expected_Shipment_Date
554 , D.Ndb_Schedule_Designator
555 , D.ship_to_location_id
556 , D.Task_Id
557 , T.Task_Number
558 , S.Sts_Code
559 , D.Unit_Number
560 , D.Uom_Code
561 , D.Dependency_Flag
562 , D.K_Line_Id
563 , D.Mps_Transaction_Id
564 , D.Ship_From_Org_Id
565 , D.Ship_To_Org_Id
566 , D.Direction
567 From oke_k_deliverables_b d
568 , pa_projects_all p
569 , pa_tasks t
570 , oke_system_items_v i
571 , oke_k_headers h
572 , okc_k_headers_b b
573 , okc_k_lines_b s
574 Where D.K_Line_Id = P_Id
575 And B.Id = D.K_Header_Id
576 And H.K_Header_Id = B.Id
577 And D.Project_Id = P.Project_Id(+)
578 And D.Task_Id = T.Task_Id(+)
579 And D.Item_Id = I.Id1(+)
580 And D.Inventory_Org_Id = I.Id2(+)
581 And D.K_Line_Id = S.Id
582 And D.Available_For_Ship_Flag = 'Y'
583 And D.Shipping_Request_Id Is Null;
584
585 Cursor Wsh_C3(P_Id Number) Is
586 Select B.Contract_Number
587 , B.Currency_Code
588 , B.Buy_Or_Sell
589 , H.Country_Of_Origin_Code
590 , Deliverable_Id
591 , Deliverable_Num
592 , D.Inspection_Req_Flag
593 , D.Item_Id
594 , Decode(D.Item_Id, Null, Null, I.Name) Item
595 , Decode(D.Item_Id, Null, Null, I.Description) Item_Description
596 , D.Inventory_Org_Id
597 , D.Project_Id
598 , P.Segment1 Project_Number
599 , D.Quantity
600 , D.Expected_Shipment_Date
601 , D.Ndb_Schedule_Designator
602 , D.ship_to_location_id
603 , D.Task_Id
604 , T.Task_Number
605 , S.Sts_Code
606 , D.Unit_Number
607 , D.Uom_Code
608 , D.Dependency_Flag
609 , D.K_Line_Id
610 , D.Mps_Transaction_Id
611 , D.Ship_From_Org_Id
612 , D.Ship_To_Org_Id
613 , D.Direction
614 From oke_k_deliverables_b d
615 , pa_projects_all p
616 , pa_tasks t
617 , oke_system_items_v i
618 , oke_k_headers h
619 , okc_k_headers_b b
620 , okc_k_lines_b s
621 Where D.Deliverable_Id = P_Id
622 And B.Id = D.K_Header_Id
623 And H.K_Header_Id = B.Id
624 And D.Project_Id = P.Project_Id(+)
625 And D.Task_Id = T.Task_Id(+)
626 And D.Item_Id = I.Id1(+)
627 And D.Inventory_Org_Id = I.Id2(+)
628 And D.K_Line_Id = S.Id
629 And D.Available_For_Ship_Flag = 'Y';
630
631 Cursor Org_C(P_Id Number) Is
632 Select Name
633 From hr_all_organization_units
634 Where Organization_Id = P_Id;
635
636 Cursor Line_C(P_Id Number) Is
637 Select Line_Number
638 From okc_k_lines_b
639 Where Id = P_Id;
640
641
642 Begin
643
644
645
646 If P_Action = 'PLAN' Then
647
648 If P_Action_Level = 1 Then
649
650 For Mds_Rec In Mds_C1(P_Header_Id) Loop
651 L_Inventory_Org_Id := Get_Org(Mds_Rec.Direction
652 , Mds_Rec.Ship_From_Org_Id
653 , Mds_Rec.Ship_To_Org_Id);
654
655 If Check_Operation_Allowed(Mds_Rec.Sts_Code
656 , 'INITIATE_DELV') Then
657
658 If Check_Item_Valid(L_Inventory_Org_Id
659 , Mds_Rec.Item_Id) Then
660
661 If Check_Dependencies(Mds_Rec.Deliverable_Id) Then
662
663 Open Line_C(Mds_Rec.K_Line_Id);
664 Fetch Line_C Into L_Line_Number;
665 Close Line_C;
666
667 Open Org_C(L_Inventory_Org_Id);
668 Fetch Org_C Into L_Org;
669 Close Org_C;
670
671 L_Ship_To_Location := Get_Location(Mds_Rec.Buy_Or_Sell
672 , Mds_Rec.Direction
673 , Mds_Rec.Ship_To_Location_Id);
674
675 Counter := Counter + 1;
676
677 OKE_DTS_INTEGRATION_PKG.Launch_Process(
678 P_Action => P_Action,
679 P_Api_Version => 1,
680 P_country_of_origin_code => Mds_Rec.country_of_origin_code,
681 P_Currency_Code => Mds_Rec.currency_code,
682 P_Deliverable_Id => Mds_Rec.deliverable_id,
683 P_Deliverable_Num => Mds_Rec.deliverable_num,
684 P_Init_Msg_List => 'T',
685 P_Inspection_Reqed => Mds_Rec.inspection_req_flag,
686 P_Item_Description => Mds_Rec.item_description,
687 P_Item_Id => Mds_Rec.item_id,
688 P_Item_Num => Mds_Rec.item,
689 P_K_Header_Id => P_Header_Id,
690 P_K_Number => Mds_Rec.contract_number,
691 P_Line_Number => l_line_number,
692 P_Mps_Transaction_Id => Mds_Rec.mps_transaction_id,
693 P_Organization => l_org,
694 P_Organization_Id => l_inventory_org_id,
695 P_Project_Id => Mds_Rec.project_id,
696 P_Project_Num => Mds_Rec.project_number,
697 P_Quantity => Mds_Rec.quantity,
698 P_Schedule_Date => Mds_Rec.expected_shipment_date,
699 P_Schedule_Designator => Mds_Rec.ndb_schedule_designator,
700 P_Ship_To_Location => l_ship_to_location,
701 P_Task_Id => Mds_Rec.task_id,
702 P_Task_Num => Mds_Rec.task_number,
703 P_Unit_Number => Mds_Rec.unit_number,
704 P_Uom_Code => Mds_Rec.uom_code,
705 P_Work_Date => l_workdate);
706
707 End If; -- Dependency Check
708 End if; -- Item Check
709 End If; -- Operation Check
710
711 Debug_Counter := Debug_Counter + 1;
712
713
714
715 End Loop; -- Record Loop For Header
716
717 ELSIF P_Action_Level = 2 Then
718
719
720 For Mds_Rec In Mds_C2(P_Line_Id) Loop
721
722 L_Inventory_Org_Id := Get_Org(Mds_Rec.Direction
723 , Mds_Rec.Ship_From_Org_Id
724 , Mds_Rec.Ship_To_Org_Id);
725
726 If Check_Operation_Allowed(Mds_Rec.Sts_Code
727 , 'INITIATE_DELV') Then
728
729 If Check_Item_Valid(L_Inventory_Org_Id
730 , Mds_Rec.Item_Id) Then
731
732 If Check_Dependencies(Mds_Rec.Deliverable_Id) Then
733
734 Open Line_C(Mds_Rec.K_Line_Id);
735 Fetch Line_C Into L_Line_Number;
736 Close Line_C;
737
738 Open Org_C(L_Inventory_Org_Id);
739 Fetch Org_C Into L_Org;
740 Close Org_C;
741
742 L_Ship_To_Location := Get_Location(Mds_Rec.Buy_Or_Sell
743 , Mds_Rec.Direction
744 , Mds_Rec.Ship_To_Location_Id);
745 Counter := Counter + 1;
746
747 OKE_DTS_INTEGRATION_PKG.Launch_Process(
748 P_Action => P_Action,
749 P_Api_Version => 1,
750 P_country_of_origin_code => Mds_Rec.country_of_origin_code,
751 P_Currency_Code => Mds_Rec.currency_code,
752 P_Deliverable_Id => Mds_Rec.deliverable_id,
753 P_Deliverable_Num => Mds_Rec.deliverable_num,
754 P_Init_Msg_List => 'T',
755 P_Inspection_Reqed => Mds_Rec.inspection_req_flag,
756 P_Item_Description => Mds_Rec.item_description,
757 P_Item_Id => Mds_Rec.item_id,
758 P_Item_Num => Mds_Rec.item,
759 P_K_Header_Id => P_Header_Id,
760 P_K_Number => Mds_Rec.contract_number,
761 P_Line_Number => l_line_number,
762 P_Mps_Transaction_Id => Mds_Rec.mps_transaction_id,
763 P_Organization => l_org,
764 P_Organization_Id => l_inventory_org_id,
765 P_Project_Id => Mds_Rec.project_id,
766 P_Project_Num => Mds_Rec.project_number,
767 P_Quantity => Mds_Rec.quantity,
768 P_Schedule_Date => Mds_Rec.expected_shipment_date,
769 P_Schedule_Designator => Mds_Rec.ndb_schedule_designator,
770 P_Ship_To_Location => l_ship_to_location,
771 P_Task_Id => Mds_Rec.task_id,
772 P_Task_Num => Mds_Rec.task_number,
773 P_Unit_Number => Mds_Rec.unit_number,
774 P_Uom_Code => Mds_Rec.uom_code,
775 P_Work_Date => l_workdate);
776
777 End If; -- Dependency Check
778 End if; -- Item Check
779 End If; -- Operation Check
780
781 Debug_Counter := Debug_Counter + 1;
782
783 End Loop; -- Record Loop For MDS Line
784
785 ELSIF P_Action_Level = 3 Then
786
787 For Mds_Rec In Mds_C3(P_Deliverable_Id) Loop
788 L_Inventory_Org_Id := Get_Org(Mds_Rec.Direction
789 , Mds_Rec.Ship_From_Org_Id
790 , Mds_Rec.Ship_To_Org_Id);
791
792 If Check_Operation_Allowed(Mds_Rec.Sts_Code
793 , 'INITIATE_DELV') Then
794
795 If Check_Item_Valid(L_Inventory_Org_Id
796 , Mds_Rec.Item_Id) Then
797
798 If Check_Dependencies(Mds_Rec.Deliverable_Id) Then
799
800 Open Line_C(Mds_Rec.K_Line_Id);
801 Fetch Line_C Into L_Line_Number;
802 Close Line_C;
803
804 Open Org_C(L_Inventory_Org_Id);
805 Fetch Org_C Into L_Org;
806 Close Org_C;
807
808 L_Ship_To_Location := Get_Location(Mds_Rec.Buy_Or_Sell
809 , Mds_Rec.Direction
810 , Mds_Rec.Ship_To_Location_Id);
811
812 Counter := Counter + 1;
813 OKE_DTS_INTEGRATION_PKG.Launch_Process(
814 P_Action => P_Action,
815 P_Api_Version => 1,
816 P_country_of_origin_code => Mds_Rec.country_of_origin_code,
817 P_Currency_Code => Mds_Rec.currency_code,
818 P_Deliverable_Id => Mds_Rec.deliverable_id,
819 P_Deliverable_Num => Mds_Rec.deliverable_num,
820 P_Init_Msg_List => 'T',
821 P_Inspection_Reqed => Mds_Rec.inspection_req_flag,
822 P_Item_Description => Mds_Rec.item_description,
823 P_Item_Id => Mds_Rec.item_id,
824 P_Item_Num => Mds_Rec.item,
825 P_K_Header_Id => P_Header_Id,
826 P_K_Number => Mds_Rec.contract_number,
827 P_Line_Number => l_line_number,
828 P_Mps_Transaction_Id => Mds_Rec.mps_transaction_id,
829 P_Organization => l_org,
830 P_Organization_Id => l_inventory_org_id,
831 P_Project_Id => Mds_Rec.project_id,
832 P_Project_Num => Mds_Rec.project_number,
833 P_Quantity => Mds_Rec.quantity,
834 P_Schedule_Date => Mds_Rec.expected_shipment_date,
835 P_Schedule_Designator => Mds_Rec.ndb_schedule_designator,
836 P_Ship_To_Location => l_ship_to_location,
837 P_Task_Id => Mds_Rec.task_id,
838 P_Task_Num => Mds_Rec.task_number,
839 P_Unit_Number => Mds_Rec.unit_number,
840 P_Uom_Code => Mds_Rec.uom_code,
841 P_Work_Date => l_workdate);
842
843 End If; -- Dependency Check
844 End if; -- Item Check
845 End If; -- Operation Check
846 End Loop; -- Record Loop For MDS Deliverable
847 End If; -- End Level If
848
849 Elsif P_Action = 'SHIP' Then
850
851
852 If P_Action_Level = 1 Then
853
854
855 For Wsh_Rec In Wsh_C1(P_Header_Id) Loop
856 L_Inventory_Org_Id := Get_Org(Wsh_Rec.Direction
857 , Wsh_Rec.Ship_From_Org_Id
858 , Wsh_Rec.Ship_To_Org_Id);
859
860 If Check_Operation_Allowed(Wsh_Rec.Sts_Code
861 , 'INITIATE_DELV') Then
862
863 If Check_Item_Valid(L_Inventory_Org_Id
864 , Wsh_Rec.Item_Id) Then
865
866 If Check_Dependencies(Wsh_Rec.Deliverable_Id) Then
867
868 Open Line_C(Wsh_Rec.K_Line_Id);
869 Fetch Line_C Into L_Line_Number;
870 Close Line_C;
871
872 Open Org_C(L_Inventory_Org_Id);
873 Fetch Org_C Into L_Org;
874 Close Org_C;
875
876 L_Ship_To_Location := Get_Location(Wsh_Rec.Buy_Or_Sell
877 , Wsh_Rec.Direction
878 , Wsh_Rec.Ship_To_Location_Id);
879 Counter := Counter + 1;
880
881 OKE_DTS_INTEGRATION_PKG.Launch_Process(
882 P_Action => P_Action,
883 P_Api_Version => 1,
884 P_country_of_origin_code => Wsh_Rec.country_of_origin_code,
885 P_Currency_Code => Wsh_Rec.currency_code,
886 P_Deliverable_Id => Wsh_Rec.deliverable_id,
887 P_Deliverable_Num => Wsh_Rec.deliverable_num,
888 P_Init_Msg_List => 'T',
889 P_Inspection_Reqed => Wsh_Rec.inspection_req_flag,
890 P_Item_Description => Wsh_Rec.item_description,
891 P_Item_Id => Wsh_Rec.item_id,
892 P_Item_Num => Wsh_Rec.item,
893 P_K_Header_Id => P_Header_Id,
894 P_K_Number => Wsh_Rec.contract_number,
895 P_Line_Number => l_line_number,
896 P_Mps_Transaction_Id => Wsh_Rec.mps_transaction_id,
897 P_Organization => l_org,
898 P_Organization_Id => l_inventory_org_id,
899 P_Project_Id => Wsh_Rec.project_id,
900 P_Project_Num => Wsh_Rec.project_number,
901 P_Quantity => Wsh_Rec.quantity,
902 P_Schedule_Date => Wsh_Rec.expected_shipment_date,
903 P_Schedule_Designator => Wsh_Rec.ndb_schedule_designator,
904 P_Ship_To_Location => l_ship_to_location,
905 P_Task_Id => Wsh_Rec.task_id,
906 P_Task_Num => Wsh_Rec.task_number,
907 P_Unit_Number => Wsh_Rec.unit_number,
908 P_Uom_Code => Wsh_Rec.uom_code,
909 P_Work_Date => l_workdate);
910
911 End If; -- Dependency Check
912 End if; -- Item Check
913 End If; -- Operation Check
914
915 Debug_Counter := Debug_Counter + 1;
916
917 End Loop; -- Record Loop For Header
918
919
920 ELSIF P_Action_Level = 2 Then
921
922
923 For Wsh_Rec In Wsh_C2(P_Line_Id) Loop
924 L_Inventory_Org_Id := Get_Org(Wsh_Rec.Direction
925 , Wsh_Rec.Ship_From_Org_Id
926 , Wsh_Rec.Ship_To_Org_Id);
927
928 If Check_Operation_Allowed(Wsh_Rec.Sts_Code
929 , 'INITIATE_DELV') Then
930
931 If Check_Item_Valid(L_Inventory_Org_Id
932 , Wsh_Rec.Item_Id) Then
933
934 If Check_Dependencies(Wsh_Rec.Deliverable_Id) Then
935
936 Open Line_C(Wsh_Rec.K_Line_Id);
937 Fetch Line_C Into L_Line_Number;
938 Close Line_C;
939
940 Open Org_C(L_Inventory_Org_Id);
941 Fetch Org_C Into L_Org;
942 Close Org_C;
943
944 L_Ship_To_Location := Get_Location(Wsh_Rec.Buy_Or_Sell
945 , Wsh_Rec.Direction
946 , Wsh_Rec.Ship_To_Location_Id);
947 Counter := Counter + 1;
948
949 OKE_DTS_INTEGRATION_PKG.Launch_Process(
950 P_Action => P_Action,
951 P_Api_Version => 1,
952 P_country_of_origin_code => Wsh_Rec.country_of_origin_code,
953 P_Currency_Code => Wsh_Rec.currency_code,
954 P_Deliverable_Id => Wsh_Rec.deliverable_id,
955 P_Deliverable_Num => Wsh_Rec.deliverable_num,
956 P_Init_Msg_List => 'T',
957 P_Inspection_Reqed => Wsh_Rec.inspection_req_flag,
958 P_Item_Description => Wsh_Rec.item_description,
959 P_Item_Id => Wsh_Rec.item_id,
960 P_Item_Num => Wsh_Rec.item,
961 P_K_Header_Id => P_Header_Id,
962 P_K_Number => Wsh_Rec.contract_number,
963 P_Line_Number => l_line_number,
964 P_Mps_Transaction_Id => Wsh_Rec.mps_transaction_id,
965 P_Organization => l_org,
966 P_Organization_Id => l_inventory_org_id,
967 P_Project_Id => Wsh_Rec.project_id,
968 P_Project_Num => Wsh_Rec.project_number,
969 P_Quantity => Wsh_Rec.quantity,
970 P_Schedule_Date => Wsh_Rec.expected_shipment_date,
971 P_Schedule_Designator => Wsh_Rec.ndb_schedule_designator,
972 P_Ship_To_Location => l_ship_to_location,
973 P_Task_Id => Wsh_Rec.task_id,
974 P_Task_Num => Wsh_Rec.task_number,
975 P_Unit_Number => Wsh_Rec.unit_number,
976 P_Uom_Code => Wsh_Rec.uom_code,
977 P_Work_Date => l_workdate);
978
979 End If; -- Dependency Check
980 End if; -- Item Check
981 End If; -- Operation Check
982
983 Debug_Counter := Debug_Counter + 1;
984
985 End Loop; -- Record Loop For MDS Line
986
987
988 ELSIF P_Action_Level = 3 Then
989
990
991 For Wsh_Rec In Wsh_C3(P_Deliverable_Id) Loop
992 L_Inventory_Org_Id := Get_Org(Wsh_Rec.Direction
993 , Wsh_Rec.Ship_From_Org_Id
994 , Wsh_Rec.Ship_To_Org_Id);
995
996
997 If Check_Operation_Allowed(Wsh_Rec.Sts_Code
998 , 'INITIATE_DELV') Then
999
1000 If Check_Item_Valid(L_Inventory_Org_Id
1001 , Wsh_Rec.Item_Id) Then
1002
1003
1004 If Check_Dependencies(Wsh_Rec.Deliverable_Id) Then
1005
1006
1007 Open Line_C(Wsh_Rec.K_Line_Id);
1008 Fetch Line_C Into L_Line_Number;
1009 Close Line_C;
1010
1011 Open Org_C(L_Inventory_Org_Id);
1012 Fetch Org_C Into L_Org;
1013 Close Org_C;
1014
1015 L_Ship_To_Location := Get_Location(Wsh_Rec.Buy_Or_Sell
1016 , Wsh_Rec.Direction
1017 , Wsh_Rec.Ship_To_Location_Id);
1018 Counter := Counter + 1;
1019
1020 OKE_DTS_INTEGRATION_PKG.Launch_Process(
1021 P_Action => P_Action,
1022 P_Api_Version => 1,
1023 P_country_of_origin_code => Wsh_Rec.country_of_origin_code,
1024 P_Currency_Code => Wsh_Rec.currency_code,
1025 P_Deliverable_Id => Wsh_Rec.deliverable_id,
1026 P_Deliverable_Num => Wsh_Rec.deliverable_num,
1027 P_Init_Msg_List => 'T',
1028 P_Inspection_Reqed => Wsh_Rec.inspection_req_flag,
1029 P_Item_Description => Wsh_Rec.item_description,
1030 P_Item_Id => Wsh_Rec.item_id,
1031 P_Item_Num => Wsh_Rec.item,
1032 P_K_Header_Id => P_Header_Id,
1033 P_K_Number => Wsh_Rec.contract_number,
1034 P_Line_Number => l_line_number,
1035 P_Mps_Transaction_Id => Wsh_Rec.mps_transaction_id,
1036 P_Organization => l_org,
1037 P_Organization_Id => l_inventory_org_id,
1038 P_Project_Id => Wsh_Rec.project_id,
1039 P_Project_Num => Wsh_Rec.project_number,
1040 P_Quantity => Wsh_Rec.quantity,
1041 P_Schedule_Date => Wsh_Rec.expected_shipment_date,
1042 P_Schedule_Designator => Wsh_Rec.ndb_schedule_designator,
1043 P_Ship_To_Location => l_ship_to_location,
1044 P_Task_Id => Wsh_Rec.task_id,
1045 P_Task_Num => Wsh_Rec.task_number,
1046 P_Unit_Number => Wsh_Rec.unit_number,
1047 P_Uom_Code => Wsh_Rec.uom_code,
1048 P_Work_Date => l_workdate);
1049
1050 End If; -- Dependency Check
1051 End if; -- Item Check
1052 End If; -- Operation Check
1053 End Loop; -- Record Loop For MDS Deliverable
1054 End If; -- End Level If
1055
1056 Elsif P_Action = 'REQ' Then
1057
1058
1059 If P_Action_Level = 1 Then
1060
1061 For Po_Rec In Po_C1(P_Header_Id) Loop
1062 L_Inventory_Org_Id := Get_Org(Po_Rec.Direction
1063 , Po_Rec.Ship_From_Org_Id
1064 , Po_Rec.Ship_To_Org_Id);
1065
1066 If Check_Operation_Allowed(Po_Rec.Sts_Code
1067 , 'INITIATE_DELV') Then
1068
1069 If Check_Item_Valid(L_Inventory_Org_Id
1070 , Po_Rec.Item_Id) Then
1071
1072 If Check_Dependencies(Po_Rec.Deliverable_Id) Then
1073
1074 Open Line_C(Po_Rec.K_Line_Id);
1075 Fetch Line_C Into L_Line_Number;
1076 Close Line_C;
1077
1078 Open Org_C(L_Inventory_Org_Id);
1079 Fetch Org_C Into L_Org;
1080 Close Org_C;
1081
1082 L_Ship_To_Location := Get_Location(Po_Rec.Buy_Or_Sell
1083 , Po_Rec.Direction
1084 , Po_Rec.Ship_To_Location_Id);
1085 Counter := Counter + 1;
1086
1087 OKE_DTS_INTEGRATION_PKG.Launch_Process(
1088 P_Action => P_Action,
1089 P_Api_Version => 1,
1090 P_country_of_origin_code => Po_Rec.country_of_origin_code,
1091 P_Currency_Code => Po_Rec.currency_code,
1092 P_Deliverable_Id => Po_Rec.deliverable_id,
1093 P_Deliverable_Num => Po_Rec.deliverable_num,
1094 P_Init_Msg_List => 'T',
1095 P_Inspection_Reqed => Po_Rec.inspection_req_flag,
1096 P_Item_Description => Po_Rec.item_description,
1097 P_Item_Id => Po_Rec.item_id,
1098 P_Item_Num => Po_Rec.item,
1099 P_K_Header_Id => P_Header_Id,
1100 P_K_Number => Po_Rec.contract_number,
1101 P_Line_Number => l_line_number,
1102 P_Mps_Transaction_Id => Po_Rec.mps_transaction_id,
1103 P_Organization => l_org,
1104 P_Organization_Id => l_inventory_org_id,
1105 P_Project_Id => Po_Rec.project_id,
1106 P_Project_Num => Po_Rec.project_number,
1107 P_Quantity => Po_Rec.quantity,
1108 P_Schedule_Date => Po_Rec.expected_shipment_date,
1109 P_Schedule_Designator => Po_Rec.ndb_schedule_designator,
1110 P_Ship_To_Location => l_ship_to_location,
1111 P_Task_Id => Po_Rec.task_id,
1112 P_Task_Num => Po_Rec.task_number,
1113 P_Unit_Number => Po_Rec.unit_number,
1114 P_Uom_Code => Po_Rec.uom_code,
1115 P_Work_Date => l_workdate);
1116
1117 End If; -- Dependency Check
1118 End if; -- Item Check
1119 End If; -- Operation Check
1120
1121 Debug_Counter := Debug_Counter + 1;
1122
1123 End Loop; -- Record Loop For Header
1124
1125
1126 ELSIF P_Action_Level = 2 Then
1127
1128 For Po_Rec In Po_C2(P_Line_Id) Loop
1129 L_Inventory_Org_Id := Get_Org(Po_Rec.Direction
1130 , Po_Rec.Ship_From_Org_Id
1131 , Po_Rec.Ship_To_Org_Id);
1132
1133
1134
1135 If Check_Operation_Allowed(Po_Rec.Sts_Code
1136 , 'INITIATE_DELV') Then
1137
1138 If Check_Item_Valid(L_Inventory_Org_Id
1139 , Po_Rec.Item_Id) Then
1140
1141 If Check_Dependencies(Po_Rec.Deliverable_Id) Then
1142
1143 Open Line_C(Po_Rec.K_Line_Id);
1144 Fetch Line_C Into L_Line_Number;
1145 Close Line_C;
1146
1147 Open Org_C(L_Inventory_Org_Id);
1148 Fetch Org_C Into L_Org;
1149 Close Org_C;
1150
1151 L_Ship_To_Location := Get_Location(Po_Rec.Buy_Or_Sell
1152 , Po_Rec.Direction
1153 , Po_Rec.Ship_To_Location_Id);
1154 Counter := Counter + 1;
1155
1156 OKE_DTS_INTEGRATION_PKG.Launch_Process(
1157 P_Action => P_Action,
1158 P_Api_Version => 1,
1159 P_country_of_origin_code => Po_Rec.country_of_origin_code,
1160 P_Currency_Code => Po_Rec.currency_code,
1161 P_Deliverable_Id => Po_Rec.deliverable_id,
1162 P_Deliverable_Num => Po_Rec.deliverable_num,
1163 P_Init_Msg_List => 'T',
1164 P_Inspection_Reqed => Po_Rec.inspection_req_flag,
1165 P_Item_Description => Po_Rec.item_description,
1166 P_Item_Id => Po_Rec.item_id,
1167 P_Item_Num => Po_Rec.item,
1168 P_K_Header_Id => P_Header_Id,
1169 P_K_Number => Po_Rec.contract_number,
1170 P_Line_Number => l_line_number,
1171 P_Mps_Transaction_Id => Po_Rec.mps_transaction_id,
1172 P_Organization => l_org,
1173 P_Organization_Id => l_inventory_org_id,
1174 P_Project_Id => Po_Rec.project_id,
1175 P_Project_Num => Po_Rec.project_number,
1176 P_Quantity => Po_Rec.quantity,
1177 P_Schedule_Date => Po_Rec.expected_shipment_date,
1178 P_Schedule_Designator => Po_Rec.ndb_schedule_designator,
1179 P_Ship_To_Location => l_ship_to_location,
1180 P_Task_Id => Po_Rec.task_id,
1181 P_Task_Num => Po_Rec.task_number,
1182 P_Unit_Number => Po_Rec.unit_number,
1183 P_Uom_Code => Po_Rec.uom_code,
1184 P_Work_Date => l_workdate);
1185
1186 End If; -- Dependency Check
1187 End if; -- Item Check
1188 End If; -- Operation Check
1189
1190 Debug_Counter := Debug_Counter + 1;
1191
1192 End Loop; -- Record Loop For MDS Line
1193
1194
1195 ELSIF P_Action_Level = 3 Then
1196
1197
1198 For Po_Rec In Po_C3(P_Deliverable_Id) Loop
1199 L_Inventory_Org_Id := Get_Org(Po_Rec.Direction
1200 , Po_Rec.Ship_From_Org_Id
1201 , Po_Rec.Ship_To_Org_Id);
1202
1203 If Check_Operation_Allowed(Po_Rec.Sts_Code
1204 , 'INITIATE_DELV') Then
1205
1206 If Check_Item_Valid(L_Inventory_Org_Id
1207 , Po_Rec.Item_Id) Then
1208
1209 If Check_Dependencies(Po_Rec.Deliverable_Id) Then
1210
1211 Open Line_C(Po_Rec.K_Line_Id);
1212 Fetch Line_C Into L_Line_Number;
1213 Close Line_C;
1214
1215 Open Org_C(L_Inventory_Org_Id);
1216 Fetch Org_C Into L_Org;
1217 Close Org_C;
1218
1219 L_Ship_To_Location := Get_Location(Po_Rec.Buy_Or_Sell
1220 , Po_Rec.Direction
1221 , Po_Rec.Ship_To_Location_Id);
1222 Counter := Counter + 1;
1223
1224
1225 OKE_DTS_INTEGRATION_PKG.Launch_Process(
1226 P_Action => P_Action,
1227 P_Api_Version => 1,
1228 P_country_of_origin_code => Po_Rec.country_of_origin_code,
1229 P_Currency_Code => Po_Rec.currency_code,
1230 P_Deliverable_Id => Po_Rec.deliverable_id,
1231 P_Deliverable_Num => Po_Rec.deliverable_num,
1232 P_Init_Msg_List => 'T',
1233 P_Inspection_Reqed => Po_Rec.inspection_req_flag,
1234 P_Item_Description => Po_Rec.item_description,
1235 P_Item_Id => Po_Rec.item_id,
1236 P_Item_Num => Po_Rec.item,
1237 P_K_Header_Id => P_Header_Id,
1238 P_K_Number => Po_Rec.contract_number,
1239 P_Line_Number => l_line_number,
1240 P_Mps_Transaction_Id => Po_Rec.mps_transaction_id,
1241 P_Organization => l_org,
1242 P_Organization_Id => l_inventory_org_id,
1243 P_Project_Id => Po_Rec.project_id,
1244 P_Project_Num => Po_Rec.project_number,
1245 P_Quantity => Po_Rec.quantity,
1246 P_Schedule_Date => Po_Rec.expected_shipment_date,
1247 P_Schedule_Designator => Po_Rec.ndb_schedule_designator,
1248 P_Ship_To_Location => l_ship_to_location,
1249 P_Task_Id => Po_Rec.task_id,
1250 P_Task_Num => Po_Rec.task_number,
1251 P_Unit_Number => Po_Rec.unit_number,
1252 P_Uom_Code => Po_Rec.uom_code,
1253 P_Work_Date => l_workdate);
1254
1255 End If; -- Dependency Check
1256 End if; -- Item Check
1257 End If; -- Operation Check
1258 End Loop; -- Record Loop For MDS Deliverable
1259 End If; -- End Level If
1260
1261 End If; -- End Action Type If
1262
1263
1264
1265
1266 --
1267 -- No error handling added yet
1268 --
1269 X_Return_Status := oke_api.g_ret_sts_success;
1270
1271 g_Counter := Counter;
1272
1273 End Initiate_Actions;
1274
1275 PROCEDURE Initiate_Actions_CP(
1276 ERRBUF OUT NOCOPY VARCHAR2
1277 , RETCODE OUT NOCOPY NUMBER
1278 , P_Action VARCHAR2
1279 , P_Action_Level NUMBER -- 1 Header, 2 Line, 3 Deliverable
1280 , P_HEADER_ID NUMBER
1281 , P_LINE_ID NUMBER
1282 , P_DELIVERABLE_ID NUMBER
1283 ) IS
1284 l_Return_Status VARCHAR2(1);
1285 l_Msg_Count NUMBER;
1286 BEGIN
1287 g_Counter := 0;
1288 FND_FILE.PUT_LINE( FND_FILE.LOG, 'Initiate_Actions_CP: Started at '||TO_CHAR(SYSDATE,'YYYYMMDD HH24:MI:SS') );
1289 Initiate_Actions(P_Action => p_action
1290 , P_Action_Level => P_Action_Level
1291 , P_Header_Id => P_Header_Id
1292 , P_Line_Id => P_Line_Id
1293 , P_Deliverable_Id => P_Deliverable_Id
1294 , X_Return_Status => l_Return_Status
1295 , X_Msg_Data => ERRBUF
1296 , X_Msg_Count => l_Msg_Count
1297 );
1298 FND_FILE.PUT_LINE( FND_FILE.LOG, 'Initiate_Actions_CP: Ended at '||TO_CHAR(SYSDATE,'YYYYMMDD HH24:MI:SS')||' with status='||l_Return_Status );
1299 IF l_Return_Status = oke_api.g_ret_sts_success THEN
1300 FND_FILE.PUT_LINE( FND_FILE.LOG, 'WF processes started for '||g_Counter||' deliverables.' );
1301 ERRBUF := NULL;
1302 RETCODE := 0;
1303 ELSE
1304 FND_FILE.PUT_LINE( FND_FILE.LOG, 'Error: '||ERRBUF );
1305 RETCODE := 2;
1306 END IF;
1307 EXCEPTION
1308 WHEN OTHERS THEN
1309 FND_FILE.PUT_LINE( FND_FILE.LOG, sqlerrm );
1310 ERRBUF := sqlerrm;
1311 RETCODE := 2;
1312 END Initiate_Actions_CP;
1313
1314 End;
1315
1316
1317
1318