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