DBA Data[Home] [Help]

PACKAGE BODY: APPS.MTL_RESERVATIONS_PKG

Source


1 PACKAGE BODY MTL_RESERVATIONS_PKG AS
2 /* $Header: INVRSV6B.pls 120.2 2006/09/20 11:26:07 bradha ship $ */
3 -- INVCONV
4 -- Add columns to signatures as follows:
5 --   secondary_uom_code
6 --   secondary_uom_id
7 --   secondary_reservation_quantity
8 --   secondary_detailed_quantity
9 
10 PROCEDURE INSERT_ROW (
11    x_rowid                          IN OUT NOCOPY VARCHAR2
12   ,x_reservation_id                 IN OUT NOCOPY NUMBER
13   ,x_requirement_date               IN     DATE
14   ,x_organization_id                IN     NUMBER
15   ,x_inventory_item_id              IN     NUMBER
16   ,x_demand_source_type_id          IN     NUMBER
17   ,x_demand_source_name             IN     VARCHAR2
18   ,x_demand_source_header_id        IN     NUMBER
19   ,x_demand_source_line_id          IN     NUMBER
20   ,x_demand_source_delivery         IN     NUMBER
21   ,x_primary_uom_code               IN     VARCHAR2
22   ,x_primary_uom_id                 IN     NUMBER
23   ,x_secondary_uom_code             IN     VARCHAR2
24   ,x_secondary_uom_id               IN     NUMBER
25   ,x_reservation_uom_code           IN     VARCHAR2
26   ,x_reservation_uom_id             IN     NUMBER
27   ,x_reservation_quantity           IN     NUMBER
28   ,x_primary_reservation_quantity   IN     NUMBER
29   ,x_second_reservation_quantity    IN     NUMBER
30   ,x_detailed_quantity              IN     NUMBER
31   ,x_secondary_detailed_quantity    IN     NUMBER
32   ,x_autodetail_group_id            IN     NUMBER
33   ,x_external_source_code           IN     VARCHAR2
34   ,x_external_source_line_id        IN     NUMBER
35   ,x_supply_source_type_id          IN     NUMBER
36   ,x_supply_source_header_id        IN     NUMBER
37   ,x_supply_source_line_id          IN     NUMBER
38   ,x_supply_source_line_detail      IN     NUMBER
39   ,x_supply_source_name             IN     VARCHAR2
40   ,x_revision                       IN     VARCHAR2
41   ,x_subinventory_code              IN     VARCHAR2
42   ,x_subinventory_id                IN     NUMBER
43   ,x_locator_id                     IN     NUMBER
44   ,x_lot_number                     IN     VARCHAR2
45   ,x_lot_number_id                  IN     NUMBER
46   ,x_serial_number                  IN     VARCHAR2
47   ,x_serial_number_id               IN     NUMBER
48   ,x_partial_quantities_allowed     IN     NUMBER
49   ,x_auto_detailed                  IN     NUMBER
50   ,x_pick_slip_number               IN     NUMBER
51   ,x_lpn_id                         IN     NUMBER
52   ,x_last_update_date               IN     DATE
53   ,x_last_updated_by                IN     NUMBER
54   ,x_creation_date                  IN     DATE
55   ,x_created_by                     IN     NUMBER
56   ,x_last_update_login              IN     NUMBER
57   ,x_request_id                     IN     NUMBER
58   ,x_program_application_id         IN     NUMBER
59   ,x_program_id                     IN     NUMBER
60   ,x_program_update_date            IN     DATE
61   ,x_attribute_category             IN     VARCHAR2
62   ,x_attribute1                     IN     VARCHAR2
63   ,x_attribute2                     IN     VARCHAR2
64   ,x_attribute3                     IN     VARCHAR2
65   ,x_attribute4                     IN     VARCHAR2
66   ,x_attribute5                     IN     VARCHAR2
67   ,x_attribute6                     IN     VARCHAR2
68   ,x_attribute7                     IN     VARCHAR2
69   ,x_attribute8                     IN     VARCHAR2
70   ,x_attribute9                     IN     VARCHAR2
71   ,x_attribute10                    IN     VARCHAR2
72   ,x_attribute11                    IN     VARCHAR2
73   ,x_attribute12                    IN     VARCHAR2
74   ,x_attribute13                    IN     VARCHAR2
75   ,x_attribute14                    IN     VARCHAR2
76   ,x_attribute15                    IN     VARCHAR2
77   ,x_ship_ready_flag                IN     NUMBER
78   )IS
79 BEGIN
80  INSERT_ROW (
81    x_rowid                          =>     x_rowid
82   ,x_reservation_id                 =>     x_reservation_id
83   ,x_requirement_date               =>     x_requirement_date
84   ,x_organization_id                =>     x_organization_id
85   ,x_inventory_item_id              =>     x_inventory_item_id
86   ,x_demand_source_type_id          =>     x_demand_source_type_id
87   ,x_demand_source_name             =>     x_demand_source_name
88   ,x_demand_source_header_id        =>     x_demand_source_header_id
89   ,x_demand_source_line_id          =>     x_demand_source_line_id
90   ,x_demand_source_delivery         =>     x_demand_source_delivery
91   ,x_primary_uom_code               =>     x_primary_uom_code
92   ,x_primary_uom_id                 =>     x_primary_uom_id
93   ,x_secondary_uom_code             =>     x_secondary_uom_code
94   ,x_secondary_uom_id               =>     x_secondary_uom_id
95   ,x_reservation_uom_code           =>     x_reservation_uom_code
96   ,x_reservation_uom_id             =>     x_reservation_uom_id
97   ,x_reservation_quantity           =>     x_reservation_quantity
98   ,x_primary_reservation_quantity   =>     x_primary_reservation_quantity
99   ,x_second_reservation_quantity    =>     x_second_reservation_quantity
100   ,x_detailed_quantity              =>     x_detailed_quantity
101   ,x_secondary_detailed_quantity    =>     x_secondary_detailed_quantity
102   ,x_autodetail_group_id            =>     x_autodetail_group_id
103   ,x_external_source_code           =>     x_external_source_code
104   ,x_external_source_line_id        =>     x_external_source_line_id
105   ,x_supply_source_type_id          =>     x_supply_source_type_id
106   ,x_supply_source_header_id        =>     x_supply_source_header_id
107   ,x_supply_source_line_id          =>     x_supply_source_line_id
108   ,x_supply_source_line_detail      =>     x_supply_source_line_detail
109   ,x_supply_source_name             =>     x_supply_source_name
110   ,x_revision                       =>     x_revision
111   ,x_subinventory_code              =>     x_subinventory_code
112   ,x_subinventory_id                =>     x_subinventory_id
113   ,x_locator_id                     =>     x_locator_id
114   ,x_lot_number                     =>     x_lot_number
115   ,x_lot_number_id                  =>     x_lot_number_id
116   ,x_serial_number                  =>     x_serial_number
117   ,x_serial_number_id               =>     x_serial_number_id
118   ,x_partial_quantities_allowed     =>     x_partial_quantities_allowed
119   ,x_auto_detailed                  =>     x_auto_detailed
120   ,x_pick_slip_number               =>     x_pick_slip_number
121   ,x_lpn_id                         =>     x_lpn_id
122   ,x_last_update_date               =>     x_last_update_date
123   ,x_last_updated_by                =>     x_last_updated_by
124   ,x_creation_date                  =>     x_creation_date
125   ,x_created_by                     =>     x_created_by
126   ,x_last_update_login              =>     x_last_update_login
127   ,x_request_id                     =>     x_request_id
128   ,x_program_application_id         =>     x_program_application_id
129   ,x_program_id                     =>     x_program_id
130   ,x_program_update_date            =>     x_program_update_date
131   ,x_attribute_category             =>     x_attribute_category
132   ,x_attribute1                     =>     x_attribute1
133   ,x_attribute2                     =>     x_attribute2
134   ,x_attribute3                     =>     x_attribute3
135   ,x_attribute4                     =>     x_attribute4
136   ,x_attribute5                     =>     x_attribute5
137   ,x_attribute6                     =>     x_attribute6
138   ,x_attribute7                     =>     x_attribute7
139   ,x_attribute8                     =>     x_attribute8
140   ,x_attribute9                     =>     x_attribute9
141   ,x_attribute10                    =>     x_attribute10
142   ,x_attribute11                    =>     x_attribute11
143   ,x_attribute12                    =>     x_attribute12
144   ,x_attribute13                    =>     x_attribute13
145   ,x_attribute14                    =>     x_attribute14
146   ,x_attribute15                    =>     x_attribute15
147    ,x_ship_ready_flag                =>     x_ship_ready_flag
148    ,x_staged_flag                    =>     NULL
149    /**** {{ R12 Enhanced reservations code changes }}****/
150    , x_crossdock_flag               => NULL
151    , x_crossdock_criteria_id        => NULL
152    , x_demand_source_line_detail    => NULL
153    , x_serial_reservation_quantity  => NULL
154    , x_supply_receipt_date          => NULL
155    , x_demand_ship_date             => NULL
156    , x_project_id                   => NULL
157    , x_task_id                      => NULL
158    , x_orig_supply_type_id          => NULL
159    , x_orig_supply_header_id        => NULL
160    , x_orig_supply_line_id          => NULL
161    , x_orig_supply_line_detail      => NULL
162    , x_orig_demand_type_id          => NULL
163    , x_orig_demand_header_id        => NULL
164    , x_orig_demand_line_id          => NULL
165    , x_orig_demand_line_detail      => NULL
166    /*** End R12 ***/
167   );
168 
169 END INSERT_ROW;
170 
171 PROCEDURE INSERT_ROW (
172    x_rowid                          IN OUT NOCOPY VARCHAR2
173   ,x_reservation_id                 IN OUT NOCOPY NUMBER
174   ,x_requirement_date               IN     DATE
175   ,x_organization_id                IN     NUMBER
176   ,x_inventory_item_id              IN     NUMBER
177   ,x_demand_source_type_id          IN     NUMBER
178   ,x_demand_source_name             IN     VARCHAR2
179   ,x_demand_source_header_id        IN     NUMBER
180   ,x_demand_source_line_id          IN     NUMBER
181   ,x_demand_source_delivery         IN     NUMBER
182   ,x_primary_uom_code               IN     VARCHAR2
183   ,x_primary_uom_id                 IN     NUMBER
184   ,x_secondary_uom_code             IN     VARCHAR2
185   ,x_secondary_uom_id               IN     NUMBER
186   ,x_reservation_uom_code           IN     VARCHAR2
187   ,x_reservation_uom_id             IN     NUMBER
188   ,x_reservation_quantity           IN     NUMBER
189   ,x_primary_reservation_quantity   IN     NUMBER
190   ,x_second_reservation_quantity    IN     NUMBER
191   ,x_detailed_quantity              IN     NUMBER
192   ,x_secondary_detailed_quantity    IN     NUMBER
193   ,x_autodetail_group_id            IN     NUMBER
194   ,x_external_source_code           IN     VARCHAR2
195   ,x_external_source_line_id        IN     NUMBER
196   ,x_supply_source_type_id          IN     NUMBER
197   ,x_supply_source_header_id        IN     NUMBER
198   ,x_supply_source_line_id          IN     NUMBER
199   ,x_supply_source_line_detail      IN     NUMBER
200   ,x_supply_source_name             IN     VARCHAR2
201   ,x_revision                       IN     VARCHAR2
202   ,x_subinventory_code              IN     VARCHAR2
203   ,x_subinventory_id                IN     NUMBER
204   ,x_locator_id                     IN     NUMBER
205   ,x_lot_number                     IN     VARCHAR2
206   ,x_lot_number_id                  IN     NUMBER
207   ,x_serial_number                  IN     VARCHAR2
208   ,x_serial_number_id               IN     NUMBER
209   ,x_partial_quantities_allowed     IN     NUMBER
210   ,x_auto_detailed                  IN     NUMBER
211   ,x_pick_slip_number               IN     NUMBER
212   ,x_lpn_id                         IN     NUMBER
213   ,x_last_update_date               IN     DATE
214   ,x_last_updated_by                IN     NUMBER
215   ,x_creation_date                  IN     DATE
216   ,x_created_by                     IN     NUMBER
217   ,x_last_update_login              IN     NUMBER
218   ,x_request_id                     IN     NUMBER
219   ,x_program_application_id         IN     NUMBER
220   ,x_program_id                     IN     NUMBER
221   ,x_program_update_date            IN     DATE
222   ,x_attribute_category             IN     VARCHAR2
223   ,x_attribute1                     IN     VARCHAR2
224   ,x_attribute2                     IN     VARCHAR2
225   ,x_attribute3                     IN     VARCHAR2
226   ,x_attribute4                     IN     VARCHAR2
227   ,x_attribute5                     IN     VARCHAR2
228   ,x_attribute6                     IN     VARCHAR2
229   ,x_attribute7                     IN     VARCHAR2
230   ,x_attribute8                     IN     VARCHAR2
231   ,x_attribute9                     IN     VARCHAR2
232   ,x_attribute10                    IN     VARCHAR2
233   ,x_attribute11                    IN     VARCHAR2
234   ,x_attribute12                    IN     VARCHAR2
235   ,x_attribute13                    IN     VARCHAR2
236   ,x_attribute14                    IN     VARCHAR2
237   ,x_attribute15                    IN     VARCHAR2
238   ,x_ship_ready_flag                IN     NUMBER
239   ,x_staged_flag                    IN     VARCHAR2
240   /**** {{ R12 Enhanced reservations code changes }}****/
241   , x_crossdock_flag                IN     VARCHAR2
242   , x_crossdock_criteria_id         IN     NUMBER
243   , x_demand_source_line_detail     IN     NUMBER
244   , x_serial_reservation_quantity   IN     NUMBER
245   , x_supply_receipt_date           IN     DATE
246   , x_demand_ship_date              IN     DATE
247   , x_project_id                    IN     NUMBER
248   , x_task_id                       IN     NUMBER
249   , x_orig_supply_type_id    IN     NUMBER
250   , x_orig_supply_header_id  IN     NUMBER
251   , x_orig_supply_line_id    IN     NUMBER
252   , x_orig_supply_line_detail IN    NUMBER
253   , x_orig_demand_type_id    IN     NUMBER
254   , x_orig_demand_header_id  IN     NUMBER
255   , x_orig_demand_line_id    IN     NUMBER
256   , x_orig_demand_line_detail IN    NUMBER
257    /*** End R12 ***/
258   )IS
259     CURSOR C IS SELECT ROWID FROM MTL_RESERVATIONS
260       WHERE reservation_id = x_reservation_id;
261 BEGIN
262    INSERT INTO MTL_RESERVATIONS (
263        reservation_id
264       ,requirement_date
265       ,organization_id
266       ,inventory_item_id
267       ,demand_source_type_id
268       ,demand_source_name
269       ,demand_source_header_id
270       ,demand_source_line_id
271       ,demand_source_delivery
272       ,primary_uom_code
273       ,primary_uom_id
274       ,secondary_uom_code
275       ,secondary_uom_id
276       ,reservation_uom_code
277       ,reservation_uom_id
278       ,reservation_quantity
279       ,primary_reservation_quantity
280       ,secondary_reservation_quantity
281       ,detailed_quantity
282       ,secondary_detailed_quantity
283       ,autodetail_group_id
284       ,external_source_code
285       ,external_source_line_id
286       ,supply_source_type_id
287       ,supply_source_header_id
288       ,supply_source_line_id
289       ,supply_source_line_detail
290       ,supply_source_name
291       ,revision
292       ,subinventory_code
293       ,subinventory_id
294       ,locator_id
295       ,lot_number
296       ,lot_number_id
297       ,serial_number
298       ,serial_number_id
299       ,partial_quantities_allowed
300       ,auto_detailed
301       ,pick_slip_number
302       ,lpn_id
303       ,last_update_date
304       ,last_updated_by
305       ,creation_date
306       ,created_by
307       ,last_update_login
308       ,request_id
309       ,program_application_id
310       ,program_id
311       ,program_update_date
312       ,attribute_category
313       ,attribute1
314       ,attribute2
315       ,attribute3
316       ,attribute4
317       ,attribute5
318       ,attribute6
319       ,attribute7
320       ,attribute8
321       ,attribute9
322       ,attribute10
323       ,attribute11
324       ,attribute12
325       ,attribute13
326       ,attribute14
327       ,attribute15
328       ,ship_ready_flag
329      ,staged_flag
330       /**** {{ R12 Enhanced reservations code changes }}****/
331      , crossdock_flag
332      , crossdock_criteria_id
333      , demand_source_line_detail
334      , serial_reservation_quantity
335      , supply_receipt_date
336      , demand_ship_date
337      , project_id
338      , task_id
339      , orig_supply_source_type_id
340      , orig_supply_source_header_id
341      , orig_supply_source_line_id
342      , orig_supply_source_line_detail
343      , orig_demand_source_type_id
344      , orig_demand_source_header_id
345      , orig_demand_source_line_id
346      , orig_demand_source_line_detail
347      /*** End R12 ***/
348     ) values (
349        nvl(x_reservation_id, mtl_demand_s.NEXTVAL)
350       ,x_requirement_date
351       ,x_organization_id
352       ,x_inventory_item_id
353       ,x_demand_source_type_id
354       ,x_demand_source_name
355       ,x_demand_source_header_id
356       ,x_demand_source_line_id
357       ,x_demand_source_delivery
358       ,x_primary_uom_code
359       ,x_primary_uom_id
360       ,x_secondary_uom_code
361       ,x_secondary_uom_id
362       ,x_reservation_uom_code
363       ,x_reservation_uom_id
364       ,x_reservation_quantity
365       ,x_primary_reservation_quantity
366       ,x_second_reservation_quantity
367       ,x_detailed_quantity
368       ,x_secondary_detailed_quantity
369       ,x_autodetail_group_id
370       ,x_external_source_code
371       ,x_external_source_line_id
372       ,x_supply_source_type_id
373       ,x_supply_source_header_id
374       ,x_supply_source_line_id
375       ,x_supply_source_line_detail
376       ,x_supply_source_name
377       ,x_revision
378       ,x_subinventory_code
379       ,x_subinventory_id
380       ,x_locator_id
381       ,x_lot_number
382       ,x_lot_number_id
383       ,x_serial_number
384       ,x_serial_number_id
385       ,x_partial_quantities_allowed
386       ,x_auto_detailed
387       ,x_pick_slip_number
388       ,x_lpn_id
389       ,x_last_update_date
390       ,x_last_updated_by
391       ,x_creation_date
392       ,x_created_by
393       ,x_last_update_login
394       ,x_request_id
395       ,x_program_application_id
396       ,x_program_id
397       ,x_program_update_date
398       ,x_attribute_category
399       ,x_attribute1
400       ,x_attribute2
401       ,x_attribute3
402       ,x_attribute4
403       ,x_attribute5
404       ,x_attribute6
405       ,x_attribute7
406       ,x_attribute8
407       ,x_attribute9
408       ,x_attribute10
409       ,x_attribute11
410       ,x_attribute12
411       ,x_attribute13
412       ,x_attribute14
413       ,x_attribute15
414       ,x_ship_ready_flag
415      ,x_staged_flag
416       /**** {{ R12 Enhanced reservations code changes }}****/
417      , x_crossdock_flag
418      , x_crossdock_criteria_id
419      , x_demand_source_line_detail
420      , x_serial_reservation_quantity
421      , x_supply_receipt_date
422      , x_demand_ship_date
423      , x_project_id
424      , x_task_id
425      , x_orig_supply_type_id
426      , x_orig_supply_header_id
427      , x_orig_supply_line_id
428      , x_orig_supply_line_detail
429      , x_orig_demand_type_id
430      , x_orig_demand_header_id
431      , x_orig_demand_line_id
432      , x_orig_demand_line_detail
433      /*** End R12 ***/
434    )RETURNING reservation_id INTO  x_reservation_id;
435 
436   OPEN C;
437   FETCH C INTO x_rowid;
438   IF (C%NOTFOUND) THEN
439      CLOSE C;
440      RAISE NO_DATA_FOUND;
441   END IF;
442   CLOSE C;
443 END INSERT_ROW;
444 
445 PROCEDURE LOCK_ROW (
446    x_reservation_id                 IN     NUMBER
447   ,x_requirement_date               IN     DATE
448   ,x_organization_id                IN     NUMBER
449   ,x_inventory_item_id              IN     NUMBER
450   ,x_demand_source_type_id          IN     NUMBER
451   ,x_demand_source_name             IN     VARCHAR2
452   ,x_demand_source_header_id        IN     NUMBER
453   ,x_demand_source_line_id          IN     NUMBER
454   ,x_demand_source_delivery         IN     NUMBER
455   ,x_primary_uom_code               IN     VARCHAR2
456   ,x_primary_uom_id                 IN     NUMBER
457   ,x_secondary_uom_code             IN     VARCHAR2
458   ,x_secondary_uom_id               IN     NUMBER
459   ,x_reservation_uom_code           IN     VARCHAR2
460   ,x_reservation_uom_id             IN     NUMBER
461   ,x_reservation_quantity           IN     NUMBER
462   ,x_primary_reservation_quantity   IN     NUMBER
463   ,x_second_reservation_quantity    IN     NUMBER
464   ,x_detailed_quantity              IN     NUMBER
465   ,x_secondary_detailed_quantity    IN     NUMBER
466   ,x_autodetail_group_id            IN     NUMBER
467   ,x_external_source_code           IN     VARCHAR2
468   ,x_external_source_line_id        IN     NUMBER
469   ,x_supply_source_type_id          IN     NUMBER
470   ,x_supply_source_header_id        IN     NUMBER
471   ,x_supply_source_line_id          IN     NUMBER
472   ,x_supply_source_line_detail      IN     NUMBER
473   ,x_supply_source_name             IN     VARCHAR2
474   ,x_revision                       IN     VARCHAR2
475   ,x_subinventory_code              IN     VARCHAR2
476   ,x_subinventory_id                IN     NUMBER
477   ,x_locator_id                     IN     NUMBER
478   ,x_lot_number                     IN     VARCHAR2
479   ,x_lot_number_id                  IN     NUMBER
480   ,x_serial_number                  IN     VARCHAR2
481   ,x_serial_number_id               IN     NUMBER
482   ,x_partial_quantities_allowed     IN     NUMBER
483   ,x_auto_detailed                  IN     NUMBER
484   ,x_pick_slip_number               IN     NUMBER
485   ,x_lpn_id                         IN     NUMBER
486   ,x_request_id                     IN     NUMBER
487   ,x_program_application_id         IN     NUMBER
488   ,x_program_id                     IN     NUMBER
489   ,x_program_update_date            IN     DATE
490   ,x_attribute_category             IN     VARCHAR2
491   ,x_attribute1                     IN     VARCHAR2
492   ,x_attribute2                     IN     VARCHAR2
493   ,x_attribute3                     IN     VARCHAR2
494   ,x_attribute4                     IN     VARCHAR2
495   ,x_attribute5                     IN     VARCHAR2
496   ,x_attribute6                     IN     VARCHAR2
497   ,x_attribute7                     IN     VARCHAR2
498   ,x_attribute8                     IN     VARCHAR2
499   ,x_attribute9                     IN     VARCHAR2
500   ,x_attribute10                    IN     VARCHAR2
501   ,x_attribute11                    IN     VARCHAR2
502   ,x_attribute12                    IN     VARCHAR2
503   ,x_attribute13                    IN     VARCHAR2
504   ,x_attribute14                    IN     VARCHAR2
505   ,x_attribute15                    IN     VARCHAR2
506   ,x_ship_ready_flag                IN     NUMBER
507   )IS
508 BEGIN
509 
510  LOCK_ROW (
511    x_reservation_id                 =>     x_reservation_id
512   ,x_requirement_date               =>     x_requirement_date
513   ,x_organization_id                =>     x_organization_id
514   ,x_inventory_item_id              =>     x_inventory_item_id
515   ,x_demand_source_type_id          =>     x_demand_source_type_id
516   ,x_demand_source_name             =>     x_demand_source_name
517   ,x_demand_source_header_id        =>     x_demand_source_header_id
518   ,x_demand_source_line_id          =>     x_demand_source_line_id
519   ,x_demand_source_delivery         =>     x_demand_source_delivery
520   ,x_primary_uom_code               =>     x_primary_uom_code
521   ,x_primary_uom_id                 =>     x_primary_uom_id
522   ,x_secondary_uom_code             =>     x_secondary_uom_code
523   ,x_secondary_uom_id               =>     x_secondary_uom_id
524   ,x_reservation_uom_code           =>     x_reservation_uom_code
525   ,x_reservation_uom_id             =>     x_reservation_uom_id
526   ,x_reservation_quantity           =>     x_reservation_quantity
527   ,x_primary_reservation_quantity   =>     x_primary_reservation_quantity
528   ,x_second_reservation_quantity    =>     x_second_reservation_quantity
529   ,x_detailed_quantity              =>     x_detailed_quantity
530   ,x_secondary_detailed_quantity    =>     x_secondary_detailed_quantity
531   ,x_autodetail_group_id            =>     x_autodetail_group_id
532   ,x_external_source_code           =>     x_external_source_code
533   ,x_external_source_line_id        =>     x_external_source_line_id
534   ,x_supply_source_type_id          =>     x_supply_source_type_id
535   ,x_supply_source_header_id        =>     x_supply_source_header_id
536   ,x_supply_source_line_id          =>     x_supply_source_line_id
537   ,x_supply_source_line_detail      =>     x_supply_source_line_detail
538   ,x_supply_source_name             =>     x_supply_source_name
539   ,x_revision                       =>     x_revision
540   ,x_subinventory_code              =>     x_subinventory_code
541   ,x_subinventory_id                =>     x_subinventory_id
542   ,x_locator_id                     =>     x_locator_id
543   ,x_lot_number                     =>     x_lot_number
544   ,x_lot_number_id                  =>     x_lot_number_id
545   ,x_serial_number                  =>     x_serial_number
546   ,x_serial_number_id               =>     x_serial_number_id
547   ,x_partial_quantities_allowed     =>     x_partial_quantities_allowed
548   ,x_auto_detailed                  =>     x_auto_detailed
549   ,x_pick_slip_number               =>     x_pick_slip_number
550   ,x_lpn_id                         =>     x_lpn_id
551   ,x_request_id                     =>     x_request_id
552   ,x_program_application_id         =>     x_program_application_id
553   ,x_program_id                     =>     x_program_id
554   ,x_program_update_date            =>     x_program_update_date
555   ,x_attribute_category             =>     x_attribute_category
556   ,x_attribute1                     =>     x_attribute1
557   ,x_attribute2                     =>     x_attribute2
558   ,x_attribute3                     =>     x_attribute3
559   ,x_attribute4                     =>     x_attribute4
560   ,x_attribute5                     =>     x_attribute5
561   ,x_attribute6                     =>     x_attribute6
562   ,x_attribute7                     =>     x_attribute7
563   ,x_attribute8                     =>     x_attribute8
564   ,x_attribute9                     =>     x_attribute9
565   ,x_attribute10                    =>     x_attribute10
566   ,x_attribute11                    =>     x_attribute11
567   ,x_attribute12                    =>     x_attribute12
568   ,x_attribute13                    =>     x_attribute13
569   ,x_attribute14                    =>     x_attribute14
570   ,x_attribute15                    =>     x_attribute15
571   ,x_ship_ready_flag                =>     x_ship_ready_flag
572    ,x_staged_flag                    =>     NULL
573     /**** {{ R12 Enhanced reservations code changes }}****/
574    , x_crossdock_flag               => NULL
575    , x_crossdock_criteria_id        => NULL
576    , x_demand_source_line_detail    => NULL
577    , x_serial_reservation_quantity  => NULL
578    , x_supply_receipt_date          => NULL
579    , x_demand_ship_date             => NULL
580    , x_project_id                   => NULL
581    , x_task_id                      => NULL
582    , x_orig_supply_type_id          => NULL
583    , x_orig_supply_header_id        => NULL
584    , x_orig_supply_line_id          => NULL
585    , x_orig_supply_line_detail      => NULL
586    , x_orig_demand_type_id          => NULL
587    , x_orig_demand_header_id        => NULL
588    , x_orig_demand_line_id          => NULL
589    , x_orig_demand_line_detail      => NULL
590    /*** End R12 ***/
591   );
592 END LOCK_ROW;
593 
594 PROCEDURE LOCK_ROW (
595    x_reservation_id                 IN     NUMBER
596   ,x_requirement_date               IN     DATE
597   ,x_organization_id                IN     NUMBER
598   ,x_inventory_item_id              IN     NUMBER
599   ,x_demand_source_type_id          IN     NUMBER
600   ,x_demand_source_name             IN     VARCHAR2
601   ,x_demand_source_header_id        IN     NUMBER
602   ,x_demand_source_line_id          IN     NUMBER
603   ,x_demand_source_delivery         IN     NUMBER
604   ,x_primary_uom_code               IN     VARCHAR2
605   ,x_primary_uom_id                 IN     NUMBER
606   ,x_secondary_uom_code             IN     VARCHAR2
607   ,x_secondary_uom_id               IN     NUMBER
608   ,x_reservation_uom_code           IN     VARCHAR2
609   ,x_reservation_uom_id             IN     NUMBER
610   ,x_reservation_quantity           IN     NUMBER
611   ,x_primary_reservation_quantity   IN     NUMBER
612   ,x_second_reservation_quantity    IN     NUMBER
613   ,x_detailed_quantity              IN     NUMBER
614   ,x_secondary_detailed_quantity    IN     NUMBER
615   ,x_autodetail_group_id            IN     NUMBER
616   ,x_external_source_code           IN     VARCHAR2
617   ,x_external_source_line_id        IN     NUMBER
618   ,x_supply_source_type_id          IN     NUMBER
619   ,x_supply_source_header_id        IN     NUMBER
620   ,x_supply_source_line_id          IN     NUMBER
621   ,x_supply_source_line_detail      IN     NUMBER
622   ,x_supply_source_name             IN     VARCHAR2
623   ,x_revision                       IN     VARCHAR2
624   ,x_subinventory_code              IN     VARCHAR2
625   ,x_subinventory_id                IN     NUMBER
626   ,x_locator_id                     IN     NUMBER
627   ,x_lot_number                     IN     VARCHAR2
628   ,x_lot_number_id                  IN     NUMBER
629   ,x_serial_number                  IN     VARCHAR2
630   ,x_serial_number_id               IN     NUMBER
631   ,x_partial_quantities_allowed     IN     NUMBER
632   ,x_auto_detailed                  IN     NUMBER
633   ,x_pick_slip_number               IN     NUMBER
634   ,x_lpn_id                         IN     NUMBER
635   ,x_request_id                     IN     NUMBER
636   ,x_program_application_id         IN     NUMBER
637   ,x_program_id                     IN     NUMBER
638   ,x_program_update_date            IN     DATE
639   ,x_attribute_category             IN     VARCHAR2
640   ,x_attribute1                     IN     VARCHAR2
641   ,x_attribute2                     IN     VARCHAR2
642   ,x_attribute3                     IN     VARCHAR2
643   ,x_attribute4                     IN     VARCHAR2
644   ,x_attribute5                     IN     VARCHAR2
645   ,x_attribute6                     IN     VARCHAR2
646   ,x_attribute7                     IN     VARCHAR2
647   ,x_attribute8                     IN     VARCHAR2
648   ,x_attribute9                     IN     VARCHAR2
649   ,x_attribute10                    IN     VARCHAR2
650   ,x_attribute11                    IN     VARCHAR2
651   ,x_attribute12                    IN     VARCHAR2
652   ,x_attribute13                    IN     VARCHAR2
653   ,x_attribute14                    IN     VARCHAR2
654   ,x_attribute15                    IN     VARCHAR2
655   ,x_ship_ready_flag                IN     NUMBER
656   ,x_staged_flag                    IN     VARCHAR2
657   /**** {{ R12 Enhanced reservations code changes }}****/
658   , x_crossdock_flag                IN     VARCHAR2
659   , x_crossdock_criteria_id         IN     NUMBER
660   , x_demand_source_line_detail     IN     NUMBER
661   , x_serial_reservation_quantity   IN     NUMBER
662   , x_supply_receipt_date           IN     DATE
663   , x_demand_ship_date              IN     DATE
664   , x_project_id                    IN     NUMBER
665   , x_task_id                       IN     NUMBER
666   , x_orig_supply_type_id    IN     NUMBER
667   , x_orig_supply_header_id  IN     NUMBER
668   , x_orig_supply_line_id    IN     NUMBER
669   , x_orig_supply_line_detail IN    NUMBER
670   , x_orig_demand_type_id    IN     NUMBER
671   , x_orig_demand_header_id  IN     NUMBER
672   , x_orig_demand_line_id    IN     NUMBER
673   , x_orig_demand_line_detail IN    NUMBER
674    /*** End R12 ***/
675   )IS
676     CURSOR C IS SELECT
677        reservation_id
678       ,requirement_date
679       ,organization_id
680       ,inventory_item_id
681       ,demand_source_type_id
682       ,demand_source_name
683       ,demand_source_header_id
684       ,demand_source_line_id
685       ,demand_source_delivery
686       ,primary_uom_code
687       ,primary_uom_id
688       ,secondary_uom_code
689       ,secondary_uom_id
690       ,reservation_uom_code
691       ,reservation_uom_id
692       ,reservation_quantity
693       ,primary_reservation_quantity
694       ,secondary_reservation_quantity
695       ,detailed_quantity
696       ,secondary_detailed_quantity
697       ,autodetail_group_id
698       ,external_source_code
699       ,external_source_line_id
700       ,supply_source_type_id
701       ,supply_source_header_id
702       ,supply_source_line_id
703       ,supply_source_line_detail
704       ,supply_source_name
705       ,revision
706       ,subinventory_code
707       ,subinventory_id
708       ,locator_id
709       ,lot_number
710       ,lot_number_id
711       ,serial_number
712       ,serial_number_id
713       ,partial_quantities_allowed
714       ,auto_detailed
715       ,pick_slip_number
716       ,lpn_id
717       ,request_id
718       ,program_application_id
719       ,program_id
720       ,program_update_date
721       ,attribute_category
722       ,attribute1
723       ,attribute2
724       ,attribute3
725       ,attribute4
726       ,attribute5
727       ,attribute6
728       ,attribute7
729       ,attribute8
730       ,attribute9
731       ,attribute10
732       ,attribute11
733       ,attribute12
734       ,attribute13
735       ,attribute14
736       ,attribute15
737       ,ship_ready_flag
738       ,staged_flag
739       /**** {{ R12 Enhanced reservations code changes }}****/
740       , crossdock_flag
741       , crossdock_criteria_id
742       , demand_source_line_detail
743       , serial_reservation_quantity
744       , supply_receipt_date
745       , demand_ship_date
746       , project_id
747       , task_id
748       /*** End R12 ***/
749      FROM MTL_RESERVATIONS
750      WHERE reservation_id = x_reservation_id
751      FOR UPDATE OF reservation_id NOWAIT;
752 
753   recinfo c%ROWTYPE;
754 BEGIN
755    OPEN c;
756    FETCH c INTO recinfo;
757    IF (c%notfound) THEN
758       CLOSE c;
759       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
760       app_exception.raise_exception;
761    END IF;
762    CLOSE c;
763    IF (    (recinfo.reservation_id = x_reservation_id)
764        AND (recinfo.requirement_date = x_requirement_date)
765        AND (recinfo.organization_id = x_organization_id)
766        AND (recinfo.inventory_item_id = x_inventory_item_id)
767        AND (recinfo.demand_source_type_id = x_demand_source_type_id)
768        AND ((recinfo.demand_source_name = x_demand_source_name)
769              OR ((recinfo.demand_source_name IS NULL)
770             AND (x_demand_source_name IS NULL)))
771        AND ((recinfo.demand_source_header_id = x_demand_source_header_id)
772              OR ((recinfo.demand_source_header_id IS NULL)
773             AND (x_demand_source_header_id IS NULL)))
774        AND ((recinfo.demand_source_line_id = x_demand_source_line_id)
775              OR ((recinfo.demand_source_line_id IS NULL)
776             AND (x_demand_source_line_id IS NULL)))
777        AND ((recinfo.demand_source_delivery = x_demand_source_delivery)
778              OR ((recinfo.demand_source_delivery IS NULL)
779             AND (x_demand_source_delivery IS NULL)))
780        AND ((recinfo.primary_uom_code = x_primary_uom_code)
781              OR ((recinfo.primary_uom_code IS NULL)
782             AND (x_primary_uom_code IS NULL)))
783        AND ((recinfo.primary_uom_id = x_primary_uom_id)
784              OR ((recinfo.primary_uom_id IS NULL)
785             AND (x_primary_uom_id IS NULL)))
786        -- INVCONV BEGIN
787        AND ((recinfo.secondary_uom_code = x_secondary_uom_code)
788              OR ((recinfo.secondary_uom_code IS NULL)
789             AND (x_secondary_uom_code IS NULL)))
790        AND ((recinfo.secondary_uom_id = x_secondary_uom_id)
791              OR ((recinfo.secondary_uom_id IS NULL)
792             AND (x_secondary_uom_id IS NULL)))
793        -- INVCONV END
794        AND ((recinfo.reservation_uom_code = x_reservation_uom_code)
795              OR ((recinfo.reservation_uom_code IS NULL)
796             AND (x_reservation_uom_code IS NULL)))
797        AND ((recinfo.reservation_uom_id = x_reservation_uom_id)
798              OR ((recinfo.reservation_uom_id IS NULL)
799             AND (x_reservation_uom_id IS NULL)))
800        AND (recinfo.reservation_quantity = x_reservation_quantity)
801        AND (recinfo.primary_reservation_quantity = x_primary_reservation_quantity)
802        -- INVCONV BEGIN
803        AND (recinfo.secondary_reservation_quantity = x_second_reservation_quantity)
804        -- INVCONV END
805        AND (recinfo.detailed_quantity = x_detailed_quantity)
806        -- INVCONV BEGIN
807        AND (recinfo.secondary_detailed_quantity = x_secondary_detailed_quantity)
808        -- INVCONV END
809        AND ((recinfo.autodetail_group_id = x_autodetail_group_id)
810              OR ((recinfo.autodetail_group_id IS NULL)
811             AND (x_autodetail_group_id IS NULL)))
812        AND ((recinfo.external_source_code = x_external_source_code)
813              OR ((recinfo.external_source_code IS NULL)
814             AND (x_external_source_code IS NULL)))
815        AND ((recinfo.external_source_line_id = x_external_source_line_id)
816              OR ((recinfo.external_source_line_id IS NULL)
817             AND (x_external_source_line_id IS NULL)))
818        AND (recinfo.supply_source_type_id = x_supply_source_type_id)
819        AND ((recinfo.supply_source_header_id = x_supply_source_header_id)
820              OR ((recinfo.supply_source_header_id IS NULL)
821             AND (x_supply_source_header_id IS NULL)))
822        AND ((recinfo.supply_source_line_id = x_supply_source_line_id)
823              OR ((recinfo.supply_source_line_id IS NULL)
824             AND (x_supply_source_line_id IS NULL)))
825        AND ((recinfo.supply_source_line_detail = x_supply_source_line_detail)
826              OR ((recinfo.supply_source_line_detail IS NULL)
827             AND (x_supply_source_line_detail IS NULL)))
828        AND ((recinfo.supply_source_name = x_supply_source_name)
829              OR ((recinfo.supply_source_name IS NULL)
830             AND (x_supply_source_name IS NULL)))
831        AND ((recinfo.revision = x_revision)
832              OR ((recinfo.revision IS NULL)
833             AND (x_revision IS NULL)))
834        AND ((recinfo.subinventory_code = x_subinventory_code)
835              OR ((recinfo.subinventory_code IS NULL)
836             AND (x_subinventory_code IS NULL)))
837        AND ((recinfo.subinventory_id = x_subinventory_id)
838              OR ((recinfo.subinventory_id IS NULL)
839             AND (x_subinventory_id IS NULL)))
840        AND ((recinfo.locator_id = x_locator_id)
841              OR ((recinfo.locator_id IS NULL)
842             AND (x_locator_id IS NULL)))
843        AND ((recinfo.lot_number = x_lot_number)
844              OR ((recinfo.lot_number IS NULL)
845             AND (x_lot_number IS NULL)))
846        AND ((recinfo.lot_number_id = x_lot_number_id)
847              OR ((recinfo.lot_number_id IS NULL)
848             AND (x_lot_number_id IS NULL)))
849        AND ((recinfo.serial_number = x_serial_number)
850              OR ((recinfo.serial_number IS NULL)
851             AND (x_serial_number IS NULL)))
852        AND ((recinfo.serial_number_id = x_serial_number_id)
853              OR ((recinfo.serial_number_id IS NULL)
854             AND (x_serial_number_id IS NULL)))
855        AND ((recinfo.partial_quantities_allowed = x_partial_quantities_allowed)
856              OR ((recinfo.partial_quantities_allowed IS NULL)
857             AND (x_partial_quantities_allowed IS NULL)))
858        AND ((recinfo.auto_detailed = x_auto_detailed)
859              OR ((recinfo.auto_detailed IS NULL)
860             AND (x_auto_detailed IS NULL)))
861        AND ((recinfo.pick_slip_number = x_pick_slip_number)
862              OR ((recinfo.pick_slip_number IS NULL)
863             AND (x_pick_slip_number IS NULL)))
864        AND ((recinfo.lpn_id = x_lpn_id)
865              OR ((recinfo.lpn_id IS NULL)
866             AND (x_lpn_id IS NULL)))
867        AND ((recinfo.request_id = x_request_id)
868              OR ((recinfo.request_id IS NULL)
869             AND (x_request_id IS NULL)))
870        AND ((recinfo.program_application_id = x_program_application_id)
871              OR ((recinfo.program_application_id IS NULL)
872             AND (x_program_application_id IS NULL)))
873        AND ((recinfo.program_id = x_program_id)
874              OR ((recinfo.program_id IS NULL)
875             AND (x_program_id IS NULL)))
876        AND ((recinfo.program_update_date = x_program_update_date)
877              OR ((recinfo.program_update_date IS NULL)
878             AND (x_program_update_date IS NULL)))
879        AND ((recinfo.attribute_category = x_attribute_category)
880              OR ((recinfo.attribute_category IS NULL)
881             AND (x_attribute_category IS NULL)))
882        AND ((recinfo.attribute1 = x_attribute1)
883              OR ((recinfo.attribute1 IS NULL)
884             AND (x_attribute1 IS NULL)))
885        AND ((recinfo.attribute2 = x_attribute2)
886              OR ((recinfo.attribute2 IS NULL)
887             AND (x_attribute2 IS NULL)))
888        AND ((recinfo.attribute3 = x_attribute3)
889              OR ((recinfo.attribute3 IS NULL)
890             AND (x_attribute3 IS NULL)))
891        AND ((recinfo.attribute4 = x_attribute4)
892              OR ((recinfo.attribute4 IS NULL)
893             AND (x_attribute4 IS NULL)))
894        AND ((recinfo.attribute5 = x_attribute5)
895              OR ((recinfo.attribute5 IS NULL)
896             AND (x_attribute5 IS NULL)))
897        AND ((recinfo.attribute6 = x_attribute6)
898              OR ((recinfo.attribute6 IS NULL)
899             AND (x_attribute6 IS NULL)))
900        AND ((recinfo.attribute7 = x_attribute7)
901              OR ((recinfo.attribute7 IS NULL)
902             AND (x_attribute7 IS NULL)))
903        AND ((recinfo.attribute8 = x_attribute8)
904              OR ((recinfo.attribute8 IS NULL)
905             AND (x_attribute8 IS NULL)))
906        AND ((recinfo.attribute9 = x_attribute9)
907              OR ((recinfo.attribute9 IS NULL)
908             AND (x_attribute9 IS NULL)))
909        AND ((recinfo.attribute10 = x_attribute10)
910              OR ((recinfo.attribute10 IS NULL)
911             AND (x_attribute10 IS NULL)))
912        AND ((recinfo.attribute11 = x_attribute11)
913              OR ((recinfo.attribute11 IS NULL)
914             AND (x_attribute11 IS NULL)))
915        AND ((recinfo.attribute12 = x_attribute12)
916              OR ((recinfo.attribute12 IS NULL)
917             AND (x_attribute12 IS NULL)))
918        AND ((recinfo.attribute13 = x_attribute13)
919              OR ((recinfo.attribute13 IS NULL)
920             AND (x_attribute13 IS NULL)))
921        AND ((recinfo.attribute14 = x_attribute14)
922              OR ((recinfo.attribute14 IS NULL)
923             AND (x_attribute14 IS NULL)))
924        AND ((recinfo.attribute15 = x_attribute15)
925              OR ((recinfo.attribute15 IS NULL)
926             AND (x_attribute15 IS NULL)))
927        AND ((recinfo.ship_ready_flag = x_ship_ready_flag)
928              OR ((recinfo.ship_ready_flag IS NULL)
929             AND (x_ship_ready_flag IS NULL)))
930        AND ((recinfo.staged_flag = x_staged_flag)
931              OR ((recinfo.staged_flag IS NULL)
932 		 AND (x_staged_flag IS NULL)))
933 /**** {{ R12 Enhanced reservations code changes }}****/
934 	AND ((recinfo.crossdock_flag = x_crossdock_flag)
935              OR ((recinfo.crossdock_flag IS NULL)
936 		 AND (x_crossdock_flag IS NULL)))
937         AND ((recinfo.crossdock_criteria_id = x_crossdock_criteria_id)
938              OR ((recinfo.crossdock_criteria_id IS NULL)
939 		 AND (x_crossdock_criteria_id IS NULL)))
940         AND ((recinfo.demand_source_line_detail = x_demand_source_line_detail)
941              OR ((recinfo.demand_source_line_detail IS NULL)
942             AND (x_demand_source_line_detail IS NULL)))
943         AND ((recinfo.serial_reservation_quantity = x_serial_reservation_quantity)
944              OR ((recinfo.serial_reservation_quantity IS NULL)
945             AND (x_serial_reservation_quantity IS NULL)))
946         AND ((recinfo.supply_receipt_date = x_supply_receipt_date)
947              OR ((recinfo.supply_receipt_date IS NULL)
948             AND (x_supply_receipt_date IS NULL)))
949         AND ((recinfo.demand_ship_date = x_demand_ship_date)
950              OR ((recinfo.demand_ship_date IS NULL)
951             AND (x_demand_ship_date IS NULL)))
952         AND ((recinfo.project_id = x_project_id)
953              OR ((recinfo.project_id IS NULL)
954             AND (x_project_id IS NULL)))
955         AND ((recinfo.task_id = x_task_id)
956              OR ((recinfo.task_id IS NULL)
957             AND (x_task_id IS NULL)))
958 /*** End R12 ***/
959    ) THEN
960      NULL;
961    ELSE
962      fnd_message.set_name('FND','FORM_RECORD_CHANGED');
963      app_exception.raise_exception;
964    END IF;
965 END LOCK_ROW;
966 
967 PROCEDURE UPDATE_ROW (
968    x_reservation_id                 IN     NUMBER
969   ,x_requirement_date               IN     DATE
970   ,x_organization_id                IN     NUMBER
971   ,x_inventory_item_id              IN     NUMBER
972   ,x_demand_source_type_id          IN     NUMBER
973   ,x_demand_source_name             IN     VARCHAR2
974   ,x_demand_source_header_id        IN     NUMBER
975   ,x_demand_source_line_id          IN     NUMBER
976   ,x_demand_source_delivery         IN     NUMBER
977   ,x_primary_uom_code               IN     VARCHAR2
978   ,x_primary_uom_id                 IN     NUMBER
979   ,x_secondary_uom_code             IN     VARCHAR2
980   ,x_secondary_uom_id               IN     NUMBER
981   ,x_reservation_uom_code           IN     VARCHAR2
982   ,x_reservation_uom_id             IN     NUMBER
983   ,x_reservation_quantity           IN     NUMBER
984   ,x_primary_reservation_quantity   IN     NUMBER
985   ,x_second_reservation_quantity    IN     NUMBER
986   ,x_detailed_quantity              IN     NUMBER
987   ,x_secondary_detailed_quantity    IN     NUMBER
988   ,x_autodetail_group_id            IN     NUMBER
989   ,x_external_source_code           IN     VARCHAR2
990   ,x_external_source_line_id        IN     NUMBER
991   ,x_supply_source_type_id          IN     NUMBER
992   ,x_supply_source_header_id        IN     NUMBER
993   ,x_supply_source_line_id          IN     NUMBER
994   ,x_supply_source_line_detail      IN     NUMBER
995   ,x_supply_source_name             IN     VARCHAR2
996   ,x_revision                       IN     VARCHAR2
997   ,x_subinventory_code              IN     VARCHAR2
998   ,x_subinventory_id                IN     NUMBER
999   ,x_locator_id                     IN     NUMBER
1000   ,x_lot_number                     IN     VARCHAR2
1001   ,x_lot_number_id                  IN     NUMBER
1002   ,x_serial_number                  IN     VARCHAR2
1003   ,x_serial_number_id               IN     NUMBER
1004   ,x_partial_quantities_allowed     IN     NUMBER
1005   ,x_auto_detailed                  IN     NUMBER
1006   ,x_pick_slip_number               IN     NUMBER
1007   ,x_lpn_id                         IN     NUMBER
1008   ,x_last_update_date               IN     DATE
1009   ,x_last_updated_by                IN     NUMBER
1010   ,x_last_update_login              IN     NUMBER
1011   ,x_request_id                     IN     NUMBER
1012   ,x_program_application_id         IN     NUMBER
1013   ,x_program_id                     IN     NUMBER
1014   ,x_program_update_date            IN     DATE
1015   ,x_attribute_category             IN     VARCHAR2
1016   ,x_attribute1                     IN     VARCHAR2
1017   ,x_attribute2                     IN     VARCHAR2
1018   ,x_attribute3                     IN     VARCHAR2
1019   ,x_attribute4                     IN     VARCHAR2
1020   ,x_attribute5                     IN     VARCHAR2
1021   ,x_attribute6                     IN     VARCHAR2
1022   ,x_attribute7                     IN     VARCHAR2
1023   ,x_attribute8                     IN     VARCHAR2
1024   ,x_attribute9                     IN     VARCHAR2
1025   ,x_attribute10                    IN     VARCHAR2
1026   ,x_attribute11                    IN     VARCHAR2
1027   ,x_attribute12                    IN     VARCHAR2
1028   ,x_attribute13                    IN     VARCHAR2
1029   ,x_attribute14                    IN     VARCHAR2
1030   ,x_attribute15                    IN     VARCHAR2
1031   ,x_ship_ready_flag                IN     NUMBER
1032   )IS
1033 BEGIN
1034  UPDATE_ROW (
1035    x_reservation_id                 =>     x_reservation_id
1036   ,x_requirement_date               =>     x_requirement_date
1037   ,x_organization_id                =>     x_organization_id
1038   ,x_inventory_item_id              =>     x_inventory_item_id
1039   ,x_demand_source_type_id          =>     x_demand_source_type_id
1040   ,x_demand_source_name             =>     x_demand_source_name
1041   ,x_demand_source_header_id        =>     x_demand_source_header_id
1042   ,x_demand_source_line_id          =>     x_demand_source_line_id
1043   ,x_demand_source_delivery         =>     x_demand_source_delivery
1044   ,x_primary_uom_code               =>     x_primary_uom_code
1045   ,x_primary_uom_id                 =>     x_primary_uom_id
1046   ,x_secondary_uom_code             =>     x_secondary_uom_code
1047   ,x_secondary_uom_id               =>     x_secondary_uom_id
1048   ,x_reservation_uom_code           =>     x_reservation_uom_code
1049   ,x_reservation_uom_id             =>     x_reservation_uom_id
1050   ,x_reservation_quantity           =>     x_reservation_quantity
1051   ,x_primary_reservation_quantity   =>     x_primary_reservation_quantity
1052   ,x_second_reservation_quantity    =>     x_second_reservation_quantity
1053   ,x_detailed_quantity              =>     x_detailed_quantity
1054   ,x_secondary_detailed_quantity    =>     x_secondary_detailed_quantity
1055   ,x_autodetail_group_id            =>     x_autodetail_group_id
1056   ,x_external_source_code           =>     x_external_source_code
1057   ,x_external_source_line_id        =>     x_external_source_line_id
1058   ,x_supply_source_type_id          =>     x_supply_source_type_id
1059   ,x_supply_source_header_id        =>     x_supply_source_header_id
1060   ,x_supply_source_line_id          =>     x_supply_source_line_id
1061   ,x_supply_source_line_detail      =>     x_supply_source_line_detail
1062   ,x_supply_source_name             =>     x_supply_source_name
1063   ,x_revision                       =>     x_revision
1064   ,x_subinventory_code              =>     x_subinventory_code
1065   ,x_subinventory_id                =>     x_subinventory_id
1066   ,x_locator_id                     =>     x_locator_id
1067   ,x_lot_number                     =>     x_lot_number
1068   ,x_lot_number_id                  =>     x_lot_number_id
1069   ,x_serial_number                  =>     x_serial_number
1070   ,x_serial_number_id               =>     x_serial_number_id
1071   ,x_partial_quantities_allowed     =>     x_partial_quantities_allowed
1072   ,x_auto_detailed                  =>     x_auto_detailed
1073   ,x_pick_slip_number               =>     x_pick_slip_number
1074   ,x_lpn_id                         =>     x_lpn_id
1075   ,x_last_update_date               =>     x_last_update_date
1076   ,x_last_updated_by                =>     x_last_updated_by
1077   ,x_last_update_login              =>     x_last_update_login
1078   ,x_request_id                     =>     x_request_id
1079   ,x_program_application_id         =>     x_program_application_id
1080   ,x_program_id                     =>     x_program_id
1081   ,x_program_update_date            =>     x_program_update_date
1082   ,x_attribute_category             =>     x_attribute_category
1083   ,x_attribute1                     =>     x_attribute1
1084   ,x_attribute2                     =>     x_attribute2
1085   ,x_attribute3                     =>     x_attribute3
1086   ,x_attribute4                     =>     x_attribute4
1087   ,x_attribute5                     =>     x_attribute5
1088   ,x_attribute6                     =>     x_attribute6
1089   ,x_attribute7                     =>     x_attribute7
1090   ,x_attribute8                     =>     x_attribute8
1091   ,x_attribute9                     =>     x_attribute9
1092   ,x_attribute10                    =>     x_attribute10
1093   ,x_attribute11                    =>     x_attribute11
1094   ,x_attribute12                    =>     x_attribute12
1095   ,x_attribute13                    =>     x_attribute13
1096   ,x_attribute14                    =>     x_attribute14
1097   ,x_attribute15                    =>     x_attribute15
1098   ,x_ship_ready_flag                =>     x_ship_ready_flag
1099    ,x_staged_flag                    =>     NULL
1100     /**** {{ R12 Enhanced reservations code changes }}****/
1101    , x_crossdock_flag               => NULL
1102    , x_crossdock_criteria_id        => NULL
1103    , x_demand_source_line_detail    => NULL
1104    , x_serial_reservation_quantity  => NULL
1105    , x_supply_receipt_date          => NULL
1106    , x_demand_ship_date             => NULL
1107    , x_project_id                   => NULL
1108    , x_task_id                      => NULL
1109   /*** End R12 ***/
1110   );
1111 END UPDATE_ROW;
1112 
1113 
1114 PROCEDURE UPDATE_ROW (
1115    x_reservation_id                 IN     NUMBER
1116   ,x_requirement_date               IN     DATE
1117   ,x_organization_id                IN     NUMBER
1118   ,x_inventory_item_id              IN     NUMBER
1119   ,x_demand_source_type_id          IN     NUMBER
1120   ,x_demand_source_name             IN     VARCHAR2
1121   ,x_demand_source_header_id        IN     NUMBER
1122   ,x_demand_source_line_id          IN     NUMBER
1123   ,x_demand_source_delivery         IN     NUMBER
1124   ,x_primary_uom_code               IN     VARCHAR2
1125   ,x_primary_uom_id                 IN     NUMBER
1126   ,x_secondary_uom_code             IN     VARCHAR2
1127   ,x_secondary_uom_id               IN     NUMBER
1128   ,x_reservation_uom_code           IN     VARCHAR2
1129   ,x_reservation_uom_id             IN     NUMBER
1130   ,x_reservation_quantity           IN     NUMBER
1131   ,x_primary_reservation_quantity   IN     NUMBER
1132   ,x_second_reservation_quantity    IN     NUMBER
1133   ,x_detailed_quantity              IN     NUMBER
1134   ,x_secondary_detailed_quantity    IN     NUMBER
1135   ,x_autodetail_group_id            IN     NUMBER
1136   ,x_external_source_code           IN     VARCHAR2
1137   ,x_external_source_line_id        IN     NUMBER
1138   ,x_supply_source_type_id          IN     NUMBER
1139   ,x_supply_source_header_id        IN     NUMBER
1140   ,x_supply_source_line_id          IN     NUMBER
1141   ,x_supply_source_line_detail      IN     NUMBER
1142   ,x_supply_source_name             IN     VARCHAR2
1143   ,x_revision                       IN     VARCHAR2
1144   ,x_subinventory_code              IN     VARCHAR2
1145   ,x_subinventory_id                IN     NUMBER
1146   ,x_locator_id                     IN     NUMBER
1147   ,x_lot_number                     IN     VARCHAR2
1148   ,x_lot_number_id                  IN     NUMBER
1149   ,x_serial_number                  IN     VARCHAR2
1150   ,x_serial_number_id               IN     NUMBER
1151   ,x_partial_quantities_allowed     IN     NUMBER
1152   ,x_auto_detailed                  IN     NUMBER
1153   ,x_pick_slip_number               IN     NUMBER
1154   ,x_lpn_id                         IN     NUMBER
1155   ,x_last_update_date               IN     DATE
1156   ,x_last_updated_by                IN     NUMBER
1157   ,x_last_update_login              IN     NUMBER
1158   ,x_request_id                     IN     NUMBER
1159   ,x_program_application_id         IN     NUMBER
1160   ,x_program_id                     IN     NUMBER
1161   ,x_program_update_date            IN     DATE
1162   ,x_attribute_category             IN     VARCHAR2
1163   ,x_attribute1                     IN     VARCHAR2
1164   ,x_attribute2                     IN     VARCHAR2
1165   ,x_attribute3                     IN     VARCHAR2
1166   ,x_attribute4                     IN     VARCHAR2
1167   ,x_attribute5                     IN     VARCHAR2
1168   ,x_attribute6                     IN     VARCHAR2
1169   ,x_attribute7                     IN     VARCHAR2
1170   ,x_attribute8                     IN     VARCHAR2
1171   ,x_attribute9                     IN     VARCHAR2
1172   ,x_attribute10                    IN     VARCHAR2
1173   ,x_attribute11                    IN     VARCHAR2
1174   ,x_attribute12                    IN     VARCHAR2
1175   ,x_attribute13                    IN     VARCHAR2
1176   ,x_attribute14                    IN     VARCHAR2
1177   ,x_attribute15                    IN     VARCHAR2
1178   ,x_ship_ready_flag                IN     NUMBER
1179   ,x_staged_flag                    IN     VARCHAR2
1180    /**** {{ R12 Enhanced reservations code changes }}****/
1181   , x_crossdock_flag                IN     VARCHAR2
1182   , x_crossdock_criteria_id         IN     NUMBER
1183   , x_demand_source_line_detail     IN     NUMBER
1184   , x_serial_reservation_quantity   IN     NUMBER
1185   , x_supply_receipt_date           IN     DATE
1186   , x_demand_ship_date              IN     DATE
1187   , x_project_id                    IN     NUMBER
1188   , x_task_id                       IN     NUMBER
1189   /*** End R12 ***/
1190   )IS
1191 BEGIN
1192    UPDATE MTL_RESERVATIONS SET
1193        reservation_id = x_reservation_id
1194       ,requirement_date = x_requirement_date
1195       ,organization_id = x_organization_id
1196       ,inventory_item_id = x_inventory_item_id
1197       ,demand_source_type_id = x_demand_source_type_id
1198       ,demand_source_name = x_demand_source_name
1199       ,demand_source_header_id = x_demand_source_header_id
1200       ,demand_source_line_id = x_demand_source_line_id
1201       ,demand_source_delivery = x_demand_source_delivery
1202       ,primary_uom_code = x_primary_uom_code
1203       ,primary_uom_id = x_primary_uom_id
1204       ,secondary_uom_code = x_secondary_uom_code
1205       ,secondary_uom_id = x_secondary_uom_id
1206       ,reservation_uom_code = x_reservation_uom_code
1207       ,reservation_uom_id = x_reservation_uom_id
1208       ,reservation_quantity = x_reservation_quantity
1209       ,primary_reservation_quantity = x_primary_reservation_quantity
1210       ,secondary_reservation_quantity = x_second_reservation_quantity
1211       ,detailed_quantity = x_detailed_quantity
1212       ,secondary_detailed_quantity = x_secondary_detailed_quantity
1213       ,autodetail_group_id = x_autodetail_group_id
1214       ,external_source_code = x_external_source_code
1215       ,external_source_line_id = x_external_source_line_id
1216       ,supply_source_type_id = x_supply_source_type_id
1217       ,supply_source_header_id = x_supply_source_header_id
1218       ,supply_source_line_id = x_supply_source_line_id
1219       ,supply_source_line_detail = x_supply_source_line_detail
1220       ,supply_source_name = x_supply_source_name
1221       ,revision = x_revision
1222       ,subinventory_code = x_subinventory_code
1223       ,subinventory_id = x_subinventory_id
1224       ,locator_id = x_locator_id
1225       ,lot_number = x_lot_number
1226       ,lot_number_id = x_lot_number_id
1227       ,serial_number = x_serial_number
1228       ,serial_number_id = x_serial_number_id
1229       ,partial_quantities_allowed = x_partial_quantities_allowed
1230       ,auto_detailed = x_auto_detailed
1231       ,pick_slip_number = x_pick_slip_number
1232       ,lpn_id = x_lpn_id
1233       ,last_update_date = x_last_update_date
1234       ,last_updated_by = x_last_updated_by
1235       ,last_update_login = x_last_update_login
1236       ,request_id = x_request_id
1237       ,program_application_id = x_program_application_id
1238       ,program_id = x_program_id
1239       ,program_update_date = x_program_update_date
1240       ,attribute_category = x_attribute_category
1241       ,attribute1 = x_attribute1
1242       ,attribute2 = x_attribute2
1243       ,attribute3 = x_attribute3
1244       ,attribute4 = x_attribute4
1245       ,attribute5 = x_attribute5
1246       ,attribute6 = x_attribute6
1247       ,attribute7 = x_attribute7
1248       ,attribute8 = x_attribute8
1249       ,attribute9 = x_attribute9
1250       ,attribute10 = x_attribute10
1251       ,attribute11 = x_attribute11
1252       ,attribute12 = x_attribute12
1253       ,attribute13 = x_attribute13
1254       ,attribute14 = x_attribute14
1255       ,attribute15 = x_attribute15
1256       ,ship_ready_flag = x_ship_ready_flag
1257      ,staged_flag = x_staged_flag
1258       /**** {{ R12 Enhanced reservations code changes }}****/
1259      , crossdock_flag = x_crossdock_flag
1260      , crossdock_criteria_id  = x_crossdock_criteria_id
1261      , demand_source_line_detail = x_demand_source_line_detail
1262      , serial_reservation_quantity = x_serial_reservation_quantity
1263      , supply_receipt_date = x_supply_receipt_date
1264      , demand_ship_date = x_demand_ship_date
1265      , project_id = x_project_id
1266      , task_id = x_task_id
1267      /*** End R12 ***/
1268    WHERE reservation_id = x_reservation_id;
1269 
1270   IF (SQL%NOTFOUND) THEN
1271      RAISE NO_DATA_FOUND;
1272   END IF;
1273 END UPDATE_ROW;
1274 PROCEDURE DELETE_ROW (
1275 		      x_reservation_id    IN     NUMBER
1276 		     ,x_to_reservation_id IN     NUMBER
1277   )IS
1278 BEGIN
1279 
1280    DELETE FROM MTL_RESERVATIONS
1281    WHERE reservation_id = x_reservation_id;
1282 
1283   IF (SQL%NOTFOUND) THEN
1284      RAISE NO_DATA_FOUND;
1285   END IF;
1286 
1287   IF (x_to_reservation_id IS NULL) THEN
1288      -- bug 1809218
1289      -- when deleting a reservation, make sure we delete the pointer
1290      -- to the reservation on the MMTT record.
1291      UPDATE MTL_MATERIAL_TRANSACTIONS_TEMP
1292        SET reservation_id = NULL
1293        WHERE reservation_id = x_reservation_id;
1294    ELSE
1295      UPDATE MTL_MATERIAL_TRANSACTIONS_TEMP
1296        SET reservation_id = x_to_reservation_id
1297        WHERE reservation_id = x_reservation_id;
1298   END IF;
1299 
1300 END DELETE_ROW;
1301 END MTL_RESERVATIONS_PKG;