[Home] [Help]
PACKAGE BODY: APPS.CHV_CREATE_BUCKETS
Source
1 PACKAGE BODY CHV_CREATE_BUCKETS as
2 /* $Header: CHVCBKTB.pls 120.1 2005/07/04 01:37:54 pchintal noship $*/
3 /*========================== CHV_CREATE_BUCKETS ==============================*/
4 /*=============================================================================
5
6 PROCEDURE NAME: create_bucket_template()
7
8 =============================================================================*/
9
10 PROCEDURE create_bucket_template(
11 p_horizon_start_date IN DATE,
12 p_include_future_release_flag IN VARCHAR2,
13 p_bucket_pattern_id IN NUMBER,
14 p_horizon_end_date OUT NOCOPY DATE,
15 x_bucket_descriptor_table IN OUT NOCOPY BKTTABLE,
16 x_bucket_start_date_table IN OUT NOCOPY BKTTABLE,
17 x_bucket_end_date_table IN OUT NOCOPY BKTTABLE) IS
18
19 /* Declare Program Variables */
20
21 x_progress varchar2(3) := NULL ;
22 x_week_start_day varchar2(25) ;
23 x_day_count number := 0 ;
24 x_week_count number := 0 ;
25 x_month_count number := 0 ;
26 x_quarter_count number := 0 ;
27
28 x_bucket_start_date date := p_horizon_start_date ;
29 x_bucket_end_date date := p_horizon_start_date ;
30 x_horizon_end_date date ;
31 x_bucket_count number := 1 ;
32
33 begin
34
35 x_progress := '010' ;
36
37 /* Select the bucket pattern from chv_bucket_patterns based on
38 ** incoming parameter bucket_pattern_id including the week
39 ** start day.
40 ** We have to hardcode the date due to nls issue when using the next_day function. We have to use
41 ** a known date to get the correct 3 char day in the current language.
42 */
43
44 SELECT decode(cbp.week_start_day,'1_MONDAY' , to_char(to_date('31/01/2000','DD/MM/YYYY'),'DY'),
45 '2_TUESDAY' , to_char(to_date('01/02/2000','DD/MM/YYYY'),'DY'),
46 '3_WEDNESDAY' , to_char(to_date('02/02/2000','DD/MM/YYYY'),'DY'),
47 '4_THURSDAY' , to_char(to_date('03/02/2000','DD/MM/YYYY'),'DY'),
48 '5_FRIDAY' , to_char(to_date('04/02/2000','DD/MM/YYYY'),'DY'),
49 '6_SATURDAY' , to_char(to_date('05/02/2000','DD/MM/YYYY'),'DY'),
50 '7_SUNDAY' , to_char(to_date('06/02/2000','DD/MM/YYYY'),'DY'),
51 to_char(to_date('31/01/2000','DD/MM/YYYY'),'DY')
52 ),
53 cbp.number_daily_buckets,
54 cbp.number_weekly_buckets,
55 cbp.number_monthly_buckets,
56 cbp.number_quarterly_buckets
57 INTO x_week_start_day,
58 x_day_count,
59 x_week_count,
60 x_month_count,
61 x_quarter_count
62 FROM chv_bucket_patterns cbp
63 WHERE cbp.bucket_pattern_id = p_bucket_pattern_id;
64
65 /* Creating a Past Due bucket with just the end date
66 ** which is the day before the horizon start date.
67 */
68
69 x_bucket_descriptor_table(x_bucket_count) := 'PAST_DUE' ;
70 x_bucket_start_date_table(x_bucket_count) := null ;
71 x_bucket_end_date_table(x_bucket_count) := to_char(x_bucket_start_date - 1,'YYYY/MM/DD') ;
72 x_bucket_count := x_bucket_count + 1 ;
73
74 /* Create daily buckets only if the input parameter x_day_count is
75 ** greater than 0.
76 */
77
78 if x_day_count > 0 then
79
80 for i in 1..x_day_count loop
81
82 x_bucket_descriptor_table(x_bucket_count) := 'DAY' ;
83 x_bucket_start_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
84 x_bucket_end_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
85 x_bucket_count := x_bucket_count + 1 ;
86 x_bucket_end_date := x_bucket_start_date ;
87 x_bucket_start_date := x_bucket_start_date + 1 ;
88
89 end loop ;
90
91 end if ;
92
93 /* Create the week bucket. If the bucket being created does not start on the
94 ** week_start_day specified for the organization schedule being created
95 ** create a buffer bucket to fill the gap.
96 */
97
98 if x_week_count > 0 then
99
100 if next_day(x_bucket_start_date,x_week_start_day)<>
101 (x_bucket_start_date + 7) then
102
103 x_bucket_descriptor_table(x_bucket_count) := 'BUFFER' ;
104 x_bucket_start_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
105 x_bucket_end_date_table(x_bucket_count) := to_char(next_day(x_bucket_start_date,x_week_start_day) - 1,'YYYY/MM/DD') ;
106 x_bucket_start_date := next_day(x_bucket_start_date,x_week_start_day) ;
107 x_bucket_end_date := next_day(x_bucket_start_date,x_week_start_day) ;
108 x_bucket_count := x_bucket_count + 1 ;
109
110 end if ;
111
112 for i in 1..x_week_count loop
113
114 x_bucket_descriptor_table(x_bucket_count) := 'WEEK' ;
115 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD');
116 x_bucket_end_date_table(x_bucket_count) := to_char((x_bucket_start_date + 6),'YYYY/MM/DD');
117 x_bucket_start_date := x_bucket_start_date + 7 ;
118 x_bucket_end_date := x_bucket_start_date - 1 ;
119 x_bucket_count := x_bucket_count + 1 ;
120
121 end loop ;
122
123 end if ;
124
125 /* Create Month buckets. If the previous bucket does not end on the last
126 ** day of the month create a buffer bucket to fill the gap so that the
127 ** month starts on the first of the calender month.
128 */
129
130 if x_month_count > 0 then
131
132 if last_day(x_bucket_start_date - 1) - (x_bucket_start_date - 1) <> 0 then
133
134 x_bucket_descriptor_table(x_bucket_count) := 'BUFFER' ;
135 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD');
136 x_bucket_end_date_table(x_bucket_count) := to_char(last_day(x_bucket_start_date),'YYYY/MM/DD') ;
137 x_bucket_start_date := last_day(x_bucket_start_date) + 1;
138 x_bucket_end_date := last_day(x_bucket_start_date) ;
139 x_bucket_count := x_bucket_count + 1 ;
140
141 end if ;
142
143 for i in 1..x_month_count loop
144
145 x_bucket_descriptor_table(x_bucket_count) := 'MONTH' ;
146 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD') ;
147 x_bucket_end_date_table(x_bucket_count) := to_char(last_day(x_bucket_start_date),'YYYY/MM/DD') ;
148 x_bucket_start_date := last_day(x_bucket_start_date) + 1 ;
149 x_bucket_end_date := x_bucket_start_date - 1 ;
150 x_bucket_count := x_bucket_count + 1 ;
151
152 end loop ;
153
154 end if ;
155
156 /* Create Quarter buckets. If the previous bucket does not end on the last
157 ** day of the month create a buffer bucket to fill the gap so that the
158 ** quarter starts on the first of the calender month.
159 */
160
161 if x_quarter_count > 0 then
162
163 if last_day(x_bucket_start_date-1) - (x_bucket_start_date-1) <> 0 then
164
165 x_bucket_descriptor_table(x_bucket_count) := 'BUFFER' ;
166 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_start_date),'YYYY/MM/DD') ;
167 x_bucket_end_date_table(x_bucket_count) := to_char(last_day(x_bucket_start_date),'YYYY/MM/DD') ;
168 x_bucket_start_date := last_day(x_bucket_start_date) + 1 ;
169 x_bucket_end_date := x_bucket_start_date - 1 ;
170 x_bucket_count := x_bucket_count + 1 ;
171
172 end if ;
173
174 for i in 1..x_quarter_count loop
175
176 x_bucket_descriptor_table(x_bucket_count) := 'QUARTER' ;
177 x_bucket_start_date_table(x_bucket_count) := to_char(x_bucket_start_date,'YYYY/MM/DD') ;
178 x_bucket_end_date_table(x_bucket_count) := to_char(add_months((x_bucket_start_date-1),3),'YYYY/MM/DD') ;
179 x_bucket_start_date := add_months(x_bucket_start_date,3) ;
180 x_bucket_end_date := x_bucket_start_date - 1 ;
181 x_bucket_count := x_bucket_count + 1 ;
182
183 end loop ;
184
185 end if ;
186
187 /* Initializing the horizon end date to passed later to the calling
188 ** program
189 */
190
191 /* Assign out parameters to pass to the calling program */
192
193 p_horizon_end_date := x_bucket_end_date ;
194
195 /* Creating future release bucket if future release flag is Yes. */
196
197 If p_include_future_release_flag = 'Y' then
198
199 x_bucket_descriptor_table(x_bucket_count) := 'FUTURE' ;
200 x_bucket_start_date_table(x_bucket_count) := to_char((x_bucket_end_date + 1),'YYYY/MM/DD') ;
201 x_bucket_end_date_table(x_bucket_count) := null ;
202 x_bucket_count := x_bucket_count + 1 ;
203
204 end if ;
205
206 /* Initializing the rest of the 110 buckets to null.
207 ** This has to be done because the insert_buckets program will fail
208 ** since the PL/SQL tables are transposed into a record and a hard code
209 ** insert is done.
210 */
211
212 for i in x_bucket_count..60 loop
213
214 x_bucket_descriptor_table(x_bucket_count) := null ;
215 x_bucket_start_date_table(x_bucket_count) := null ;
216 x_bucket_end_date_table(x_bucket_count) := null ;
217 x_bucket_count := x_bucket_count + 1 ;
218
219 end loop ;
220
221
222 exception
223 when others then
224 po_message_s.sql_error('Insert_Row', X_progress, sqlcode);
225 raise;
226
227 END create_bucket_template ;
228
229 /*=============================================================================
230
231 PROCEDURE NAME: load_horizontal_schedules()
232
233 =============================================================================*/
234
235 PROCEDURE load_horizontal_schedules(
236 p_schedule_id IN NUMBER,
237 p_schedule_item_id IN NUMBER,
238 p_row_select_order IN NUMBER,
239 p_row_type IN VARCHAR2,
240 p_bucket_table IN BKTTABLE) IS
241
242 x_progress varchar2(3) := NULL ;
243 x_last_updated_by NUMBER ;
244 x_login_id NUMBER ;
245
246 begin
247
248 x_login_id := fnd_global.login_id ;
249 x_last_updated_by := fnd_global.user_id ;
250
251 x_progress := '010' ;
252
253 /* Insert the record type into the table */
254
255 insert into chv_horizontal_schedules
256 (SCHEDULE_ID,
257 SCHEDULE_ITEM_ID,
258 ROW_SELECT_ORDER,
259 ROW_TYPE,
260 LAST_UPDATE_DATE,
261 LAST_UPDATED_BY,
262 CREATION_DATE,
263 CREATED_BY,
264 COLUMN1,
265 COLUMN2,
266 COLUMN3,
267 COLUMN4,
268 COLUMN5,
269 COLUMN6,
270 COLUMN7,
271 COLUMN8,
272 COLUMN9,
273 COLUMN10,
274 COLUMN11,
275 COLUMN12,
276 COLUMN13,
277 COLUMN14,
278 COLUMN15,
279 COLUMN16,
280 COLUMN17,
281 COLUMN18,
282 COLUMN19,
283 COLUMN20,
284 COLUMN21,
285 COLUMN22,
286 COLUMN23,
287 COLUMN24,
288 COLUMN25,
289 COLUMN26,
290 COLUMN27,
291 COLUMN28,
292 COLUMN29,
293 COLUMN30,
294 COLUMN31,
295 COLUMN32,
296 COLUMN33,
297 COLUMN34,
298 COLUMN35,
299 COLUMN36,
300 COLUMN37,
301 COLUMN38,
302 COLUMN39,
303 COLUMN40,
304 COLUMN41,
305 COLUMN42,
306 COLUMN43,
307 COLUMN44,
308 COLUMN45,
309 COLUMN46,
310 COLUMN47,
311 COLUMN48,
312 COLUMN49,
313 COLUMN50,
314 COLUMN51,
315 COLUMN52,
316 COLUMN53,
317 COLUMN54,
318 COLUMN55,
319 COLUMN56,
320 COLUMN57,
321 COLUMN58,
322 COLUMN59,
323 COLUMN60,
324 LAST_UPDATE_LOGIN,
325 REQUEST_ID,
326 PROGRAM_APPLICATION_ID,
327 PROGRAM_ID,
328 PROGRAM_UPDATE_DATE)
329 VALUES(p_schedule_id,
330 p_schedule_item_id,
331 p_row_select_order,
332 p_row_type,
333 sysdate,
334 x_last_updated_by,
335 sysdate,
336 x_last_updated_by,
337 p_bucket_table(1),
338 p_bucket_table(2),
339 p_bucket_table(3),
340 p_bucket_table(4),
341 p_bucket_table(5),
342 p_bucket_table(6),
343 p_bucket_table(7),
344 p_bucket_table(8),
345 p_bucket_table(9),
346 p_bucket_table(10),
347 p_bucket_table(11),
348 p_bucket_table(12),
349 p_bucket_table(13),
350 p_bucket_table(14),
351 p_bucket_table(15),
352 p_bucket_table(16),
353 p_bucket_table(17),
354 p_bucket_table(18),
355 p_bucket_table(19),
356 p_bucket_table(20),
357 p_bucket_table(21),
358 p_bucket_table(22),
359 p_bucket_table(23),
360 p_bucket_table(24),
361 p_bucket_table(25),
362 p_bucket_table(26),
363 p_bucket_table(27),
364 p_bucket_table(28),
365 p_bucket_table(29),
366 p_bucket_table(30),
367 p_bucket_table(31),
368 p_bucket_table(32),
369 p_bucket_table(33),
370 p_bucket_table(34),
371 p_bucket_table(35),
372 p_bucket_table(36),
373 p_bucket_table(37),
374 p_bucket_table(38),
375 p_bucket_table(39),
376 p_bucket_table(40),
377 p_bucket_table(41),
378 p_bucket_table(42),
379 p_bucket_table(43),
380 p_bucket_table(44),
381 p_bucket_table(45),
382 p_bucket_table(46),
383 p_bucket_table(47),
384 p_bucket_table(48),
385 p_bucket_table(49),
386 p_bucket_table(50),
387 p_bucket_table(51),
388 p_bucket_table(52),
389 p_bucket_table(53),
393 p_bucket_table(57),
390 p_bucket_table(54),
391 p_bucket_table(55),
392 p_bucket_table(56),
394 p_bucket_table(58),
395 p_bucket_table(59),
396 p_bucket_table(60),
397 x_login_id,
398 null,
399 null,
400 null,
401 null ) ;
402 exception
403 when others then
404 po_message_s.sql_error('Insert_Row', X_progress, sqlcode);
405 raise;
406
407 END load_horizontal_schedules ;
408 /*=============================================================================
409
410 PROCEDURE NAME: calculate_bucket_qty()
411
412 =============================================================================*/
413 PROCEDURE calculate_buckets(p_schedule_id IN NUMBER,
414 p_schedule_item_id IN NUMBER,
415 p_horizon_start_date IN DATE,
416 p_horizon_end_date IN DATE,
417 p_schedule_type IN VARCHAR2,
418 p_cum_enable_flag IN VARCHAR2,
419 p_cum_quantity_received IN NUMBER,
420 p_bucket_descriptor_table IN BKTTABLE,
421 p_bucket_start_date_table IN BKTTABLE,
422 p_bucket_end_date_table IN BKTTABLE,
423 p_past_due_qty OUT NOCOPY NUMBER,
424 p_past_due_qty_primary OUT NOCOPY NUMBER
425 ) IS
426
427 /* Declaring Program Variables */
428
429 x_release_quantity_table bkttable ;
430 x_forecast_quantity_table bkttable ;
431 x_cum_quantity_table bkttable ;
432 x_total_quantity_table bkttable ;
433
434 x_bucket_count number := 0 ;
435 x_forecast_quantity number := 0 ;
436 x_total_forecast_qty number := 0 ;
437 x_release_quantity number := 0 ;
438 x_total_release_qty number := 0 ;
439 x_release_quantity_primary number := 0 ;
440
441 x_row_select_order number ;
442 x_row_type varchar2(25) ;
443 x_progress varchar2(25) ;
444
445 BEGIN
446
447 x_progress := '010' ;
448
449 for i in 1..60 loop
450
451 x_bucket_count := x_bucket_count + 1 ;
452 x_forecast_quantity := 0 ;
453 x_release_quantity := 0 ;
454
455 if p_bucket_descriptor_table(x_bucket_count) = 'PAST_DUE' then
456
457 /* Calculate Past Due Bucket Quantity by selecting
458 ** total ORDER_QUANTITY from CHV_ITEM_ORDERS
459 ** based on the due_date.
460 */
461
462 begin
463
464 x_progress := '020' ;
465
466 select nvl(sum(round(cio.order_quantity,5)),0),
467 nvl(sum(round(cio.order_quantity_primary,5)),0)
468 into x_release_quantity,
469 x_release_quantity_primary
470 from chv_item_orders cio
471 where cio.schedule_id = p_schedule_id
472 and cio.schedule_item_id = p_schedule_item_id
473 and cio.supply_document_type = 'RELEASE'
474 and trunc(cio.due_date) <= to_date(p_bucket_end_date_table(x_bucket_count),'YYYY/MM/DD') ;
475
476 exception when no_data_found then null ;
477 end ;
478
479 x_release_quantity_table(x_bucket_count) := x_release_quantity ;
480 x_forecast_quantity_table(x_bucket_count) := 0 ;
481 x_total_quantity_table(x_bucket_count) := x_release_quantity ;
482 x_total_release_qty := x_release_quantity ;
483 p_past_due_qty := x_release_quantity ;
484 p_past_due_qty_primary := x_release_quantity_primary ;
485
486 elsif p_bucket_descriptor_table(x_bucket_count) in ('DAY','BUFFER','WEEK','MONTH',
487 'QUARTER') then
488
489 /* Calculate Bucket Firm and Forecast Quantity by selecting
490 ** total ORDER_QUANTITY from CHV_ITEM_ORDERS
491 ** based on the due_date.
492 */
493
494 begin
495
496 x_progress := '030' ;
497
498 /* Selecting forecast quantities from chv_item_orders
499 ** for the scheduled_item.
500 */
501
502 select nvl(sum(round(cio.order_quantity,5)),0)
503 into x_forecast_quantity
504 from chv_item_orders cio
505 where cio.schedule_id = p_schedule_id
506 and cio.schedule_item_id = p_schedule_item_id
507 and ((p_schedule_type = 'FORECAST_ALL_DOCUMENTS'
508 and cio.supply_document_type in ('RELEASE','PLANNED_ORDER','REQUISITION')
509 and trunc(cio.due_date) between to_date(p_bucket_start_date_table(x_bucket_count),'YYYY/MM/DD')
510 and to_date(p_bucket_end_date_table(x_bucket_count),'YYYY/MM/DD') )
511 OR
512 (p_schedule_type in ('FORECAST_ONLY','MATERIAL_RELEASE','RELEASE_WITH_FORECAST')
513 and cio.supply_document_type in ('PLANNED_ORDER','REQUISITION')
514 and trunc(cio.due_date) between to_date(p_bucket_start_date_table(x_bucket_count),'YYYY/MM/DD')
515 and to_date(p_bucket_end_date_table(x_bucket_count),'YYYY/MM/DD') )
516 ) ;
520
517
518 exception when no_data_found then null ;
519 end ;
521 x_forecast_quantity_table(x_bucket_count) := x_forecast_quantity ;
522 x_total_forecast_qty := x_total_forecast_qty + x_forecast_quantity ;
523
524 begin
525
526 x_progress := '040' ;
527
528 /* Selecting release quantities from chv_item_orders
529 ** for the scheduled_item.
530 */
531
532 select nvl(sum(round(cio.order_quantity,5)),0)
533 into x_release_quantity
534 from chv_item_orders cio
535 where cio.schedule_id = p_schedule_id
536 and cio.schedule_item_id = p_schedule_item_id
537 and p_schedule_type in ('RELEASE_ONLY','MATERIAL_RELEASE','RELEASE_WITH_FORECAST')
538 and cio.supply_document_type = 'RELEASE'
539 and trunc(cio.due_date) between to_date(p_bucket_start_date_table(x_bucket_count),'YYYY/MM/DD')
540 and to_date(p_bucket_end_date_table(x_bucket_count),'YYYY/MM/DD') ;
541
542 exception when no_data_found then null ;
543 end ;
544
545 x_release_quantity_table(x_bucket_count) := x_release_quantity ;
546 x_total_release_qty := x_total_release_qty + x_release_quantity ;
547 x_total_quantity_table(x_bucket_count) := x_release_quantity + x_forecast_quantity ;
548
549 elsif p_bucket_descriptor_table(x_bucket_count) = 'FUTURE' then
550
551 /* Select all future releases from CHV_ITEM_ORDERS for the future
552 ** release bucket.
553 */
554
555 begin
556
557 x_progress := '050' ;
558
559 select nvl(sum(round(cio.order_quantity,5)),0)
560 into x_release_quantity
561 from chv_item_orders cio
562 where cio.schedule_id = p_schedule_id
563 and cio.schedule_item_id = p_schedule_item_id
564 and cio.supply_document_type = 'RELEASE'
565 and trunc(cio.due_date) > to_date(p_bucket_start_date_table(x_bucket_count),'YYYY/MM/DD') ;
566
567 exception when no_data_found then null ;
568 end ;
569
570 x_release_quantity_table(x_bucket_count) := x_release_quantity ;
571 x_forecast_quantity_table(x_bucket_count) := 0 ;
572 x_total_release_qty := x_total_release_qty + x_release_quantity ;
573 x_total_quantity_table(x_bucket_count) := x_release_quantity ;
574
575 else
576
577 /* No value in the bucket descriptor initialize to null */
578
579 x_release_quantity_table(x_bucket_count) := null ;
580 x_forecast_quantity_table(x_bucket_count) := null ;
581 x_total_quantity_table(x_bucket_count) := null ;
582
583 end if ;
584
585 /* Initialize CUM quantity Bucket. */
586 /*Bug2028705
587 Rounding the cumulative quantity to 5 similar to (standards for rounding)
588 the ones in the rest of the supplier scheduling code for quantity.
589 */
590 if p_bucket_descriptor_table(x_bucket_count) is not null then
591
592 x_cum_quantity_table(x_bucket_count) := to_char(round(nvl(x_total_release_qty,0) +
593 nvl(x_total_forecast_qty,0) +
594 nvl(p_cum_quantity_received,0)
595 ,5)) ;
596 else
597
598 x_cum_quantity_table(x_bucket_count) := null ;
599
600 end if ;
601
602 end loop ;
603
604 /* Initialize row_select_order and row_type and call stored
605 ** procedure insert_buckets by passing the appropriate PL/SQL table
606 ** to insert the record into CHV_HORIZONTAL_SCHEDULES
607 */
608
609 x_row_select_order := 1 ;
610 x_row_type := 'BUCKET_DESCRIPTOR' ;
611 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
612 p_schedule_item_id ,
613 x_row_select_order ,
614 x_row_type ,
615 p_bucket_descriptor_table ) ;
616
617 x_row_select_order := 2 ;
618 x_row_type := 'BUCKET_START_DATE' ;
619 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
620 p_schedule_item_id ,
621 x_row_select_order ,
622 x_row_type ,
623 p_bucket_start_date_table ) ;
624
625 x_row_select_order := 3 ;
626 x_row_type := 'RELEASE_QUANTITY' ;
627 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
628 p_schedule_item_id ,
629 x_row_select_order ,
630 x_row_type ,
631 x_release_quantity_table ) ;
632
633 x_row_select_order := 4 ;
634 x_row_type := 'FORECAST_QUANTITY' ;
635 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
636 p_schedule_item_id ,
637 x_row_select_order ,
638 x_row_type ,
639 x_forecast_quantity_table ) ;
640 x_row_select_order := 5 ;
641 x_row_type := 'TOTAL_QUANTITY' ;
642 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
643 p_schedule_item_id ,
647
644 x_row_select_order ,
645 x_row_type ,
646 x_total_quantity_table ) ;
648 x_row_select_order := 6 ;
649 x_row_type := 'CUM_QUANTITY' ;
650 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
651 p_schedule_item_id ,
652 x_row_select_order ,
653 x_row_type ,
654 x_cum_quantity_table ) ;
655
656 x_row_select_order := 7 ;
657 x_row_type := 'BUCKET_END_DATE' ;
658 chv_create_buckets.load_horizontal_schedules(p_schedule_id ,
659 p_schedule_item_id ,
660 x_row_select_order ,
661 x_row_type ,
662 p_bucket_end_date_table ) ;
663 exception
664 when others then
665 po_message_s.sql_error('calculate_bucket_qty', X_progress, sqlcode);
666 raise;
667
668 END calculate_buckets ;
669
670 END CHV_CREATE_BUCKETS ;