DBA Data[Home] [Help]

PACKAGE BODY: APPS.WIP_DEFAULT_REPSCHEDULE

Source


1 PACKAGE BODY WIP_Default_Repschedule AS
2 /* $Header: WIPDWRSB.pls 115.9 2003/01/07 22:32:02 seli ship $ */
3 
4 --  Global constant holding the package name
5 
6 G_PKG_NAME                    CONSTANT VARCHAR2(30) := 'WIP_Default_Repschedule';
7 
8 --  Package global used within the package.
9 
10 g_RepSchedule_rec             WIP_Work_Order_PUB.Repschedule_Rec_Type;
11 
12 --  Get functions.
13 
14 FUNCTION Get_Alternate_Bom_Designator
15 RETURN VARCHAR2
16 IS
17 BEGIN
18 
19    IF(g_RepSchedule_rec.Alternate_Bom_Designator IS NOT NULL) THEN
20       RETURN g_RepSchedule_rec.Alternate_Bom_Designator;
21    END IF;
22 
23    RETURN NULL;
24 
25 END Get_Alternate_Bom_Designator;
26 
27 FUNCTION Get_Alternate_Rout_Designator
28 RETURN VARCHAR2
29 IS
30 BEGIN
31 
32    IF(g_RepSchedule_rec.Alternate_Rout_Designator IS NOT NULL) THEN
33       RETURN g_RepSchedule_rec.Alternate_Rout_Designator;
34    END IF;
35     RETURN NULL;
36 
37 END Get_Alternate_Rout_Designator;
38 
39 FUNCTION Get_Bom_Revision
40 RETURN VARCHAR2
41 IS
42 BEGIN
43 
44    IF(g_RepSchedule_rec.Bom_Revision IS NOT NULL) THEN
45       RETURN g_RepSchedule_rec.Bom_Revision;
46    END IF;
47 
48    RETURN NULL;
49 
50 END Get_Bom_Revision;
51 
52 FUNCTION Get_Bom_Revision_Date
53 RETURN DATE
54 IS
55 BEGIN
56 
57    IF(g_RepSchedule_rec.Bom_Revision_Date IS NOT NULL) THEN
58       RETURN g_RepSchedule_rec.Bom_Revision_Date;
59    END IF;
60 
61    RETURN NULL;
62 
63 END Get_Bom_Revision_Date;
64 
65 FUNCTION Get_Common_Bom_Sequence
66 RETURN NUMBER
67 IS
68 BEGIN
69 
70    IF(g_RepSchedule_rec.Common_Bom_Sequence_Id IS NOT NULL) THEN
71       RETURN g_RepSchedule_rec.Common_Bom_Sequence_Id;
72    END IF;
73 
74    RETURN NULL;
75 
76 END Get_Common_Bom_Sequence;
77 
78 FUNCTION Get_Common_Rout_Sequence
79 RETURN NUMBER
80 IS
81 BEGIN
82 
83    IF(g_RepSchedule_rec.Common_Rout_Sequence_Id IS NOT NULL) THEN
84       RETURN g_RepSchedule_rec.Common_Rout_Sequence_Id;
85    END IF;
86 
87    RETURN NULL;
88 
89 END Get_Common_Rout_Sequence;
90 
91 FUNCTION Get_Daily_Production_Rate
92 RETURN NUMBER
93 IS
94      l_min_rate NUMBER;
95      l_max_rate NUMBER;
96      l_fixed_thruput NUMBER;
97 BEGIN
98 
99    IF(g_RepSchedule_rec.Daily_Production_Rate IS NOT NULL)
100      THEN
101       RETURN g_RepSchedule_rec.Daily_Production_Rate;
102    END IF;
103 
104    IF g_RepSchedule_rec.kanban_card_id IS NOT NULL
105       AND g_RepSchedule_rec.line_id IS NOT NULL
106       AND g_RepSchedule_rec.organization_id IS NOT NULL
107      THEN
108       SELECT minimum_rate, maximum_rate, fixed_throughput
109         INTO l_min_rate, l_max_rate, l_fixed_thruput
110         FROM wip_lines
111         WHERE line_id = g_RepSchedule_rec.line_id
112         AND organization_id = g_RepSchedule_rec.organization_id;
113 
114       RETURN l_max_rate;
115     END IF;
116 
117     RETURN NULL;
118 
119 EXCEPTION
120    WHEN OTHERS THEN
121       RETURN FND_API.G_MISS_NUM;
122 
123 END Get_Daily_Production_Rate;
124 
125 FUNCTION Get_Date_Closed
126 RETURN DATE
127 IS
128 BEGIN
129 
130    IF(g_RepSchedule_rec.Date_Closed IS NOT NULL) THEN
131       RETURN g_RepSchedule_rec.Date_Closed;
132    END IF;
133 
134    RETURN NULL;
135 
136 END Get_Date_Closed;
137 
138 FUNCTION Get_Date_Released
139 RETURN DATE
140 IS
141 BEGIN
142 
143    IF(g_RepSchedule_rec.Date_Released IS NOT NULL) THEN
144       RETURN g_RepSchedule_rec.Date_Released;
145    END IF;
146 
147    RETURN NULL;
148 
149 END Get_Date_Released;
150 
151 FUNCTION Get_Demand_Class
152 RETURN VARCHAR2
153 IS
154 BEGIN
155 
156    IF(g_RepSchedule_rec.Demand_Class IS NOT NULL) THEN
157       RETURN g_RepSchedule_rec.Demand_Class;
158    END IF;
159 
160    RETURN NULL;
161 
162 END Get_Demand_Class;
163 
164 FUNCTION Get_Description
165 RETURN VARCHAR2
166 IS
167 BEGIN
168 
169    IF(g_RepSchedule_rec.Description IS NOT NULL) THEN
170       RETURN g_RepSchedule_rec.Description;
171    END IF;
172 
173    RETURN NULL;
174 
175 END Get_Description;
176 
177 FUNCTION Get_Firm_Planned
178 RETURN NUMBER
179 IS
180 BEGIN
181 
182    IF(g_RepSchedule_rec.Firm_Planned_Flag IS NOT NULL) THEN
183       RETURN g_RepSchedule_rec.Firm_Planned_Flag;
184    END IF;
185 
186    RETURN NULL;
187 
188 END Get_Firm_Planned;
189 
190 FUNCTION Get_First_Unit_Cpl_Date
191 RETURN DATE
192 IS
193    l_line_sch_type NUMBER;
194    l_rout_exists NUMBER := 0;
195 BEGIN
196 
197    IF(g_RepSchedule_rec.First_Unit_Cpl_Date IS NOT NULL) THEN
198       RETURN g_RepSchedule_rec.First_Unit_Cpl_Date;
199    END IF;
200 
201    -- If the line is routing based and the assembly does not have a routing, default the first unit completion date to be the same as the first unit start DATE.
202 
203    IF g_RepSchedule_rec.line_id IS NOT NULL THEN
204       SELECT line_schedule_type INTO l_line_sch_type
205 	FROM wip_lines
206 	WHERE line_id = g_RepSchedule_rec.line_id;
207 
208 
209       IF l_line_sch_type = 1 THEN --DO not default for Fixed LT lines
210 	RETURN NULL;
211       END IF;
212 
213       IF g_RepSchedule_rec.primary_item_id IS NULL
214       OR g_RepSchedule_rec.organization_id IS NULL THEN
215 	 RETURN NULL;
216       END IF;
217 
218       SELECT 1 INTO l_rout_exists
219 	FROM dual
220 	WHERE exists(
221 		     SELECT routing_sequence_id
222 		     FROM bom_operational_routings
223 		     WHERE assembly_item_id = g_RepSchedule_rec.primary_item_id
224 		     AND organization_id = g_RepSchedule_rec.organization_id);
225 
226       IF (l_rout_exists = 0) THEN
227 	 RETURN g_RepSchedule_rec.First_Unit_Start_Date;
228       END IF;
229    END IF;
230 
231    RETURN NULL;
232 
233 END Get_First_Unit_Cpl_Date;
234 
235 FUNCTION Get_First_Unit_Start_Date
236 RETURN DATE
237 IS
238    l_line_sch_type NUMBER;
239    l_rout_exists NUMBER := 0;
240 BEGIN
241 
242    IF(g_RepSchedule_rec.last_unit_start_date IS NOT NULL) THEN
243       RETURN g_RepSchedule_rec.last_unit_start_date;
244    END IF;
245 
246    -- IF the kanban_card_id IS provided THEN we are defaulting FOR kanbans, IN which CASE DEFAULT the first unit START DATE TO be Sysdate.
247 
248    IF(g_RepSchedule_rec.kanban_card_id IS NOT NULL) THEN
249       RETURN Sysdate;
250    END IF;
251 
252    -- If the line is routing based and the assembly does not have a routing, default the first unit start date to be the same as the first unit cpl date
253 
254    IF g_RepSchedule_rec.line_id IS NOT NULL THEN
255       SELECT line_schedule_type INTO l_line_sch_type
256 	FROM wip_lines
257 	WHERE line_id = g_RepSchedule_rec.line_id;
258 
259       IF l_line_sch_type = 1 THEN --DO not default for Fixed LT lines
260 	RETURN NULL;
261       END IF;
262 
263       IF g_RepSchedule_rec.primary_item_id IS NULL
264 	 OR g_RepSchedule_rec.organization_id IS NULL THEN
265 	 RETURN NULL;
266       END IF;
267 
268       SELECT 1 INTO l_rout_exists
269 	FROM dual
270 	WHERE exists(
271 		     SELECT routing_sequence_id
272 		     FROM bom_operational_routings
273 		     WHERE assembly_item_id = g_RepSchedule_rec.primary_item_id
274 		     AND organization_id = g_RepSchedule_rec.organization_id);
275 
276 	IF (l_rout_exists = 0) THEN
277 	   RETURN g_RepSchedule_rec.First_Unit_Cpl_Date;
278 	END IF;
279       END IF;
280 
281    RETURN NULL;
282 
283 END Get_First_Unit_Start_Date;
284 
285 FUNCTION Get_Last_Unit_Cpl_Date
286 RETURN DATE
287 IS
288    l_line_sch_type NUMBER;
289    l_rout_exists NUMBER := 0;
290 
291 BEGIN
292 
293    IF(g_RepSchedule_rec.last_unit_cpl_date IS NOT NULL) THEN
294       RETURN g_RepSchedule_rec.last_unit_cpl_date;
295    END IF;
296 
300       SELECT line_schedule_type INTO l_line_sch_type
297    -- If the line is routing based and the assembly does not have a routing, default the last unit completion date to be the same as the last unit start DATE.
298 
299    IF g_RepSchedule_rec.line_id IS NOT NULL THEN
301 	FROM wip_lines
302 	WHERE line_id = g_RepSchedule_rec.line_id;
303 
304 
305       IF l_line_sch_type = 1 THEN --DO not default for Fixed LT lines
306 	RETURN NULL;
307       END IF;
308 
309       IF g_RepSchedule_rec.primary_item_id IS NULL
310 	 OR g_RepSchedule_rec.organization_id IS NULL THEN
311 	 RETURN NULL;
312       END IF;
313 
314       SELECT 1 INTO l_rout_exists
315 	FROM dual
316 	WHERE exists(
317 		     SELECT routing_sequence_id
318 		     FROM bom_operational_routings
319 		     WHERE assembly_item_id = g_RepSchedule_rec.primary_item_id
320 		     AND organization_id = g_RepSchedule_rec.organization_id);
321 
322       IF (l_rout_exists = 0) THEN
323 	 RETURN g_RepSchedule_rec.Last_Unit_Start_Date;
324       END IF;
325    END IF;
326 
327    RETURN NULL;
328 
329 EXCEPTION
330    WHEN OTHERS THEN
331     RETURN FND_API.G_MISS_DATE;
332 
333 END Get_Last_Unit_Cpl_Date;
334 
335 FUNCTION Get_Last_Unit_Start_Date
336 RETURN DATE
337 IS
338    l_line_sch_type NUMBER;
339    l_rout_exists NUMBER := 0;
340 BEGIN
341 
342    IF(g_RepSchedule_rec.Last_Unit_Start_Date IS NOT NULL) THEN
343       RETURN g_RepSchedule_rec.Last_Unit_Start_Date;
344    END IF;
345 
346    -- If the line is routing based and the assembly does not have a routing, default the last unit start date to be the same as the last unit cpl DATE.
347 
348    IF g_RepSchedule_rec.line_id IS NOT NULL THEN
349       SELECT line_schedule_type INTO l_line_sch_type
350 	FROM wip_lines
351 	WHERE line_id = g_RepSchedule_rec.line_id;
352 
353 
354       IF l_line_sch_type = 1 THEN --DO not default for Fixed LT lines
355 	RETURN NULL;
356       END IF;
357 
358       IF g_RepSchedule_rec.primary_item_id IS NULL
359 	 OR g_RepSchedule_rec.organization_id IS NULL THEN
360 	 RETURN NULL;
361       END IF;
362 
363       SELECT 1 INTO l_rout_exists
364 	FROM dual
365 	WHERE exists(
366 		     SELECT routing_sequence_id
367 		     FROM bom_operational_routings
368 		     WHERE assembly_item_id = g_RepSchedule_rec.primary_item_id
369 		     AND organization_id = g_RepSchedule_rec.organization_id);
370 
371       IF (l_rout_exists = 0) THEN
372 	 RETURN g_RepSchedule_rec.Last_Unit_Cpl_Date;
373       END IF;
374    END IF;
375 
376    RETURN NULL;
377 
378 END Get_Last_Unit_Start_Date;
379 
380 FUNCTION Get_Line
381 RETURN NUMBER
382 IS
383    l_kanban_rec INV_Kanban_PVT.Kanban_Card_Rec_Type;
384 BEGIN
385 
386    IF(g_RepSchedule_rec.line_id IS NOT NULL) THEN
387       RETURN g_RepSchedule_rec.line_id;
388    END IF;
389 
390    IF(g_RepSchedule_rec.kanban_card_id IS NOT NULL) THEN
391       l_kanban_rec := INV_KanbanCard_PKG.Query_Row(p_kanban_card_id  => g_RepSchedule_rec.kanban_card_id);
392       RETURN(l_kanban_rec.wip_line_id);
393    END IF;
394 
395 EXCEPTION
396    WHEN OTHERS THEN
397     RETURN FND_API.G_MISS_NUM;
398 
399 END Get_Line;
400 
401 FUNCTION Get_Material_Account
402 RETURN NUMBER
403 IS
404 BEGIN
405 
406    IF(g_RepSchedule_rec.Material_Account IS NOT NULL) THEN
407       RETURN g_RepSchedule_rec.Material_Account;
408    END IF;
409 
410    RETURN NULL;
411 
412 END Get_Material_Account;
413 
414 FUNCTION Get_Material_Overhead_Account
415 RETURN NUMBER
416 IS
417 BEGIN
418 
419    IF(g_RepSchedule_rec.Material_Overhead_Account IS NOT NULL) THEN
420       RETURN g_RepSchedule_rec.Material_Overhead_Account;
421    END IF;
422 
423    RETURN NULL;
424 
425 END Get_Material_Overhead_Account;
426 
427 FUNCTION Get_Material_Variance_Account
428 RETURN NUMBER
429 IS
430 BEGIN
431 
432    IF(g_RepSchedule_rec.Material_Variance_Account IS NOT NULL) THEN
433       RETURN g_RepSchedule_rec.Material_Variance_Account;
434    END IF;
435 
436    RETURN NULL;
437 
438 END Get_Material_Variance_Account;
439 
440 FUNCTION Get_Organization
441 RETURN NUMBER
442 IS
443 BEGIN
444 
445    IF(g_RepSchedule_rec.Organization_Id IS NOT NULL) THEN
446       RETURN g_RepSchedule_rec.Organization_Id;
447    END IF;
448 
449    RETURN NULL;
450 
451 END Get_Organization;
452 
453 FUNCTION Get_Osp_Account
454 RETURN NUMBER
455 IS
456 BEGIN
457 
458    IF(g_RepSchedule_rec.Osp_Account IS NOT NULL) THEN
459       RETURN g_RepSchedule_rec.Osp_Account;
460    END IF;
461 
462    RETURN NULL;
463 
464 END Get_Osp_Account;
465 
466 FUNCTION Get_Osp_Variance_Account
467 RETURN NUMBER
468 IS
469 BEGIN
470 
471    IF(g_RepSchedule_rec.Osp_Variance_Account IS NOT NULL) THEN
472       RETURN g_RepSchedule_rec.Osp_Variance_Account;
473    END IF;
474 
475    RETURN NULL;
476 
477 END Get_Osp_Variance_Account;
478 
479 FUNCTION Get_Overhead_Account
480 RETURN NUMBER
481 IS
482 BEGIN
483 
484    IF(g_RepSchedule_rec.Overhead_Account IS NOT NULL) THEN
485       RETURN g_RepSchedule_rec.Overhead_Account;
486    END IF;
487 
488    RETURN NULL;
489 
490 END Get_Overhead_Account;
491 
495 BEGIN
492 FUNCTION Get_Overhead_Variance_Account
493 RETURN NUMBER
494 IS
496 
497    IF(g_RepSchedule_rec.Overhead_Variance_Account IS NOT NULL) THEN
498       RETURN g_RepSchedule_rec.Overhead_Variance_Account;
499    END IF;
500 
501    RETURN NULL;
502 
503 END Get_Overhead_Variance_Account;
504 
505 FUNCTION Get_Processing_Work_Days
506 RETURN NUMBER
507 IS
508   l_kanban_rec INV_Kanban_PVT.Kanban_Card_Rec_Type;
509 BEGIN
510 
511    IF(g_RepSchedule_rec.processing_work_days IS NOT NULL) THEN
512       RETURN g_RepSchedule_rec.processing_work_days;
513    END IF;
514 
515    IF g_RepSchedule_rec.kanban_card_id IS NOT NULL
516       AND g_RepSchedule_rec.daily_production_rate IS NOT NULL
517      THEN
518       l_kanban_rec := INV_KanbanCard_PKG.Query_Row(p_kanban_card_id  => g_RepSchedule_rec.kanban_card_id);
519       RETURN(l_kanban_rec.kanban_size / g_RepSchedule_rec.daily_production_rate);
520     ELSE
521       RETURN FND_API.G_MISS_NUM;
522    END IF;
523 
524 EXCEPTION
525    WHEN OTHERS THEN
526       RETURN FND_API.G_MISS_NUM;
527 
528 END Get_Processing_Work_Days;
529 
530 FUNCTION Get_Quantity_Completed
531 RETURN NUMBER
532 IS
533 BEGIN
534 
535    IF(g_RepSchedule_rec.Quantity_Completed IS NOT NULL) THEN
536       RETURN g_RepSchedule_rec.Quantity_Completed;
537    END IF;
538 
539    RETURN NULL;
540 
541 END Get_Quantity_Completed;
542 
543 FUNCTION Get_Repetitive_Schedule
544 RETURN NUMBER
545 IS
546 BEGIN
547 
548     RETURN NULL;
549 
550 END Get_Repetitive_Schedule;
551 
552 FUNCTION Get_Resource_Account
553 RETURN NUMBER
554 IS
555 BEGIN
556 
557    IF(g_RepSchedule_rec.Resource_Account IS NOT NULL) THEN
558       RETURN g_RepSchedule_rec.Resource_Account;
559    END IF;
560 
561    RETURN NULL;
562 
563 END Get_Resource_Account;
564 
565 FUNCTION Get_Resource_Variance_Account
566 RETURN NUMBER
567 IS
568 BEGIN
569 
570    IF(g_RepSchedule_rec.Resource_Variance_Account IS NOT NULL) THEN
571       RETURN g_RepSchedule_rec.Resource_Variance_Account;
572    END IF;
573 
574    RETURN NULL;
575 
576 END Get_Resource_Variance_Account;
577 
578 FUNCTION Get_Routing_Revision
579 RETURN VARCHAR2
580 IS
581 BEGIN
582 
583    IF(g_RepSchedule_rec.Routing_Revision IS NOT NULL) THEN
584       RETURN g_RepSchedule_rec.Routing_Revision;
585    END IF;
586 
587    RETURN NULL;
588 
589 END Get_Routing_Revision;
590 
591 FUNCTION Get_Routing_Revision_Date
592 RETURN DATE
593 IS
594 BEGIN
595 
596    IF(g_RepSchedule_rec.Routing_Revision_Date IS NOT NULL) THEN
597       RETURN g_RepSchedule_rec.Routing_Revision_Date;
598    END IF;
599 
600    RETURN NULL;
601 
602 END Get_Routing_Revision_Date;
603 
604 FUNCTION Get_Status_Type
605 RETURN NUMBER
606 IS
607 BEGIN
608 
609    IF(g_RepSchedule_rec.Status_Type IS NOT NULL) THEN
610       RETURN g_RepSchedule_rec.Status_Type;
611    END IF;
612 
613    RETURN NULL;
614 
615 END Get_Status_Type;
616 
617 FUNCTION Get_Wip_Entity
618 RETURN NUMBER
619   IS
620      l_wip_entity_id NUMBER;
621 BEGIN
622 
623    IF(g_RepSchedule_rec.Wip_Entity_Id IS NOT NULL) THEN
624       RETURN g_RepSchedule_rec.Wip_Entity_Id;
625    END IF;
626 
627    RETURN NULL;
628    /* Use the following section if you need a new wip entity id */
629    /*
630    Select wip_entities_s.nextval into l_wip_entity_id FROM dual;
631     RETURN l_wip_entity_id;
632      */
633 
634 END Get_Wip_Entity;
635 
636 FUNCTION Get_Kanban_Card
637 RETURN NUMBER
638 IS
639 BEGIN
640 
641    IF(g_RepSchedule_rec.Kanban_Card_Id IS NOT NULL) THEN
642       RETURN g_RepSchedule_rec.Kanban_Card_Id;
643    END IF;
644 
645    RETURN NULL;
646 
647 END Get_Kanban_Card;
648 
649 PROCEDURE Get_Flex_Repschedule
650 IS
651 BEGIN
652 
653     --  In the future call Flex APIs for defaults
654 
655     IF g_RepSchedule_rec.attribute1 = FND_API.G_MISS_CHAR THEN
656         g_RepSchedule_rec.attribute1   := NULL;
657     END IF;
658 
659     IF g_RepSchedule_rec.attribute10 = FND_API.G_MISS_CHAR THEN
660         g_RepSchedule_rec.attribute10  := NULL;
661     END IF;
662 
663     IF g_RepSchedule_rec.attribute11 = FND_API.G_MISS_CHAR THEN
664         g_RepSchedule_rec.attribute11  := NULL;
665     END IF;
666 
667     IF g_RepSchedule_rec.attribute12 = FND_API.G_MISS_CHAR THEN
668         g_RepSchedule_rec.attribute12  := NULL;
669     END IF;
670 
671     IF g_RepSchedule_rec.attribute13 = FND_API.G_MISS_CHAR THEN
672         g_RepSchedule_rec.attribute13  := NULL;
673     END IF;
674 
675     IF g_RepSchedule_rec.attribute14 = FND_API.G_MISS_CHAR THEN
676         g_RepSchedule_rec.attribute14  := NULL;
677     END IF;
678 
679     IF g_RepSchedule_rec.attribute15 = FND_API.G_MISS_CHAR THEN
680         g_RepSchedule_rec.attribute15  := NULL;
681     END IF;
682 
683     IF g_RepSchedule_rec.attribute2 = FND_API.G_MISS_CHAR THEN
684         g_RepSchedule_rec.attribute2   := NULL;
685     END IF;
686 
687     IF g_RepSchedule_rec.attribute3 = FND_API.G_MISS_CHAR THEN
688         g_RepSchedule_rec.attribute3   := NULL;
689     END IF;
690 
694 
691     IF g_RepSchedule_rec.attribute4 = FND_API.G_MISS_CHAR THEN
692         g_RepSchedule_rec.attribute4   := NULL;
693     END IF;
695     IF g_RepSchedule_rec.attribute5 = FND_API.G_MISS_CHAR THEN
696         g_RepSchedule_rec.attribute5   := NULL;
697     END IF;
698 
699     IF g_RepSchedule_rec.attribute6 = FND_API.G_MISS_CHAR THEN
700         g_RepSchedule_rec.attribute6   := NULL;
701     END IF;
702 
703     IF g_RepSchedule_rec.attribute7 = FND_API.G_MISS_CHAR THEN
704         g_RepSchedule_rec.attribute7   := NULL;
705     END IF;
706 
707     IF g_RepSchedule_rec.attribute8 = FND_API.G_MISS_CHAR THEN
708         g_RepSchedule_rec.attribute8   := NULL;
709     END IF;
710 
711     IF g_RepSchedule_rec.attribute9 = FND_API.G_MISS_CHAR THEN
712         g_RepSchedule_rec.attribute9   := NULL;
713     END IF;
714 
715     IF g_RepSchedule_rec.attribute_category = FND_API.G_MISS_CHAR THEN
716         g_RepSchedule_rec.attribute_category := NULL;
717     END IF;
718 
719 END Get_Flex_Repschedule;
720 
721 --  Procedure Attributes
722 
723 PROCEDURE Attributes
724 (   p_RepSchedule_rec               IN  WIP_Work_Order_PUB.Repschedule_Rec_Type
725 ,   p_iteration                     IN  NUMBER DEFAULT NULL
726 ,   p_ReDefault                     IN BOOLEAN DEFAULT NULL
727 ,   x_RepSchedule_rec               OUT NOCOPY WIP_Work_Order_PUB.Repschedule_Rec_Type
728 )
729 IS
730 l_RepSchedule_rec  WIP_Work_Order_PUB.RepSchedule_Rec_Type:= WIP_Work_Order_PUB.G_MISS_REPSCHEDULE_REC;
731 l_return_status BOOLEAN;
732 l_Defaulting_Done BOOLEAN := FALSE;
733 BEGIN
734 
735     --  Check number of iterations.
736 
737     IF nvl(p_iteration,1) > WIP_GLOBALS.G_MAX_DEF_ITERATIONS THEN
738 
739         IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
740         THEN
741 
742             FND_MESSAGE.SET_NAME('WIP','OE_DEF_MAX_ITERATION');
743             FND_MSG_PUB.Add;
744 
745         END IF;
746 
747         RAISE FND_API.G_EXC_ERROR;
748 
749     END IF;
750 
751     IF p_RepSchedule_rec.action = WIP_Globals.G_OPR_DEFAULT_USING_KANBAN
752       THEN
753 
754        IF p_RepSchedule_rec.kanban_card_id IS NULL
755          THEN
756           IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
757             THEN
758              FND_MESSAGE.SET_NAME('WIP','WIP_REQUIRED');
759              FND_MSG_PUB.Add;
760           END IF;
761           RAISE FND_API.G_EXC_ERROR;
762         ELSE
763           l_RepSchedule_rec.kanban_card_id := p_RepSchedule_rec.kanban_card_id;
764 
765        END IF;
766 
767        IF p_RepSchedule_rec.organization_id IS NULL
768          THEN
769           IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_ERROR)
770             THEN
771              FND_MESSAGE.SET_NAME('WIP','WIP_REQUIRED');
772              FND_MSG_PUB.Add;
773           END IF;
774           RAISE FND_API.G_EXC_ERROR;
775         ELSE
776           l_RepSchedule_rec.organization_id := p_RepSchedule_rec.organization_id;
777 
778        END IF;
779        --  Initialize g_RepSchedule_rec
780 
781        g_RepSchedule_rec := p_RepSchedule_rec;
782 
783        --  Default missing attributes.
784 
785        g_RepSchedule_rec.daily_production_rate := Get_Daily_Production_Rate;
786        g_RepSchedule_rec.date_released := Get_Date_Released;
787        g_RepSchedule_rec.firm_planned_flag := Get_Firm_Planned;
788        g_RepSchedule_rec.first_unit_start_date := Get_First_Unit_Start_Date;
789        g_RepSchedule_rec.first_unit_cpl_date := Get_First_Unit_Cpl_Date;
790        g_RepSchedule_rec.line_id := Get_Line;
791        g_RepSchedule_rec.processing_work_days := Get_Processing_Work_Days;
792        g_RepSchedule_rec.repetitive_schedule_id := Get_Repetitive_Schedule;
793        g_RepSchedule_rec.status_type := Get_Status_Type;
794        g_RepSchedule_rec.wip_entity_id := Get_Wip_Entity;
795 
796         --  Done defaulting attributes
797        l_Defaulting_Done := TRUE;
798     END IF;
799     --  Done defaulting attributes
800     IF l_Defaulting_Done
801       THEN
802        IF nvl(p_ReDefault,TRUE)
803 	 THEN
804 	  x_RepSchedule_rec := WIP_RepSchedule_Util.Complete_Record(g_RepSchedule_rec,p_RepSchedule_rec,FALSE);
805 	ELSE
806 	  -- Force Copy the given record into the defaulted record.
807 	  x_RepSchedule_rec := WIP_RepSchedule_Util.Complete_Record(g_RepSchedule_rec,p_RepSchedule_rec,TRUE);
808        END IF;
809        -- Check against the given flow schedule record
810        l_return_status := WIP_RepSchedule_Util.Compare(x_RepSchedule_rec, p_RepSchedule_rec);
811        IF (nvl(p_ReDefault,TRUE) = FALSE AND l_return_status = FALSE)
812 	 THEN
813 	  x_RepSchedule_rec.return_status := 'N';
814        END IF;
815     END IF;
816 
817 END Attributes;
818 
819 END WIP_Default_Repschedule;