[Home] [Help]
PACKAGE BODY: APPS.INV_RESERVATION_FORM_PKG
Source
1 PACKAGE body inv_reservation_form_pkg AS
2 /* $Header: INVRSVFB.pls 120.10 2007/03/22 20:05:45 lgao ship $ */
3 g_pkg_name CONSTANT VARCHAR2(30) := 'Inv_Reservation_Form_PKG';
4 --
5 -- INVCONV Overloaded- Incorporate secondaries
6 --R12- Project - SU : Added variables p_Serial_Number_Tbl and p_CrossDock_Flag
7 PROCEDURE create_reservation
8 (
9 p_api_version_number IN NUMBER
10 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_true
11 , x_return_status OUT NOCOPY VARCHAR2
12 , x_msg_count OUT NOCOPY NUMBER
13 , x_msg_data OUT NOCOPY VARCHAR2
14 , p_requirement_date IN DATE
15 , p_organization_id IN NUMBER
16 , p_inventory_item_id IN NUMBER
17 , p_demand_type_id IN NUMBER
18 , p_demand_name IN VARCHAR2
19 , p_demand_header_id IN NUMBER
20 , p_demand_line_id IN NUMBER
21 , p_demand_delivery_id IN NUMBER DEFAULT NULL
22 , p_primary_uom_code IN VARCHAR2
23 , p_primary_uom_id IN NUMBER
24 , p_secondary_uom_code IN VARCHAR2 DEFAULT NULL
25 , p_secondary_uom_id IN NUMBER DEFAULT NULL
26 , p_reservation_uom_code IN VARCHAR2
27 , p_reservation_uom_id IN NUMBER
28 , p_reservation_quantity IN NUMBER
29 , p_primary_rsv_quantity IN NUMBER
30 , p_secondary_rsv_quantity IN NUMBER DEFAULT NULL
31 , p_autodetail_group_id IN NUMBER
32 , p_external_source_code IN VARCHAR2
33 , p_external_source_line IN NUMBER
34 , p_supply_type_id IN NUMBER
35 , p_supply_header_id IN NUMBER
36 , p_supply_line_id IN NUMBER
37 , p_supply_name IN VARCHAR2
38 , p_supply_line_detail IN NUMBER
39 , p_revision IN VARCHAR2
40 , p_subinventory_code IN VARCHAR2
41 , p_subinventory_id IN NUMBER
42 , p_locator_id IN NUMBER
43 , p_lot_number IN VARCHAR2
44 , p_lot_number_id IN NUMBER
45 , p_pick_slip_number IN NUMBER
46 , p_lpn_id IN NUMBER
47 , p_project_id IN NUMBER Default NULL
48 , p_task_id IN NUMBER Default NULL
49 , p_Serial_Number_Tbl In Inv_Reservation_Global.Serial_Number_Tbl_Type
50 , p_ship_ready_flag IN NUMBER
51 , p_CrossDock_Flag In Varchar2 Default null
52 , p_attribute_category IN VARCHAR2 DEFAULT NULL
53 , p_attribute1 IN VARCHAR2 DEFAULT NULL
54 , p_attribute2 IN VARCHAR2 DEFAULT NULL
55 , p_attribute3 IN VARCHAR2 DEFAULT NULL
56 , p_attribute4 IN VARCHAR2 DEFAULT NULL
57 , p_attribute5 IN VARCHAR2 DEFAULT NULL
58 , p_attribute6 IN VARCHAR2 DEFAULT NULL
59 , p_attribute7 IN VARCHAR2 DEFAULT NULL
60 , p_attribute8 IN VARCHAR2 DEFAULT NULL
61 , p_attribute9 IN VARCHAR2 DEFAULT NULL
62 , p_attribute10 IN VARCHAR2 DEFAULT NULL
63 , p_attribute11 IN VARCHAR2 DEFAULT NULL
64 , p_attribute12 IN VARCHAR2 DEFAULT NULL
65 , p_attribute13 IN VARCHAR2 DEFAULT NULL
66 , p_attribute14 IN VARCHAR2 DEFAULT NULL
67 , p_attribute15 IN VARCHAR2 DEFAULT NULL
68 , p_partial_reservation_flag IN VARCHAR2 DEFAULT fnd_api.g_false
69 , p_force_reservation_flag IN VARCHAR2 DEFAULT fnd_api.g_false
70 , p_validation_flag IN VARCHAR2 DEFAULT fnd_api.g_true
71 , x_quantity_reserved OUT NOCOPY NUMBER
72 , x_secondary_quantity_reserved OUT NOCOPY NUMBER
73 , x_reservation_id OUT NOCOPY NUMBER
74 ) IS
75 l_api_version_number CONSTANT NUMBER := 1.0;
76 l_api_name CONSTANT VARCHAR2(30) := 'Create_Reservation';
77 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
78 l_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
79 l_dummy_serial_number inv_reservation_global.serial_number_tbl_type;
80 BEGIN
81 -- Standard call to check for call compatibility
82 IF NOT fnd_api.compatible_api_call(l_api_version_number
83 , p_api_version_number
84 , l_api_name
85 , G_PKG_NAME
86 ) THEN
87 RAISE fnd_api.g_exc_unexpected_error;
88 END IF;
89 -- Initialize message list.
90 IF fnd_api.to_boolean(p_init_msg_lst) THEN
91 fnd_msg_pub.initialize;
92 END IF;
93 -- reservation id is not decided yet
94 l_rsv_rec.reservation_id := NULL;
95 l_rsv_rec.requirement_date := p_requirement_date;
96 l_rsv_rec.organization_id := p_organization_id;
97 l_rsv_rec.inventory_item_id := p_inventory_item_id;
98 l_rsv_rec.demand_source_type_id := p_demand_type_id;
99 l_rsv_rec.demand_source_name := p_demand_name;
100 l_rsv_rec.demand_source_header_id := p_demand_header_id;
101 l_rsv_rec.demand_source_line_id := p_demand_line_id;
102 l_rsv_rec.demand_source_delivery := p_demand_delivery_id;
103 l_rsv_rec.primary_uom_code := p_primary_uom_code;
104 l_rsv_rec.primary_uom_id := p_primary_uom_id;
105 l_rsv_rec.secondary_uom_code := p_secondary_uom_code; -- INVCONV
106 l_rsv_rec.secondary_uom_id := p_secondary_uom_id; -- INVCONV
107 l_rsv_rec.reservation_uom_code := p_reservation_uom_code;
108 l_rsv_rec.reservation_uom_id := p_reservation_uom_id;
109 l_rsv_rec.reservation_quantity := p_reservation_quantity;
110 l_rsv_rec.primary_reservation_quantity := p_primary_rsv_quantity;
111 l_rsv_rec.secondary_reservation_quantity := p_secondary_rsv_quantity; -- INVCONV
112 l_rsv_rec.autodetail_group_id := p_autodetail_group_id;
113 l_rsv_rec.external_source_code := p_external_source_code;
114 l_rsv_rec.external_source_line_id := p_external_source_line;
115 l_rsv_rec.supply_source_type_id := p_supply_type_id;
116 l_rsv_rec.supply_source_header_id := p_supply_header_id;
117 l_rsv_rec.supply_source_line_id := p_supply_line_id;
118 l_rsv_rec.supply_source_name := p_supply_name;
119 l_rsv_rec.supply_source_line_detail := p_supply_line_detail;
120 l_rsv_rec.revision := p_revision;
121 l_rsv_rec.subinventory_code := p_subinventory_code;
122 l_rsv_rec.subinventory_id := p_subinventory_id;
123 l_rsv_rec.locator_id := p_locator_id;
124 l_rsv_rec.lot_number := p_lot_number;
125 l_rsv_rec.lot_number_id := p_lot_number_id;
126 l_rsv_rec.pick_slip_number := p_pick_slip_number;
127 l_rsv_rec.lpn_id := p_lpn_id;
128 l_rsv_rec.ship_ready_flag := p_ship_ready_flag;
129 -- R12 Project : SU -- Populate CrossDock_Flag
130 l_rsv_rec.project_id := p_project_id;
131 l_rsv_rec.task_id := p_task_id;
132 l_Rsv_Rec.CrossDock_Flag := p_CrossDock_Flag ;
133 l_rsv_rec.attribute_category := p_attribute_category;
134 l_rsv_rec.attribute1 := p_attribute1 ;
135 l_rsv_rec.attribute2 := p_attribute2 ;
136 l_rsv_rec.attribute3 := p_attribute3 ;
137 l_rsv_rec.attribute4 := p_attribute4 ;
138 l_rsv_rec.attribute5 := p_attribute5 ;
139 l_rsv_rec.attribute6 := p_attribute6 ;
140 l_rsv_rec.attribute7 := p_attribute7 ;
141 l_rsv_rec.attribute8 := p_attribute8 ;
142 l_rsv_rec.attribute9 := p_attribute9 ;
143 l_rsv_rec.attribute10 := p_attribute10;
144 l_rsv_rec.attribute11 := p_attribute11;
145 l_rsv_rec.attribute12 := p_attribute12;
146 l_rsv_rec.attribute13 := p_attribute13;
147 l_rsv_rec.attribute14 := p_attribute14;
148 l_rsv_rec.attribute15 := p_attribute15;
149
150 inv_reservation_pvt.create_reservation
151 (
152 p_api_version_number => 1.0
153 , p_init_msg_lst => p_init_msg_lst
154 , x_return_status => l_return_status
155 , x_msg_count => x_msg_count
156 , x_msg_data => x_msg_data
157 , p_rsv_rec => l_rsv_rec
158 , p_serial_number => p_Serial_Number_Tbl -- R12 Project SU l_dummy_serial_number
159 , x_serial_number => l_dummy_serial_number
160 , p_partial_reservation_flag => p_partial_reservation_flag
161 , p_force_reservation_flag => p_force_reservation_flag
162 , p_validation_flag => p_validation_flag
163 , x_quantity_reserved => x_quantity_reserved
164 , x_secondary_quantity_reserved => x_secondary_quantity_reserved -- INVCONV
165 , x_reservation_id => x_reservation_id
166 );
167
168 IF l_return_status = fnd_api.g_ret_sts_error THEN
169 RAISE fnd_api.g_exc_error;
170 END IF ;
171
172 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
173 RAISE fnd_api.g_exc_unexpected_error;
174 END IF;
175
176 x_return_status := l_return_status;
177
178 EXCEPTION
179
180 WHEN fnd_api.g_exc_error THEN
181 x_return_status := fnd_api.g_ret_sts_error;
182
183 -- Get message count and data
184 fnd_msg_pub.count_and_get
185 ( p_count => x_msg_count
186 , p_data => x_msg_data
187 , p_encoded => 'F'
188 );
189
190 WHEN fnd_api.g_exc_unexpected_error THEN
191 x_return_status := fnd_api.g_ret_sts_unexp_error ;
192
193 -- Get message count and data
194 fnd_msg_pub.count_and_get
195 ( p_count => x_msg_count
196 , p_data => x_msg_data
197 , p_encoded => 'F'
198 );
199
200 WHEN OTHERS THEN
201 x_return_status := fnd_api.g_ret_sts_unexp_error ;
202
203 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
204 THEN
205 fnd_msg_pub.add_exc_msg
206 ( g_pkg_name
207 , l_api_name
208 );
209 END IF;
210
211 -- Get message count and data
212 fnd_msg_pub.count_and_get
213 ( p_count => x_msg_count
214 , p_data => x_msg_data
215 , p_encoded => 'F'
216 );
217
218 END create_reservation;
219
220 PROCEDURE create_reservation
221 (
222 p_api_version_number IN NUMBER
223 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_true
224 , x_return_status OUT NOCOPY VARCHAR2
225 , x_msg_count OUT NOCOPY NUMBER
226 , x_msg_data OUT NOCOPY VARCHAR2
227 , p_requirement_date IN DATE
228 , p_organization_id IN NUMBER
229 , p_inventory_item_id IN NUMBER
230 , p_demand_type_id IN NUMBER
231 , p_demand_name IN VARCHAR2
232 , p_demand_header_id IN NUMBER
233 , p_demand_line_id IN NUMBER
234 , p_demand_delivery_id IN NUMBER DEFAULT NULL
235 , p_primary_uom_code IN VARCHAR2
236 , p_primary_uom_id IN NUMBER
237 , p_reservation_uom_code IN VARCHAR2
238 , p_reservation_uom_id IN NUMBER
239 , p_reservation_quantity IN NUMBER
240 , p_primary_rsv_quantity IN NUMBER
241 , p_autodetail_group_id IN NUMBER
242 , p_external_source_code IN VARCHAR2
243 , p_external_source_line IN NUMBER
244 , p_supply_type_id IN NUMBER
245 , p_supply_header_id IN NUMBER
246 , p_supply_line_id IN NUMBER
247 , p_supply_name IN VARCHAR2
248 , p_supply_line_detail IN NUMBER
249 , p_revision IN VARCHAR2
250 , p_subinventory_code IN VARCHAR2
251 , p_subinventory_id IN NUMBER
252 , p_locator_id IN NUMBER
253 , p_lot_number IN VARCHAR2
254 , p_lot_number_id IN NUMBER
255 , p_pick_slip_number IN NUMBER
256 , p_lpn_id IN NUMBER
257 , p_ship_ready_flag IN NUMBER
258 , p_attribute_category IN VARCHAR2 DEFAULT NULL
259 , p_attribute1 IN VARCHAR2 DEFAULT NULL
260 , p_attribute2 IN VARCHAR2 DEFAULT NULL
261 , p_attribute3 IN VARCHAR2 DEFAULT NULL
262 , p_attribute4 IN VARCHAR2 DEFAULT NULL
263 , p_attribute5 IN VARCHAR2 DEFAULT NULL
264 , p_attribute6 IN VARCHAR2 DEFAULT NULL
265 , p_attribute7 IN VARCHAR2 DEFAULT NULL
266 , p_attribute8 IN VARCHAR2 DEFAULT NULL
267 , p_attribute9 IN VARCHAR2 DEFAULT NULL
268 , p_attribute10 IN VARCHAR2 DEFAULT NULL
269 , p_attribute11 IN VARCHAR2 DEFAULT NULL
270 , p_attribute12 IN VARCHAR2 DEFAULT NULL
271 , p_attribute13 IN VARCHAR2 DEFAULT NULL
272 , p_attribute14 IN VARCHAR2 DEFAULT NULL
273 , p_attribute15 IN VARCHAR2 DEFAULT NULL
274 , p_partial_reservation_flag IN VARCHAR2 DEFAULT fnd_api.g_false
275 , p_force_reservation_flag IN VARCHAR2 DEFAULT fnd_api.g_false
276 , p_validation_flag IN VARCHAR2 DEFAULT fnd_api.g_true
277 , x_quantity_reserved OUT NOCOPY NUMBER
278 , x_reservation_id OUT NOCOPY NUMBER
279 ) IS
280 l_api_version_number CONSTANT NUMBER := 1.0;
281 l_api_name CONSTANT VARCHAR2(30) := 'Create_Reservation';
282 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
283 l_secondary_quantity_reserved NUMBER;
284 l_Dummy_Serial_Number_Tbl Inv_Reservation_Global.Serial_Number_Tbl_Type ;
285
286 BEGIN
287 -- Standard call to check for call compatibility
288 IF NOT fnd_api.compatible_api_call(l_api_version_number
289 , p_api_version_number
290 , l_api_name
291 , G_PKG_NAME
292 ) THEN
293 RAISE fnd_api.g_exc_unexpected_error;
294 END IF;
295 -- Initialize message list.
296 IF fnd_api.to_boolean(p_init_msg_lst) THEN
297 fnd_msg_pub.initialize;
298 END IF;
299
300 -- Call the over loaded function
301 Create_reservation (
302 p_api_version_number => p_api_version_number
303 , p_init_msg_lst => p_init_msg_lst
304 , x_return_status => l_return_status
305 , x_msg_count => x_msg_count
306 , x_msg_data => x_msg_data
307 , p_requirement_date => p_requirement_date
308 , p_organization_id => p_organization_id
309 , p_inventory_item_id => p_inventory_item_id
310 , p_demand_type_id => p_demand_type_id
311 , p_demand_name => p_demand_name
312 , p_demand_header_id => p_demand_header_id
313 , p_demand_line_id => p_demand_line_id
314 , p_demand_delivery_id => p_demand_delivery_id
315 , p_primary_uom_code => p_primary_uom_code
316 , p_primary_uom_id => p_primary_uom_id
317 , p_reservation_uom_code => p_reservation_uom_code
318 , p_reservation_uom_id => p_reservation_uom_id
319 , p_reservation_quantity => p_reservation_quantity
320 , p_primary_rsv_quantity => p_primary_rsv_quantity
321 , p_autodetail_group_id => p_autodetail_group_id
322 , p_external_source_code => p_external_source_code
323 , p_external_source_line => p_external_source_line
324 , p_supply_type_id => p_supply_type_id
325 , p_supply_header_id => p_supply_header_id
326 , p_supply_line_id => p_supply_line_id
327 , p_supply_name => p_supply_name
328 , p_supply_line_detail => p_supply_line_detail
329 , p_revision => p_revision
330 , p_subinventory_code => p_subinventory_code
331 , p_subinventory_id => p_subinventory_id
332 , p_locator_id => p_locator_id
333 , p_lot_number => p_lot_number
334 , p_lot_number_id => p_lot_number_id
335 , p_pick_slip_number => p_pick_slip_number
336 , p_lpn_id => p_lpn_id
337 , p_project_id => Null
338 , p_task_id => Null
339 , p_Serial_Number_Tbl => l_Dummy_Serial_NUmber_Tbl -- R12 Project : SU
340 , p_ship_ready_flag => p_ship_ready_flag
341 , p_CrossDock_Flag => Null -- R12 Project : SU
342 , p_attribute_category => p_attribute_category
343 , p_attribute1 => p_attribute1
344 , p_attribute2 => p_attribute2
345 , p_attribute3 => p_attribute2
346 , p_attribute4 => p_attribute4
347 , p_attribute5 => p_attribute5
348 , p_attribute6 => p_attribute6
349 , p_attribute7 => p_attribute7
350 , p_attribute8 => p_attribute8
351 , p_attribute9 => p_attribute9
352 , p_attribute10 => p_attribute10
353 , p_attribute11 => p_attribute11
354 , p_attribute12 => p_attribute12
355 , p_attribute13 => p_attribute13
356 , p_attribute14 => p_attribute14
357 , p_attribute15 => p_attribute15
358 , p_partial_reservation_flag => p_partial_reservation_flag
359 , p_force_reservation_flag => p_force_reservation_flag
360 , p_validation_flag => p_validation_flag
361 , x_quantity_reserved => x_quantity_reserved
362 , x_secondary_quantity_reserved => l_secondary_quantity_reserved
363 , x_reservation_id => x_reservation_id
364 );
365
366
367 IF l_return_status = fnd_api.g_ret_sts_error THEN
368 RAISE fnd_api.g_exc_error;
369 END IF ;
370
371 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
372 RAISE fnd_api.g_exc_unexpected_error;
373 END IF;
374
375 x_return_status := l_return_status;
376
377 EXCEPTION
378
379 WHEN fnd_api.g_exc_error THEN
380 x_return_status := fnd_api.g_ret_sts_error;
381
382 -- Get message count and data
383 fnd_msg_pub.count_and_get
384 ( p_count => x_msg_count
385 , p_data => x_msg_data
386 , p_encoded => 'F'
387 );
388
389 WHEN fnd_api.g_exc_unexpected_error THEN
390 x_return_status := fnd_api.g_ret_sts_unexp_error ;
391
392 -- Get message count and data
393 fnd_msg_pub.count_and_get
394 ( p_count => x_msg_count
395 , p_data => x_msg_data
396 , p_encoded => 'F'
397 );
398
399 WHEN OTHERS THEN
400 x_return_status := fnd_api.g_ret_sts_unexp_error ;
401
402 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
403 THEN
404 fnd_msg_pub.add_exc_msg
405 ( g_pkg_name
406 , l_api_name
407 );
408 END IF;
409
410 -- Get message count and data
411 fnd_msg_pub.count_and_get
412 ( p_count => x_msg_count
413 , p_data => x_msg_data
414 , p_encoded => 'F'
415 );
416
417 END create_reservation;
418
419
420 -- Description
421 -- called by the form to update a reservation record
422 -- Note
423 -- 1. Required all values of the original record
424 -- and the update_to record (including null values).
425 -- 2. Can not update organization_id, inventory_item_id, primary_uom_code
426 -- or primary_uom_id.
427 -- INVCONV - Incorporate secondaries
428 PROCEDURE update_reservation
429 (
430 p_api_version_number IN NUMBER
431 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_true
432 , x_return_status OUT NOCOPY VARCHAR2
433 , x_msg_count OUT NOCOPY NUMBER
434 , x_msg_data OUT NOCOPY VARCHAR2
435 , p_from_reservation_id IN NUMBER
436 , p_from_requirement_date IN DATE
437 , p_from_organization_id IN NUMBER
438 , p_from_inventory_item_id IN NUMBER
439 , p_from_demand_type_id IN NUMBER
440 , p_from_demand_name IN VARCHAR2
441 , p_from_demand_header_id IN NUMBER
442 , p_from_demand_line_id IN NUMBER
443 , p_from_demand_delivery_id IN NUMBER DEFAULT NULL
444 , p_from_primary_uom_code IN VARCHAR2
445 , p_from_primary_uom_id IN NUMBER
446 , p_from_secondary_uom_code IN VARCHAR2
447 , p_from_secondary_uom_id IN NUMBER
448 , p_from_reservation_uom_code IN VARCHAR2
449 , p_from_reservation_uom_id IN NUMBER
450 , p_from_reservation_quantity IN NUMBER
451 , p_from_primary_rsv_quantity IN NUMBER
452 , p_from_secondary_rsv_quantity IN NUMBER
453 , p_from_autodetail_group_id IN NUMBER
454 , p_from_external_source_code IN VARCHAR2
455 , p_from_external_source_line IN NUMBER
456 , p_from_supply_type_id IN NUMBER
457 , p_from_supply_header_id IN NUMBER
458 , p_from_supply_line_id IN NUMBER
459 , p_from_supply_name IN VARCHAR2
460 , p_from_supply_line_detail IN NUMBER
461 , p_from_revision IN VARCHAR2
462 , p_from_subinventory_code IN VARCHAR2
463 , p_from_subinventory_id IN NUMBER
464 , p_from_locator_id IN NUMBER
465 , p_from_lot_number IN VARCHAR2
466 , p_from_lot_number_id IN NUMBER
467 , p_from_pick_slip_number IN NUMBER
468 , p_from_lpn_id IN NUMBER
469 , p_from_project_id IN NUMBER Default Null
470 , p_from_task_id IN NUMBER Default Null
471 , p_From_Serial_Number_Tbl In Inv_Reservation_Global.Serial_Number_Tbl_Type
472 , p_from_ship_ready_flag IN NUMBER
473 , p_From_CrossDock_Flag In Varchar2 Default Null
474 , p_from_attribute_category IN VARCHAR2 DEFAULT NULL
475 , p_from_attribute1 IN VARCHAR2 DEFAULT NULL
476 , p_from_attribute2 IN VARCHAR2 DEFAULT NULL
477 , p_from_attribute3 IN VARCHAR2 DEFAULT NULL
478 , p_from_attribute4 IN VARCHAR2 DEFAULT NULL
479 , p_from_attribute5 IN VARCHAR2 DEFAULT NULL
480 , p_from_attribute6 IN VARCHAR2 DEFAULT NULL
481 , p_from_attribute7 IN VARCHAR2 DEFAULT NULL
482 , p_from_attribute8 IN VARCHAR2 DEFAULT NULL
483 , p_from_attribute9 IN VARCHAR2 DEFAULT NULL
484 , p_from_attribute10 IN VARCHAR2 DEFAULT NULL
485 , p_from_attribute11 IN VARCHAR2 DEFAULT NULL
486 , p_from_attribute12 IN VARCHAR2 DEFAULT NULL
487 , p_from_attribute13 IN VARCHAR2 DEFAULT NULL
488 , p_from_attribute14 IN VARCHAR2 DEFAULT NULL
489 , p_from_attribute15 IN VARCHAR2 DEFAULT NULL
490 , p_to_requirement_date IN DATE
491 , p_to_demand_type_id IN NUMBER
492 , p_to_demand_name IN VARCHAR2
493 , p_to_demand_header_id IN NUMBER
494 , p_to_demand_line_id IN NUMBER
495 , p_to_demand_delivery_id IN NUMBER DEFAULT NULL
496 , p_to_reservation_uom_code IN VARCHAR2
497 , p_to_reservation_uom_id IN NUMBER
498 , p_to_reservation_quantity IN NUMBER
499 , p_to_primary_rsv_quantity IN NUMBER
500 , p_to_secondary_rsv_quantity IN NUMBER
501 , p_to_autodetail_group_id IN NUMBER
502 , p_to_external_source_code IN VARCHAR2
503 , p_to_external_source_line IN NUMBER
504 , p_to_supply_type_id IN NUMBER
505 , p_to_supply_header_id IN NUMBER
506 , p_to_supply_line_id IN NUMBER
507 , p_to_supply_name IN VARCHAR2
508 , p_to_supply_line_detail IN NUMBER
509 , p_to_revision IN VARCHAR2
510 , p_to_subinventory_code IN VARCHAR2
511 , p_to_subinventory_id IN NUMBER
512 , p_to_locator_id IN NUMBER
513 , p_to_lot_number IN VARCHAR2
514 , p_to_lot_number_id IN NUMBER
515 , p_to_pick_slip_number IN NUMBER
516 , p_to_lpn_id IN NUMBER
517 , p_to_project_id IN NUMBER Default Null
518 , p_to_task_id IN NUMBER Default Null
519 , p_To_Serial_Number_Tbl In Inv_Reservation_Global.Serial_Number_Tbl_Type
520 , p_to_ship_ready_flag IN NUMBER
521 , p_To_CrossDock_Flag In Varchar2 Default Null
522 , p_to_attribute_category IN VARCHAR2 DEFAULT NULL
523 , p_to_attribute1 IN VARCHAR2 DEFAULT NULL
524 , p_to_attribute2 IN VARCHAR2 DEFAULT NULL
525 , p_to_attribute3 IN VARCHAR2 DEFAULT NULL
526 , p_to_attribute4 IN VARCHAR2 DEFAULT NULL
527 , p_to_attribute5 IN VARCHAR2 DEFAULT NULL
528 , p_to_attribute6 IN VARCHAR2 DEFAULT NULL
529 , p_to_attribute7 IN VARCHAR2 DEFAULT NULL
530 , p_to_attribute8 IN VARCHAR2 DEFAULT NULL
531 , p_to_attribute9 IN VARCHAR2 DEFAULT NULL
532 , p_to_attribute10 IN VARCHAR2 DEFAULT NULL
533 , p_to_attribute11 IN VARCHAR2 DEFAULT NULL
534 , p_to_attribute12 IN VARCHAR2 DEFAULT NULL
535 , p_to_attribute13 IN VARCHAR2 DEFAULT NULL
536 , p_to_attribute14 IN VARCHAR2 DEFAULT NULL
537 , p_to_attribute15 IN VARCHAR2 DEFAULT NULL
538 , p_validation_flag IN VARCHAR2 DEFAULT fnd_api.g_true
539 ) IS
540 l_api_version_number CONSTANT NUMBER := 1.0;
541 l_api_name CONSTANT VARCHAR2(30) := 'Update_Reservation';
542 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
543 l_orig_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
544 l_to_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
545 l_dummy_serial_number inv_reservation_global.serial_number_tbl_type;
546 BEGIN
547
548 -- Standard call to check for call compatibility
549 IF NOT fnd_api.compatible_api_call(l_api_version_number
550 , p_api_version_number
551 , l_api_name
552 , G_PKG_NAME
553 ) THEN
554 RAISE fnd_api.g_exc_unexpected_error;
555 END IF;
556
557 -- Initialize message list.
558 IF fnd_api.to_boolean(p_init_msg_lst) THEN
559 fnd_msg_pub.initialize;
560 END IF;
561
562 -- construct the record type for the original reservation
563 l_orig_rsv_rec.reservation_id := p_from_reservation_id;
564 l_orig_rsv_rec.requirement_date := p_from_requirement_date;
565 l_orig_rsv_rec.organization_id := p_from_organization_id;
566 l_orig_rsv_rec.inventory_item_id := p_from_inventory_item_id;
567 l_orig_rsv_rec.demand_source_type_id := p_from_demand_type_id;
568 l_orig_rsv_rec.demand_source_name := p_from_demand_name;
569 l_orig_rsv_rec.demand_source_header_id := p_from_demand_header_id;
570 l_orig_rsv_rec.demand_source_line_id := p_from_demand_line_id;
571 l_orig_rsv_rec.demand_source_delivery := p_from_demand_delivery_id;
572 l_orig_rsv_rec.primary_uom_code := p_from_primary_uom_code;
573 l_orig_rsv_rec.primary_uom_id := p_from_primary_uom_id;
574 l_orig_rsv_rec.secondary_uom_code := p_from_secondary_uom_code; -- INVCONV
575 l_orig_rsv_rec.secondary_uom_id := p_from_secondary_uom_id; -- INVCONV
576 l_orig_rsv_rec.reservation_uom_code := p_from_reservation_uom_code;
577 l_orig_rsv_rec.reservation_uom_id := p_from_reservation_uom_id;
578 l_orig_rsv_rec.reservation_quantity := p_from_reservation_quantity;
579 l_orig_rsv_rec.primary_reservation_quantity := Nvl(p_from_primary_rsv_quantity,fnd_api.g_miss_num);
580 l_orig_rsv_rec.secondary_reservation_quantity := Nvl(p_from_secondary_rsv_quantity,fnd_api.g_miss_num);
581 l_orig_rsv_rec.autodetail_group_id := p_from_autodetail_group_id;
582 -- Bug 4756403:Setting external source code to g_miss_char
583 l_orig_rsv_rec.external_source_code :=
584 Nvl(p_from_external_source_code, fnd_api.g_miss_char);
585 l_orig_rsv_rec.external_source_line_id := p_from_external_source_line;
586 l_orig_rsv_rec.supply_source_type_id := p_from_supply_type_id;
587 l_orig_rsv_rec.supply_source_header_id := p_from_supply_header_id;
588 l_orig_rsv_rec.supply_source_line_id := p_from_supply_line_id;
589 l_orig_rsv_rec.supply_source_name := p_from_supply_name;
590 l_orig_rsv_rec.supply_source_line_detail := p_from_supply_line_detail;
591 l_orig_rsv_rec.revision := p_from_revision;
592 l_orig_rsv_rec.subinventory_code := p_from_subinventory_code;
593 l_orig_rsv_rec.subinventory_id := p_from_subinventory_id;
594 l_orig_rsv_rec.locator_id := p_from_locator_id;
595 l_orig_rsv_rec.lot_number := p_from_lot_number;
596 l_orig_rsv_rec.lot_number_id := p_from_lot_number_id;
597 l_orig_rsv_rec.pick_slip_number := p_from_pick_slip_number;
598 l_orig_rsv_rec.lpn_id := p_from_lpn_id;
599 l_orig_rsv_rec.project_id := p_from_project_id;
600 l_orig_rsv_rec.task_id := p_from_task_id;
601 l_orig_rsv_rec.ship_ready_flag := p_from_ship_ready_flag;
602 l_orig_rsv_rec.attribute_category := p_from_attribute_category;
603 l_orig_rsv_rec.attribute1 := p_from_attribute1 ;
604 l_orig_rsv_rec.attribute2 := p_from_attribute2 ;
605 l_orig_rsv_rec.attribute3 := p_from_attribute3 ;
606 l_orig_rsv_rec.attribute4 := p_from_attribute4 ;
607 l_orig_rsv_rec.attribute5 := p_from_attribute5 ;
608 l_orig_rsv_rec.attribute6 := p_from_attribute6 ;
609 l_orig_rsv_rec.attribute7 := p_from_attribute7 ;
610 l_orig_rsv_rec.attribute8 := p_from_attribute8 ;
611 l_orig_rsv_rec.attribute9 := p_from_attribute9 ;
612 l_orig_rsv_rec.attribute10 := p_from_attribute10;
613 l_orig_rsv_rec.attribute11 := p_from_attribute11;
614 l_orig_rsv_rec.attribute12 := p_from_attribute12;
615 l_orig_rsv_rec.attribute13 := p_from_attribute13;
616 l_orig_rsv_rec.attribute14 := p_from_attribute14;
617 l_orig_rsv_rec.attribute15 := p_from_attribute15;
618 -- R12 Project : SU
619 l_Orig_Rsv_Rec.CrossDock_Flag := p_From_CrossDock_Flag ;
620
621 -- construct the record type for the update to record
622 l_to_rsv_rec.requirement_date := p_to_requirement_date;
623 l_to_rsv_rec.organization_id := Nvl(p_from_organization_id,fnd_api.g_miss_num);
624 l_to_rsv_rec.inventory_item_id := Nvl(p_from_inventory_item_id,fnd_api.g_miss_num);
625 l_to_rsv_rec.demand_source_type_id := p_to_demand_type_id;
626 l_to_rsv_rec.demand_source_name := p_to_demand_name;
627 l_to_rsv_rec.demand_source_header_id := p_to_demand_header_id;
628 l_to_rsv_rec.demand_source_line_id := p_to_demand_line_id;
629 l_to_rsv_rec.demand_source_delivery := p_to_demand_delivery_id;
630 l_to_rsv_rec.primary_uom_code := p_from_primary_uom_code;
631 l_to_rsv_rec.primary_uom_id := p_from_primary_uom_id;
632 l_to_rsv_rec.secondary_uom_code := p_from_secondary_uom_code; -- INVCONV
633 l_to_rsv_rec.secondary_uom_id := p_from_secondary_uom_id; -- INVCONV
634 l_to_rsv_rec.reservation_uom_code := p_to_reservation_uom_code;
635 l_to_rsv_rec.reservation_uom_id := p_to_reservation_uom_id;
636 l_to_rsv_rec.reservation_quantity := p_to_reservation_quantity;
637 l_to_rsv_rec.primary_reservation_quantity := Nvl(p_to_primary_rsv_quantity,fnd_api.g_miss_num);
638 l_to_rsv_rec.secondary_reservation_quantity := Nvl(p_to_secondary_rsv_quantity,fnd_api.g_miss_num); --INVCONV
639 l_to_rsv_rec.autodetail_group_id := p_to_autodetail_group_id;
640
641 -- Bug 4756403:Setting external source code to g_miss_char
642 l_to_rsv_rec.external_source_code := Nvl(p_from_external_source_code, fnd_api.g_miss_char);
643 l_to_rsv_rec.external_source_line_id := p_to_external_source_line;
644 l_to_rsv_rec.supply_source_type_id := p_to_supply_type_id;
645 l_to_rsv_rec.supply_source_header_id := p_to_supply_header_id;
646 l_to_rsv_rec.supply_source_line_id := p_to_supply_line_id;
647 l_to_rsv_rec.supply_source_name := p_to_supply_name;
648 l_to_rsv_rec.supply_source_line_detail := p_to_supply_line_detail;
649 l_to_rsv_rec.revision := p_to_revision;
650 l_to_rsv_rec.subinventory_code := p_to_subinventory_code;
651 l_to_rsv_rec.subinventory_id := p_to_subinventory_id;
652 l_to_rsv_rec.locator_id := p_to_locator_id;
653 l_to_rsv_rec.lot_number := p_to_lot_number;
654 l_to_rsv_rec.lot_number_id := p_to_lot_number_id;
655 l_to_rsv_rec.pick_slip_number := p_to_pick_slip_number;
656 l_to_rsv_rec.lpn_id := p_to_lpn_id;
657 l_to_rsv_rec.project_id := p_to_project_id;
658 l_to_rsv_rec.task_id := p_to_task_id;
659 -- kkoothan
660 l_to_rsv_rec.ship_ready_flag := p_to_ship_ready_flag;
661 l_to_rsv_rec.attribute_category := p_to_attribute_category;
662 l_to_rsv_rec.attribute1 := p_to_attribute1 ;
663 l_to_rsv_rec.attribute2 := p_to_attribute2 ;
664 l_to_rsv_rec.attribute3 := p_to_attribute3 ;
665 l_to_rsv_rec.attribute4 := p_to_attribute4 ;
666 l_to_rsv_rec.attribute5 := p_to_attribute5 ;
667 l_to_rsv_rec.attribute6 := p_to_attribute6 ;
668 l_to_rsv_rec.attribute7 := p_to_attribute7 ;
669 l_to_rsv_rec.attribute8 := p_to_attribute8 ;
670 l_to_rsv_rec.attribute9 := p_to_attribute9 ;
671 l_to_rsv_rec.attribute10 := p_to_attribute10;
672 l_to_rsv_rec.attribute11 := p_to_attribute11;
673 l_to_rsv_rec.attribute12 := p_to_attribute12;
674 l_to_rsv_rec.attribute13 := p_to_attribute13;
675 l_to_rsv_rec.attribute14 := p_to_attribute14;
676 l_to_rsv_rec.attribute15 := p_to_attribute15;
677 -- R12 Project : SU
678 l_To_Rsv_Rec.CrossDock_Flag := p_To_CrossDock_Flag ;
679
680 inv_reservation_pvt.update_reservation
681 (
682 p_api_version_number => 1.0
683 , p_init_msg_lst => p_init_msg_lst
684 , x_return_status => l_return_status
685 , x_msg_count => x_msg_count
686 , x_msg_data => x_msg_data
687 , p_original_rsv_rec => l_orig_rsv_rec
688 , p_to_rsv_rec => l_to_rsv_rec
689 , p_original_serial_number => p_from_serial_number_Tbl -- R12 Changes: SU
690 , p_to_serial_number => p_To_serial_number_tbl -- R12 Changes : SU
691 , p_validation_flag => p_validation_flag
692 );
693
694 IF l_return_status = fnd_api.g_ret_sts_error THEN
695 RAISE fnd_api.g_exc_error;
696 END IF ;
697
698 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
699 RAISE fnd_api.g_exc_unexpected_error;
700 END IF;
701
702 x_return_status := l_return_status;
703
704 EXCEPTION
705
706 WHEN fnd_api.g_exc_error THEN
707 x_return_status := fnd_api.g_ret_sts_error;
708
709 -- Get message count and data
710 fnd_msg_pub.count_and_get
711 ( p_count => x_msg_count
712 , p_data => x_msg_data
713 , p_encoded => 'F'
714 );
715
716 WHEN fnd_api.g_exc_unexpected_error THEN
717 x_return_status := fnd_api.g_ret_sts_unexp_error ;
718
719 -- Get message count and data
720 fnd_msg_pub.count_and_get
721 ( p_count => x_msg_count
722 , p_data => x_msg_data
723 , p_encoded => 'F'
724 );
725
726 WHEN OTHERS THEN
727 x_return_status := fnd_api.g_ret_sts_unexp_error ;
728
729 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
730 THEN
731 fnd_msg_pub.add_exc_msg
732 ( g_pkg_name
733 , l_api_name
734 );
735 END IF;
736
737 -- Get message count and data
738 fnd_msg_pub.count_and_get
739 ( p_count => x_msg_count
740 , p_data => x_msg_data
741 , p_encoded => 'F'
742 );
743
744 END update_reservation;
745
746 -- INVCONV - Incorporate secondaries
747 PROCEDURE delete_reservation
748 (
749 p_api_version_number IN NUMBER
750 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_true
751 , x_return_status OUT NOCOPY VARCHAR2
752 , x_msg_count OUT NOCOPY NUMBER
753 , x_msg_data OUT NOCOPY VARCHAR2
754 , p_reservation_id IN NUMBER
755 , p_requirement_date IN DATE
756 , p_organization_id IN NUMBER
757 , p_inventory_item_id IN NUMBER
758 , p_demand_type_id IN NUMBER
759 , p_demand_name IN VARCHAR2
760 , p_demand_header_id IN NUMBER
761 , p_demand_line_id IN NUMBER
762 , p_demand_delivery_id IN NUMBER DEFAULT NULL
763 , p_primary_uom_code IN VARCHAR2
764 , p_primary_uom_id IN NUMBER
765 , p_secondary_uom_code IN VARCHAR2
766 , p_secondary_uom_id IN NUMBER
767 , p_reservation_uom_code IN VARCHAR2
768 , p_reservation_uom_id IN NUMBER
769 , p_reservation_quantity IN NUMBER
770 , p_primary_rsv_quantity IN NUMBER
771 , p_secondary_rsv_quantity IN NUMBER
772 , p_autodetail_group_id IN NUMBER
773 , p_external_source_code IN VARCHAR2
774 , p_external_source_line IN NUMBER
775 , p_supply_type_id IN NUMBER
776 , p_supply_header_id IN NUMBER
777 , p_supply_line_id IN NUMBER
778 , p_supply_name IN VARCHAR2
779 , p_supply_line_detail IN NUMBER
780 , p_revision IN VARCHAR2
781 , p_subinventory_code IN VARCHAR2
782 , p_subinventory_id IN NUMBER
783 , p_locator_id IN NUMBER
784 , p_lot_number IN VARCHAR2
785 , p_lot_number_id IN NUMBER
786 , p_pick_slip_number IN NUMBER
787 , p_lpn_id IN NUMBER
788 , p_Serial_Number_Tbl In Inv_Reservation_Global.Serial_Number_Tbl_Type
789 , p_ship_ready_flag IN NUMBER
790 , p_CrossDock_Flag In Varchar2 Default Null
791 , p_attribute_category IN VARCHAR2 DEFAULT NULL
792 , p_attribute1 IN VARCHAR2 DEFAULT NULL
793 , p_attribute2 IN VARCHAR2 DEFAULT NULL
794 , p_attribute3 IN VARCHAR2 DEFAULT NULL
795 , p_attribute4 IN VARCHAR2 DEFAULT NULL
796 , p_attribute5 IN VARCHAR2 DEFAULT NULL
797 , p_attribute6 IN VARCHAR2 DEFAULT NULL
798 , p_attribute7 IN VARCHAR2 DEFAULT NULL
799 , p_attribute8 IN VARCHAR2 DEFAULT NULL
800 , p_attribute9 IN VARCHAR2 DEFAULT NULL
801 , p_attribute10 IN VARCHAR2 DEFAULT NULL
802 , p_attribute11 IN VARCHAR2 DEFAULT NULL
803 , p_attribute12 IN VARCHAR2 DEFAULT NULL
804 , p_attribute13 IN VARCHAR2 DEFAULT NULL
805 , p_attribute14 IN VARCHAR2 DEFAULT NULL
806 , p_attribute15 IN VARCHAR2 DEFAULT NULL
807 , p_validation_flag IN VARCHAR2 DEFAULT 'T' --Bug 2354735
808 ) IS
809 l_api_version_number CONSTANT NUMBER := 1.0;
810 l_api_name CONSTANT VARCHAR2(30) := 'Delete_Reservation';
811 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
812 l_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
813 l_dummy_serial_number inv_reservation_global.serial_number_tbl_type;
814 BEGIN
815 -- Standard call to check for call compatibility
816 IF NOT fnd_api.compatible_api_call(l_api_version_number
817 , p_api_version_number
818 , l_api_name
819 , G_PKG_NAME
820 ) THEN
821 RAISE fnd_api.g_exc_unexpected_error;
822 END IF;
823
824 -- Initialize message list.
825 IF fnd_api.to_boolean(p_init_msg_lst) THEN
826 fnd_msg_pub.initialize;
827 END IF;
828
829 l_rsv_rec.reservation_id := p_reservation_id;
830 l_rsv_rec.requirement_date := p_requirement_date;
831 l_rsv_rec.organization_id := p_organization_id;
832 l_rsv_rec.inventory_item_id := p_inventory_item_id;
833 l_rsv_rec.demand_source_type_id := p_demand_type_id;
834 l_rsv_rec.demand_source_name := p_demand_name;
835 l_rsv_rec.demand_source_header_id := p_demand_header_id;
836 l_rsv_rec.demand_source_line_id := p_demand_line_id;
837 l_rsv_rec.demand_source_delivery := p_demand_delivery_id;
838 l_rsv_rec.primary_uom_code := p_primary_uom_code;
839 l_rsv_rec.primary_uom_id := p_primary_uom_id;
840 l_rsv_rec.secondary_uom_code := p_secondary_uom_code; -- INVCONV
841 l_rsv_rec.secondary_uom_id := p_secondary_uom_id; -- INVCONV
842 l_rsv_rec.reservation_uom_code := p_reservation_uom_code;
843 l_rsv_rec.reservation_uom_id := p_reservation_uom_id;
844 l_rsv_rec.reservation_quantity := p_reservation_quantity;
845 l_rsv_rec.primary_reservation_quantity := p_primary_rsv_quantity;
846 l_rsv_rec.secondary_reservation_quantity := p_secondary_rsv_quantity;-- INVCONV
847 l_rsv_rec.autodetail_group_id := p_autodetail_group_id;
848 l_rsv_rec.external_source_code := p_external_source_code;
849 l_rsv_rec.external_source_line_id := p_external_source_line;
850 l_rsv_rec.supply_source_type_id := p_supply_type_id;
851 l_rsv_rec.supply_source_header_id := p_supply_header_id;
852 l_rsv_rec.supply_source_line_id := p_supply_line_id;
853 l_rsv_rec.supply_source_name := p_supply_name;
854 l_rsv_rec.supply_source_line_detail := p_supply_line_detail;
855 l_rsv_rec.revision := p_revision;
856 l_rsv_rec.subinventory_code := p_subinventory_code;
857 l_rsv_rec.subinventory_id := p_subinventory_id;
858 l_rsv_rec.locator_id := p_locator_id;
859 l_rsv_rec.lot_number := p_lot_number;
860 l_rsv_rec.lot_number_id := p_lot_number_id;
861 l_rsv_rec.pick_slip_number := p_pick_slip_number;
862 l_rsv_rec.lpn_id := p_lpn_id;
863 l_rsv_rec.ship_ready_flag := p_ship_ready_flag;
864 l_Rsv_Rec.CrossDock_Flag := p_CrossDock_Flag; -- R12 Changes : SU
865 l_rsv_rec.attribute_category := p_attribute_category;
866 l_rsv_rec.attribute1 := p_attribute1 ;
867 l_rsv_rec.attribute2 := p_attribute2 ;
868 l_rsv_rec.attribute3 := p_attribute3 ;
869 l_rsv_rec.attribute4 := p_attribute4 ;
870 l_rsv_rec.attribute5 := p_attribute5 ;
871 l_rsv_rec.attribute6 := p_attribute6 ;
872 l_rsv_rec.attribute7 := p_attribute7 ;
873 l_rsv_rec.attribute8 := p_attribute8 ;
874 l_rsv_rec.attribute9 := p_attribute9 ;
875 l_rsv_rec.attribute10 := p_attribute10;
876 l_rsv_rec.attribute11 := p_attribute11;
877 l_rsv_rec.attribute12 := p_attribute12;
878 l_rsv_rec.attribute13 := p_attribute13;
879 l_rsv_rec.attribute14 := p_attribute14;
880 l_rsv_rec.attribute15 := p_attribute15;
881
882 inv_reservation_pvt.delete_reservation
883 (
884 p_api_version_number => 1.0
885 , p_init_msg_lst => p_init_msg_lst
886 , x_return_status => l_return_status
887 , x_msg_count => x_msg_count
888 , x_msg_data => x_msg_data
889 , p_rsv_rec => l_rsv_rec
890 , p_original_serial_number => p_serial_number_Tbl -- R12 Changes : SU
891 , p_validation_flag => p_validation_flag -- Bug 2354735
892 );
893
894 IF l_return_status = fnd_api.g_ret_sts_error THEN
895 RAISE fnd_api.g_exc_error;
896 END IF ;
897
898 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
899 RAISE fnd_api.g_exc_unexpected_error;
900 END IF;
901
902 x_return_status := l_return_status;
903
904 EXCEPTION
905
906 WHEN fnd_api.g_exc_error THEN
907 x_return_status := fnd_api.g_ret_sts_error;
908
909 -- Get message count and data
910 fnd_msg_pub.count_and_get
911 ( p_count => x_msg_count
912 , p_data => x_msg_data
913 , p_encoded => 'F'
914 );
915
916 WHEN fnd_api.g_exc_unexpected_error THEN
917 x_return_status := fnd_api.g_ret_sts_unexp_error ;
918
919 -- Get message count and data
920 fnd_msg_pub.count_and_get
921 ( p_count => x_msg_count
922 , p_data => x_msg_data
923 , p_encoded => 'F'
924 );
925
926 WHEN OTHERS THEN
927 x_return_status := fnd_api.g_ret_sts_unexp_error ;
928
929 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
930 THEN
931 fnd_msg_pub.add_exc_msg
932 ( g_pkg_name
933 , l_api_name
934 );
935 END IF;
936
937 -- Get message count and data
938 fnd_msg_pub.count_and_get
939 ( p_count => x_msg_count
940 , p_data => x_msg_data
941 , p_encoded => 'F'
942 );
943
944 END delete_reservation;
945
946 -- INVCONV - Incorporate secondaries
947 PROCEDURE transfer_supply
948 (
949 p_api_version_number IN NUMBER
950 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_true
951 , x_return_status OUT NOCOPY VARCHAR2
952 , x_msg_count OUT NOCOPY NUMBER
953 , x_msg_data OUT NOCOPY VARCHAR2
954 , p_from_reservation_id IN NUMBER
955 , p_from_requirement_date IN DATE
956 , p_from_organization_id IN NUMBER
957 , p_from_inventory_item_id IN NUMBER
958 , p_from_demand_type_id IN NUMBER
959 , p_from_demand_name IN VARCHAR2
960 , p_from_demand_header_id IN NUMBER
961 , p_from_demand_line_id IN NUMBER
962 , p_from_demand_delivery_id IN NUMBER DEFAULT NULL
963 , p_from_primary_uom_code IN VARCHAR2
964 , p_from_primary_uom_id IN NUMBER
965 , p_from_secondary_uom_code IN VARCHAR2
966 , p_from_secondary_uom_id IN NUMBER
967 , p_from_reservation_uom_code IN VARCHAR2
968 , p_from_reservation_uom_id IN NUMBER
969 , p_from_reservation_quantity IN NUMBER
970 , p_from_primary_rsv_quantity IN NUMBER
971 , p_from_secondary_rsv_quantity IN NUMBER
972 , p_from_autodetail_group_id IN NUMBER
973 , p_from_external_source_code IN VARCHAR2
974 , p_from_external_source_line IN NUMBER
975 , p_from_supply_type_id IN NUMBER
976 , p_from_supply_header_id IN NUMBER
977 , p_from_supply_line_id IN NUMBER
978 , p_from_supply_name IN VARCHAR2
979 , p_from_supply_line_detail IN NUMBER
980 , p_from_revision IN VARCHAR2
981 , p_from_subinventory_code IN VARCHAR2
982 , p_from_subinventory_id IN NUMBER
983 , p_from_locator_id IN NUMBER
984 , p_from_lot_number IN VARCHAR2
985 , p_from_lot_number_id IN NUMBER
986 , p_from_pick_slip_number IN NUMBER
987 , p_from_lpn_id IN NUMBER
988 , p_from_ship_ready_flag IN NUMBER
989 , p_from_attribute_category IN VARCHAR2 DEFAULT NULL
990 , p_from_attribute1 IN VARCHAR2 DEFAULT NULL
991 , p_from_attribute2 IN VARCHAR2 DEFAULT NULL
992 , p_from_attribute3 IN VARCHAR2 DEFAULT NULL
993 , p_from_attribute4 IN VARCHAR2 DEFAULT NULL
994 , p_from_attribute5 IN VARCHAR2 DEFAULT NULL
995 , p_from_attribute6 IN VARCHAR2 DEFAULT NULL
996 , p_from_attribute7 IN VARCHAR2 DEFAULT NULL
997 , p_from_attribute8 IN VARCHAR2 DEFAULT NULL
998 , p_from_attribute9 IN VARCHAR2 DEFAULT NULL
999 , p_from_attribute10 IN VARCHAR2 DEFAULT NULL
1000 , p_from_attribute11 IN VARCHAR2 DEFAULT NULL
1001 , p_from_attribute12 IN VARCHAR2 DEFAULT NULL
1002 , p_from_attribute13 IN VARCHAR2 DEFAULT NULL
1003 , p_from_attribute14 IN VARCHAR2 DEFAULT NULL
1004 , p_from_attribute15 IN VARCHAR2 DEFAULT NULL
1005 , p_to_reservation_uom_code IN VARCHAR2
1006 , p_to_secondary_uom_code IN VARCHAR2
1007 , p_to_reservation_quantity IN NUMBER
1008 , p_to_secondary_rsv_quantity IN NUMBER
1009 , p_to_supply_type_id IN NUMBER
1010 , p_to_supply_header_id IN NUMBER
1011 , p_to_supply_line_id IN NUMBER
1012 , p_to_supply_name IN VARCHAR2
1013 , p_to_supply_line_detail IN NUMBER
1014 , p_to_revision IN VARCHAR2
1015 , p_to_subinventory_code IN VARCHAR2
1016 , p_to_subinventory_id IN NUMBER
1017 , p_to_locator_id IN NUMBER
1018 , p_to_lot_number IN VARCHAR2
1019 , p_to_lot_number_id IN NUMBER
1020 , p_to_pick_slip_number IN NUMBER
1021 , p_to_lpn_id IN NUMBER
1022 , p_validation_flag IN VARCHAR2 DEFAULT fnd_api.g_true
1023 , x_to_reservation_id OUT NOCOPY NUMBER
1024 ) IS
1025 l_api_version_number CONSTANT NUMBER := 1.0;
1026 l_api_name CONSTANT VARCHAR2(30) := 'Transfer_Supply';
1027 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
1028 l_orig_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
1029 l_to_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
1030 l_dummy_serial_number inv_reservation_global.serial_number_tbl_type;
1031 BEGIN
1032
1033 -- Standard call to check for call compatibility
1034 IF NOT fnd_api.compatible_api_call(l_api_version_number
1035 , p_api_version_number
1036 , l_api_name
1037 , G_PKG_NAME
1038 ) THEN
1039 RAISE fnd_api.g_exc_unexpected_error;
1040 END IF;
1041
1042 -- Initialize message list.
1043 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1044 fnd_msg_pub.initialize;
1045 END IF;
1046
1047 -- construct the record type for the original reservation
1048 IF p_from_reservation_id IS NOT NULL
1049 AND p_from_reservation_id <> fnd_api.g_miss_num
1050 THEN
1051 l_orig_rsv_rec.reservation_id := p_from_reservation_id;
1052 ELSE
1053 l_orig_rsv_rec.requirement_date := p_from_requirement_date;
1054 l_orig_rsv_rec.organization_id := p_from_organization_id;
1055 l_orig_rsv_rec.inventory_item_id := p_from_inventory_item_id;
1056 l_orig_rsv_rec.demand_source_type_id := p_from_demand_type_id;
1057 l_orig_rsv_rec.demand_source_name := p_from_demand_name;
1058 l_orig_rsv_rec.demand_source_header_id := p_from_demand_header_id;
1059 l_orig_rsv_rec.demand_source_line_id := p_from_demand_line_id;
1060 l_orig_rsv_rec.demand_source_delivery := p_from_demand_delivery_id;
1061 l_orig_rsv_rec.primary_uom_code := p_from_primary_uom_code;
1062 l_orig_rsv_rec.primary_uom_id := p_from_primary_uom_id;
1063 l_orig_rsv_rec.secondary_uom_code := p_from_secondary_uom_code; -- INVCONV
1064 l_orig_rsv_rec.secondary_uom_id := p_from_secondary_uom_id; -- INVCONV
1065 l_orig_rsv_rec.reservation_uom_code := p_from_reservation_uom_code;
1066 l_orig_rsv_rec.reservation_uom_id := p_from_reservation_uom_id;
1067 l_orig_rsv_rec.reservation_quantity := p_from_reservation_quantity;
1068 l_orig_rsv_rec.primary_reservation_quantity := p_from_primary_rsv_quantity;
1069 l_orig_rsv_rec.secondary_reservation_quantity := p_from_secondary_rsv_quantity; -- INVCONV
1070 l_orig_rsv_rec.autodetail_group_id := p_from_autodetail_group_id;
1071 l_orig_rsv_rec.external_source_code := p_from_external_source_code;
1072 l_orig_rsv_rec.external_source_line_id := p_from_external_source_line;
1073 l_orig_rsv_rec.supply_source_type_id := p_from_supply_type_id;
1074 l_orig_rsv_rec.supply_source_header_id := p_from_supply_header_id;
1075 l_orig_rsv_rec.supply_source_line_id := p_from_supply_line_id;
1076 l_orig_rsv_rec.supply_source_name := p_from_supply_name;
1077 l_orig_rsv_rec.supply_source_line_detail := p_from_supply_line_detail;
1078 l_orig_rsv_rec.revision := p_from_revision;
1079 l_orig_rsv_rec.subinventory_code := p_from_subinventory_code;
1080 l_orig_rsv_rec.subinventory_id := p_from_subinventory_id;
1081 l_orig_rsv_rec.locator_id := p_from_locator_id;
1082 l_orig_rsv_rec.lot_number := p_from_lot_number;
1083 l_orig_rsv_rec.lot_number_id := p_from_lot_number_id;
1084 l_orig_rsv_rec.pick_slip_number := p_from_pick_slip_number;
1085 l_orig_rsv_rec.lpn_id := p_from_lpn_id;
1086 l_orig_rsv_rec.ship_ready_flag := p_from_ship_ready_flag;
1087 l_orig_rsv_rec.attribute_category := p_from_attribute_category;
1088 l_orig_rsv_rec.attribute1 := p_from_attribute1 ;
1089 l_orig_rsv_rec.attribute2 := p_from_attribute2 ;
1090 l_orig_rsv_rec.attribute3 := p_from_attribute3 ;
1091 l_orig_rsv_rec.attribute4 := p_from_attribute4 ;
1092 l_orig_rsv_rec.attribute5 := p_from_attribute5 ;
1093 l_orig_rsv_rec.attribute6 := p_from_attribute6 ;
1094 l_orig_rsv_rec.attribute7 := p_from_attribute7 ;
1095 l_orig_rsv_rec.attribute8 := p_from_attribute8 ;
1096 l_orig_rsv_rec.attribute9 := p_from_attribute9 ;
1097 l_orig_rsv_rec.attribute10 := p_from_attribute10;
1098 l_orig_rsv_rec.attribute11 := p_from_attribute11;
1099 l_orig_rsv_rec.attribute12 := p_from_attribute12;
1100 l_orig_rsv_rec.attribute13 := p_from_attribute13;
1101 l_orig_rsv_rec.attribute14 := p_from_attribute14;
1102 l_orig_rsv_rec.attribute15 := p_from_attribute15;
1103 END IF;
1104
1105 -- construct the record type for the transfer to record
1106 l_to_rsv_rec.reservation_uom_code := p_to_reservation_uom_code;
1107 l_to_rsv_rec.reservation_quantity := p_to_reservation_quantity;
1108 l_to_rsv_rec.secondary_uom_code := p_to_secondary_uom_code; -- INVCONV
1109 l_to_rsv_rec.reservation_quantity := p_to_reservation_quantity;
1110 l_to_rsv_rec.secondary_reservation_quantity := p_to_secondary_rsv_quantity; -- INVCONV
1111 l_to_rsv_rec.supply_source_type_id := p_to_supply_type_id;
1112 l_to_rsv_rec.supply_source_header_id := p_to_supply_header_id;
1113 l_to_rsv_rec.supply_source_line_id := p_to_supply_line_id;
1114 l_to_rsv_rec.supply_source_name := p_to_supply_name;
1115 l_to_rsv_rec.supply_source_line_detail := p_to_supply_line_detail;
1116 l_to_rsv_rec.revision := p_to_revision;
1117 l_to_rsv_rec.subinventory_code := p_to_subinventory_code;
1118 l_to_rsv_rec.subinventory_id := p_to_subinventory_id;
1119 l_to_rsv_rec.locator_id := p_to_locator_id;
1120 l_to_rsv_rec.lot_number := p_to_lot_number;
1121 l_to_rsv_rec.lot_number_id := p_to_lot_number_id;
1122 l_to_rsv_rec.pick_slip_number := p_to_pick_slip_number;
1123 l_to_rsv_rec.lpn_id := p_to_lpn_id;
1124
1125 inv_reservation_pvt.transfer_reservation
1126 (
1127 p_api_version_number => 1.0
1128 , p_init_msg_lst => p_init_msg_lst
1129 , x_return_status => l_return_status
1130 , x_msg_count => x_msg_count
1131 , x_msg_data => x_msg_data
1132 , p_original_rsv_rec => l_orig_rsv_rec
1133 , p_to_rsv_rec => l_to_rsv_rec
1134 , p_original_serial_number => l_dummy_serial_number
1135 , p_validation_flag => p_validation_flag
1136 , x_reservation_id => x_to_reservation_id
1137 );
1138
1139 IF l_return_status = fnd_api.g_ret_sts_error THEN
1140 RAISE fnd_api.g_exc_error;
1141 END IF ;
1142
1143 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1144 RAISE fnd_api.g_exc_unexpected_error;
1145 END IF;
1146
1147 x_return_status := l_return_status;
1148
1149 EXCEPTION
1150
1151 WHEN fnd_api.g_exc_error THEN
1152 x_return_status := fnd_api.g_ret_sts_error;
1153
1154 -- Get message count and data
1155 fnd_msg_pub.count_and_get
1156 ( p_count => x_msg_count
1157 , p_data => x_msg_data
1158 , p_encoded => 'F'
1159 );
1160
1161 WHEN fnd_api.g_exc_unexpected_error THEN
1162 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1163
1164 -- Get message count and data
1165 fnd_msg_pub.count_and_get
1166 ( p_count => x_msg_count
1167 , p_data => x_msg_data
1168 , p_encoded => 'F'
1169 );
1170
1171 WHEN OTHERS THEN
1172 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1173
1174 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1175 THEN
1176 fnd_msg_pub.add_exc_msg
1177 ( g_pkg_name
1178 , l_api_name
1179 );
1180 END IF;
1181
1182 -- Get message count and data
1183 fnd_msg_pub.count_and_get
1184 ( p_count => x_msg_count
1185 , p_data => x_msg_data
1186 , p_encoded => 'F'
1187 );
1188
1189 END transfer_supply;
1190
1191 -- INVCONV - Incorporate secondaries
1192 PROCEDURE transfer_demand
1193 (
1194 p_api_version_number IN NUMBER
1195 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_true
1196 , x_return_status OUT NOCOPY VARCHAR2
1197 , x_msg_count OUT NOCOPY NUMBER
1198 , x_msg_data OUT NOCOPY VARCHAR2
1199 , p_from_reservation_id IN NUMBER
1200 , p_from_requirement_date IN DATE
1201 , p_from_organization_id IN NUMBER
1202 , p_from_inventory_item_id IN NUMBER
1203 , p_from_demand_type_id IN NUMBER
1204 , p_from_demand_name IN VARCHAR2
1205 , p_from_demand_header_id IN NUMBER
1206 , p_from_demand_line_id IN NUMBER
1207 , p_from_demand_delivery_id IN NUMBER DEFAULT NULL
1208 , p_from_primary_uom_code IN VARCHAR2
1209 , p_from_primary_uom_id IN NUMBER
1210 , p_from_secondary_uom_code IN VARCHAR2 -- INVCONV
1211 , p_from_secondary_uom_id IN NUMBER -- INVCONV
1212 , p_from_reservation_uom_code IN VARCHAR2
1213 , p_from_reservation_uom_id IN NUMBER
1214 , p_from_reservation_quantity IN NUMBER
1215 , p_from_primary_rsv_quantity IN NUMBER
1216 , p_from_secondary_rsv_quantity IN NUMBER -- INVCONV
1217 , p_from_autodetail_group_id IN NUMBER
1218 , p_from_external_source_code IN VARCHAR2
1219 , p_from_external_source_line IN NUMBER
1220 , p_from_supply_type_id IN NUMBER
1221 , p_from_supply_header_id IN NUMBER
1222 , p_from_supply_line_id IN NUMBER
1223 , p_from_supply_name IN VARCHAR2
1224 , p_from_supply_line_detail IN NUMBER
1225 , p_from_revision IN VARCHAR2
1226 , p_from_subinventory_code IN VARCHAR2
1227 , p_from_subinventory_id IN NUMBER
1228 , p_from_locator_id IN NUMBER
1229 , p_from_lot_number IN VARCHAR2
1230 , p_from_lot_number_id IN NUMBER
1231 , p_from_pick_slip_number IN NUMBER
1232 , p_from_lpn_id IN NUMBER
1233 , p_from_project_id IN NUMBER Default Null
1234 , p_from_task_id IN NUMBER Default Null
1235 , p_from_ship_ready_flag IN NUMBER
1236 , p_from_attribute_category IN VARCHAR2 DEFAULT NULL
1237 , p_from_attribute1 IN VARCHAR2 DEFAULT NULL
1238 , p_from_attribute2 IN VARCHAR2 DEFAULT NULL
1239 , p_from_attribute3 IN VARCHAR2 DEFAULT NULL
1240 , p_from_attribute4 IN VARCHAR2 DEFAULT NULL
1241 , p_from_attribute5 IN VARCHAR2 DEFAULT NULL
1242 , p_from_attribute6 IN VARCHAR2 DEFAULT NULL
1243 , p_from_attribute7 IN VARCHAR2 DEFAULT NULL
1244 , p_from_attribute8 IN VARCHAR2 DEFAULT NULL
1245 , p_from_attribute9 IN VARCHAR2 DEFAULT NULL
1246 , p_from_attribute10 IN VARCHAR2 DEFAULT NULL
1247 , p_from_attribute11 IN VARCHAR2 DEFAULT NULL
1248 , p_from_attribute12 IN VARCHAR2 DEFAULT NULL
1249 , p_from_attribute13 IN VARCHAR2 DEFAULT NULL
1250 , p_from_attribute14 IN VARCHAR2 DEFAULT NULL
1251 , p_from_attribute15 IN VARCHAR2 DEFAULT NULL
1252 , p_to_demand_type_id IN NUMBER
1253 , p_to_demand_name IN VARCHAR2
1254 , p_to_demand_header_id IN NUMBER
1255 , p_to_demand_line_id IN NUMBER
1256 , p_to_demand_delivery_id IN NUMBER DEFAULT NULL
1257 , p_to_reservation_uom_code IN VARCHAR2
1258 , p_to_reservation_quantity IN NUMBER
1259 , p_to_secondary_uom_code IN VARCHAR2 -- INVCONV
1260 , p_to_secondary_rsv_quantity IN NUMBER -- INVCONV
1261 , p_to_project_id IN NUMBER Default Null
1262 , p_to_task_id IN NUMBER Default Null
1263 , p_validation_flag IN VARCHAR2 DEFAULT fnd_api.g_true
1264 , x_to_reservation_id OUT NOCOPY NUMBER
1265 ) IS
1266 l_api_version_number CONSTANT NUMBER := 1.0;
1267 l_api_name CONSTANT VARCHAR2(30) := 'Transfer_Demand';
1268 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
1269 l_orig_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
1270 l_to_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
1271 l_dummy_serial_number inv_reservation_global.serial_number_tbl_type;
1272 BEGIN
1273
1274 -- Standard call to check for call compatibility
1275 IF NOT fnd_api.compatible_api_call(l_api_version_number
1276 , p_api_version_number
1277 , l_api_name
1278 , G_PKG_NAME
1279 ) THEN
1280 RAISE fnd_api.g_exc_unexpected_error;
1281 END IF;
1282
1283 -- Initialize message list.
1284 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1285 fnd_msg_pub.initialize;
1286 END IF;
1287
1288 -- construct the record type for the original reservation
1289 IF p_from_reservation_id IS NOT NULL
1290 AND p_from_reservation_id <> fnd_api.g_miss_num THEN
1291 l_orig_rsv_rec.reservation_id := p_from_reservation_id;
1292 ELSE
1293 l_orig_rsv_rec.requirement_date := p_from_requirement_date;
1294 l_orig_rsv_rec.organization_id := p_from_organization_id;
1295 l_orig_rsv_rec.inventory_item_id := p_from_inventory_item_id;
1296 l_orig_rsv_rec.demand_source_type_id := p_from_demand_type_id;
1297 l_orig_rsv_rec.demand_source_name := p_from_demand_name;
1298 l_orig_rsv_rec.demand_source_header_id := p_from_demand_header_id;
1299 l_orig_rsv_rec.demand_source_line_id := p_from_demand_line_id;
1300 l_orig_rsv_rec.demand_source_delivery := p_from_demand_delivery_id;
1301 l_orig_rsv_rec.primary_uom_code := p_from_primary_uom_code;
1302 l_orig_rsv_rec.primary_uom_id := p_from_primary_uom_id;
1303 l_orig_rsv_rec.secondary_uom_code := p_from_secondary_uom_code; -- INVCONV
1304 l_orig_rsv_rec.secondary_uom_id := p_from_secondary_uom_id; -- INVCONV
1305 l_orig_rsv_rec.reservation_uom_code := p_from_reservation_uom_code;
1306 l_orig_rsv_rec.reservation_uom_id := p_from_reservation_uom_id;
1307 l_orig_rsv_rec.reservation_quantity := p_from_reservation_quantity;
1308 l_orig_rsv_rec.primary_reservation_quantity := p_from_primary_rsv_quantity;
1309 l_orig_rsv_rec.secondary_reservation_quantity := p_from_secondary_rsv_quantity; -- INVCONV
1310 l_orig_rsv_rec.autodetail_group_id := p_from_autodetail_group_id;
1311 l_orig_rsv_rec.external_source_code := p_from_external_source_code;
1312 l_orig_rsv_rec.external_source_line_id := p_from_external_source_line;
1313 l_orig_rsv_rec.supply_source_type_id := p_from_supply_type_id;
1314 l_orig_rsv_rec.supply_source_header_id := p_from_supply_header_id;
1315 l_orig_rsv_rec.supply_source_line_id := p_from_supply_line_id;
1316 l_orig_rsv_rec.supply_source_name := p_from_supply_name;
1317 l_orig_rsv_rec.supply_source_line_detail := p_from_supply_line_detail;
1318 l_orig_rsv_rec.revision := p_from_revision;
1319 l_orig_rsv_rec.subinventory_code := p_from_subinventory_code;
1320 l_orig_rsv_rec.subinventory_id := p_from_subinventory_id;
1321 l_orig_rsv_rec.locator_id := p_from_locator_id;
1322 l_orig_rsv_rec.lot_number := p_from_lot_number;
1323 l_orig_rsv_rec.lot_number_id := p_from_lot_number_id;
1324 l_orig_rsv_rec.pick_slip_number := p_from_pick_slip_number;
1325 l_orig_rsv_rec.lpn_id := p_from_lpn_id;
1326 l_orig_rsv_rec.project_id := p_from_project_id;
1327 l_orig_rsv_rec.task_id := p_from_task_id;
1328 l_orig_rsv_rec.ship_ready_flag := p_from_ship_ready_flag;
1329 l_orig_rsv_rec.attribute_category := p_from_attribute_category;
1330 l_orig_rsv_rec.attribute1 := p_from_attribute1 ;
1331 l_orig_rsv_rec.attribute2 := p_from_attribute2 ;
1332 l_orig_rsv_rec.attribute3 := p_from_attribute3 ;
1333 l_orig_rsv_rec.attribute4 := p_from_attribute4 ;
1334 l_orig_rsv_rec.attribute5 := p_from_attribute5 ;
1335 l_orig_rsv_rec.attribute6 := p_from_attribute6 ;
1336 l_orig_rsv_rec.attribute7 := p_from_attribute7 ;
1337 l_orig_rsv_rec.attribute8 := p_from_attribute8 ;
1338 l_orig_rsv_rec.attribute9 := p_from_attribute9 ;
1339 l_orig_rsv_rec.attribute10 := p_from_attribute10;
1340 l_orig_rsv_rec.attribute11 := p_from_attribute11;
1341 l_orig_rsv_rec.attribute12 := p_from_attribute12;
1342 l_orig_rsv_rec.attribute13 := p_from_attribute13;
1343 l_orig_rsv_rec.attribute14 := p_from_attribute14;
1344 l_orig_rsv_rec.attribute15 := p_from_attribute15;
1345 END IF;
1346
1347 -- construct the record type for the transfer to record
1348 l_to_rsv_rec.demand_source_type_id := p_to_demand_type_id;
1349 l_to_rsv_rec.demand_source_name := p_to_demand_name;
1350 l_to_rsv_rec.demand_source_header_id := p_to_demand_header_id;
1351 l_to_rsv_rec.demand_source_line_id := p_to_demand_line_id;
1352 l_to_rsv_rec.demand_source_delivery := p_to_demand_delivery_id;
1353 l_to_rsv_rec.reservation_uom_code := p_to_reservation_uom_code;
1354 l_to_rsv_rec.reservation_quantity := p_to_reservation_quantity;
1355 l_to_rsv_rec.secondary_uom_code := p_to_secondary_uom_code; -- INVCONV
1356 l_to_rsv_rec.secondary_reservation_quantity := p_to_secondary_rsv_quantity; -- INVCONV
1357 l_to_rsv_rec.project_id := p_to_project_id;
1358 l_to_rsv_rec.task_id := p_to_task_id;
1359
1360 inv_reservation_pvt.transfer_reservation
1361 (
1362 p_api_version_number => 1.0
1363 , p_init_msg_lst => p_init_msg_lst
1364 , x_return_status => l_return_status
1365 , x_msg_count => x_msg_count
1366 , x_msg_data => x_msg_data
1367 , p_original_rsv_rec => l_orig_rsv_rec
1368 , p_to_rsv_rec => l_to_rsv_rec
1369 , p_original_serial_number => l_dummy_serial_number
1370 , p_validation_flag => p_validation_flag
1371 , x_reservation_id => x_to_reservation_id
1372 );
1373
1374 IF l_return_status = fnd_api.g_ret_sts_error THEN
1375 RAISE fnd_api.g_exc_error;
1376 END IF ;
1377
1378 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1379 RAISE fnd_api.g_exc_unexpected_error;
1380 END IF;
1381
1382 x_return_status := l_return_status;
1383
1384 EXCEPTION
1385
1386 WHEN fnd_api.g_exc_error THEN
1387 x_return_status := fnd_api.g_ret_sts_error;
1388
1389 -- Get message count and data
1390 fnd_msg_pub.count_and_get
1391 ( p_count => x_msg_count
1392 , p_data => x_msg_data
1393 , p_encoded => 'F'
1394 );
1395
1396 WHEN fnd_api.g_exc_unexpected_error THEN
1397 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1398
1399 -- Get message count and data
1400 fnd_msg_pub.count_and_get
1401 ( p_count => x_msg_count
1402 , p_data => x_msg_data
1403 , p_encoded => 'F'
1404 );
1405
1406 WHEN OTHERS THEN
1407 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1408
1409 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1410 THEN
1411 fnd_msg_pub.add_exc_msg
1412 ( g_pkg_name
1413 , l_api_name
1414 );
1415 END IF;
1416
1417 -- Get message count and data
1418 fnd_msg_pub.count_and_get
1419 ( p_count => x_msg_count
1420 , p_data => x_msg_data
1421 , p_encoded => 'F'
1422 );
1423
1424 END transfer_demand;
1425 --
1426 PROCEDURE query_reservation
1427 (
1428 p_api_version_number IN NUMBER
1429 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1430 , x_return_status OUT NOCOPY VARCHAR2
1431 , x_msg_count OUT NOCOPY NUMBER
1432 , x_msg_data OUT NOCOPY VARCHAR2
1433 , p_reservation_id IN NUMBER
1434 , p_lock_records IN VARCHAR2 DEFAULT fnd_api.g_false
1435 , p_sort_by_req_date IN NUMBER
1436 , p_cancel_order_mode IN NUMBER
1437 , x_mtl_reservation_tbl
1438 OUT NOCOPY inv_reservation_global.mtl_reservation_tbl_type
1439 , x_mtl_reservation_tbl_count OUT NOCOPY NUMBER
1440 , x_error_code OUT NOCOPY NUMBER
1441 ) IS
1442 l_api_version_number CONSTANT NUMBER := 1.0;
1443 l_api_name CONSTANT VARCHAR2(30) := 'Query_Reservation';
1444 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
1445 l_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
1446 BEGIN
1447 -- Standard call to check for call compatibility
1448 IF NOT fnd_api.compatible_api_call(l_api_version_number
1449 , p_api_version_number
1450 , l_api_name
1451 , G_PKG_NAME
1452 ) THEN
1453 RAISE fnd_api.g_exc_unexpected_error;
1454 END IF;
1455 --
1456 -- Initialize message list.
1457 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1458 fnd_msg_pub.initialize;
1459 END IF;
1460 --
1461 l_rsv_rec.reservation_id := p_reservation_id;
1462 inv_reservation_pub.query_reservation
1463 ( p_api_version_number => 1.0
1464 , p_init_msg_lst => fnd_api.g_false
1465 , x_return_status => l_return_status
1466 , x_msg_count => x_msg_count
1467 , x_msg_data => x_msg_data
1468 , p_query_input => l_rsv_rec
1469 , p_lock_records => p_lock_records
1470 , p_sort_by_req_date => p_sort_by_req_date
1471 , p_cancel_order_mode => p_cancel_order_mode
1472 , x_mtl_reservation_tbl => x_mtl_reservation_tbl
1473 , x_mtl_reservation_tbl_count => x_mtl_reservation_tbl_count
1474 , x_error_code => x_error_code
1475 );
1476 IF l_return_status = fnd_api.g_ret_sts_error THEN
1477 RAISE fnd_api.g_exc_error;
1478 END IF ;
1479
1480 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1481 RAISE fnd_api.g_exc_unexpected_error;
1482 END IF;
1483
1484 x_return_status := l_return_status;
1485
1486 EXCEPTION
1487
1488 WHEN fnd_api.g_exc_error THEN
1489 x_return_status := fnd_api.g_ret_sts_error;
1490
1491 -- Get message count and data
1492 fnd_msg_pub.count_and_get
1493 ( p_count => x_msg_count
1494 , p_data => x_msg_data
1495 , p_encoded => 'F'
1496 );
1497
1498 WHEN fnd_api.g_exc_unexpected_error THEN
1499 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1500
1501 -- Get message count and data
1502 fnd_msg_pub.count_and_get
1503 ( p_count => x_msg_count
1504 , p_data => x_msg_data
1505 , p_encoded => 'F'
1506 );
1507
1508 WHEN OTHERS THEN
1509 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1510
1511 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1512 THEN
1513 fnd_msg_pub.add_exc_msg
1514 ( g_pkg_name
1515 , l_api_name
1516 );
1517 END IF;
1518
1519 -- Get message count and data
1520 fnd_msg_pub.count_and_get
1521 ( p_count => x_msg_count
1522 , p_data => x_msg_data
1523 , p_encoded => 'F'
1524 );
1525 END query_reservation;
1526
1527 PROCEDURE get_reservable_quantity
1528 (
1529 p_api_version_number IN NUMBER
1530 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1531 , x_return_status OUT NOCOPY VARCHAR2
1532 , x_msg_count OUT NOCOPY NUMBER
1533 , x_msg_data OUT NOCOPY VARCHAR2
1534 , p_reservation_id IN NUMBER
1535 , p_reservation_uom_code IN VARCHAR2
1536 , p_demand_type_id IN NUMBER
1537 , p_demand_name IN VARCHAR2
1538 , p_demand_header_id IN NUMBER
1539 , p_demand_line_id IN NUMBER
1540 , p_demand_delivery_id IN NUMBER DEFAULT NULL
1541 , p_Project_Id In Number
1542 , p_Task_ID In Number
1543 , x_reservable_quantity OUT NOCOPY NUMBER
1544 , x_reservation_margin_above OUT NOCOPY NUMBER -- INVCONV
1545 ) is
1546 l_api_version_number CONSTANT NUMBER := 1.0;
1547 l_api_name CONSTANT VARCHAR2(30) := 'get_reservable_quantity';
1548
1549 --l_line_rec OE_Order_PUB.Line_Rec_Type;
1550 l_ordered_quantity_rsv_uom NUMBER := 0;
1551 l_primary_uom_code VARCHAR2(3);
1552 l_primary_reserved_quantity NUMBER := 0;
1553 l_reserved_quantity NUMBER := 0;
1554 l_ship_tolerance_above NUMBER; -- INVCONV
1555
1556 l_org_id NUMBER;
1557 l_line_rec_inventory_item_id oe_order_lines_all.inventory_item_id%TYPE;
1558 l_line_rec_ordered_quantity oe_order_lines_all.ordered_quantity%TYPE;
1559 l_line_rec_order_quantity_uom oe_order_lines_all.order_quantity_uom%TYPE;
1560 l_line_rec_org_id oe_order_lines_all.org_id%TYPE;
1561 -- R12 Project : SU
1562 lx_Qty_Available Number;
1563 BEGIN
1564 -- Initialize return status
1565 x_return_status := fnd_api.g_ret_sts_success;
1566
1567 -- Standard call to check for call compatibility
1568 IF NOT fnd_api.compatible_api_call(l_api_version_number
1569 , p_api_version_number
1570 , l_api_name
1571 , G_PKG_NAME
1572 ) THEN
1573 RAISE fnd_api.g_exc_unexpected_error;
1574 END IF;
1575 --
1576 -- Initialize message list.
1577 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1578 fnd_msg_pub.initialize;
1579 END IF;
1580
1581 if p_demand_type_id in (inv_reservation_global.g_source_type_oe,
1582 inv_reservation_global.g_source_type_internal_ord,
1583 inv_reservation_global.g_source_type_rma) then
1584
1585 -- Fetch row from oe_order_lines
1586 --l_line_rec := OE_Line_Util.Query_Row(p_line_id => p_demand_line_id);
1587 -- Because oe_lines_util.query_row was changed to private, so we need to
1588 -- query order lines manually
1589
1590 -- Fix bug 2024374, remove the constraint on org_id,
1591 -- when the sales order is in another operating unit
1592 -- it will not get the correct org.
1593 /*l_org_id := OE_GLOBALS.G_ORG_ID;
1594 if l_org_id IS NULL THEN
1595 OE_GLOBALS.Set_Context;
1596 l_org_id := OE_GLOBALS.G_ORG_ID;
1597 end if;*/
1598 --INVCONV - Retrieve ship tolerance above for lot indivisible scenarios
1599 SELECT inventory_item_id, ordered_quantity, order_quantity_uom, ship_from_org_id,
1600 ship_tolerance_above
1601 INTO l_line_rec_inventory_item_id,
1602 l_line_rec_ordered_quantity,
1603 l_line_rec_order_quantity_uom,
1604 l_line_rec_org_id,
1605 l_ship_tolerance_above
1606 FROM oe_order_lines_all
1607 WHERE line_id = p_demand_line_id ;
1608 --AND NVL(ORG_ID,NVL(l_org_id,0))= NVL(l_org_id,0) ;
1609
1610 -- Convert order quantity into reservation uom code
1611 l_ordered_quantity_rsv_uom :=
1612 inv_convert.inv_um_convert
1613 (
1614 l_line_rec_inventory_item_id,
1615 NULL,
1616 l_line_rec_ordered_quantity,
1617 l_line_rec_order_quantity_uom,
1618 p_reservation_uom_code,
1619 NULL,
1620 NULL);
1621
1622
1623 -- Fetch quantity reserved so far
1624 select nvl(sum(primary_reservation_quantity),0)
1625 into l_primary_reserved_quantity
1626 from mtl_reservations
1627 where demand_source_type_id = p_demand_type_id
1628 and demand_source_header_id = p_demand_header_id
1629 and demand_source_line_id = p_demand_line_id
1630 and reservation_id <> p_reservation_id;
1631
1632 if l_primary_reserved_quantity > 0 then
1633
1634 -- Get primary UOM
1635 select primary_uom_code
1636 into l_primary_uom_code
1637 from mtl_system_items
1638 where organization_id = l_line_rec_org_id
1639 and inventory_item_id = l_line_rec_inventory_item_id;
1640
1641 -- Convert primary reservation quantity into
1642 -- reservation uom code
1643 l_reserved_quantity :=
1644 inv_convert.inv_um_convert
1645 (
1646 l_line_rec_inventory_item_id,
1647 NULL,
1648 l_primary_reserved_quantity,
1649 l_primary_uom_code,
1650 p_reservation_uom_code,
1651 NULL,
1652 NULL);
1653 else
1654 l_reserved_quantity := 0;
1655 end if;
1656
1657 -- Quantity that can be still reserved
1658 x_reservable_quantity := l_ordered_quantity_rsv_uom -
1659 l_reserved_quantity;
1660 -- INVCONV
1661 -- Calculate the upper limit on the reservation using ship_tolerance above
1662 x_reservation_margin_above :=
1663 l_ordered_quantity_rsv_uom * NVL(l_ship_tolerance_above,0) / 100;
1664 -- R12 Project Changes : SU
1665 Else -- For any other demand call following API
1666 -- For any other Demand call following API
1667 Inv_Reservation_Avail_Pvt.Available_Demand_To_Reserve (
1668 x_Return_Status => x_Return_Status
1669 ,x_Msg_Count => x_Msg_Count
1670 ,X_Msg_Data => x_Msg_Data
1671 ,x_qty_Available_to_Reserve => x_Reservable_Quantity
1672 ,x_Qty_Available => lx_Qty_Available
1673 ,p_Demand_Source_Type_Id => p_Demand_Type_ID
1674 ,p_Demand_Source_Header_ID => p_Demand_HEader_ID
1675 ,p_Demand_Source_Line_ID => p_Demand_Line_Id
1676 ,p_Demand_Source_Line_Detail => p_Demand_Delivery_Id
1677 ,P_Project_Id => p_Project_Id
1678 ,p_Task_Id => P_Task_Id
1679 ,p_API_Version_Number => 1.0
1680 ,p_Init_Msg_Lst => p_Init_Msg_lst );
1681
1682 IF x_return_status = fnd_api.g_ret_sts_error THEN
1683 RAISE fnd_api.g_exc_error;
1684 END IF ;
1685
1686 IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1687 RAISE fnd_api.g_exc_unexpected_error;
1688 END IF;
1689 end if;
1690
1691 EXCEPTION
1692
1693 WHEN fnd_api.g_exc_error THEN
1694 x_return_status := fnd_api.g_ret_sts_error;
1695 x_reservable_quantity := 0;
1696
1697 -- Get message count and data
1698 fnd_msg_pub.count_and_get
1699 ( p_count => x_msg_count
1700 , p_data => x_msg_data
1701 , p_encoded => 'F'
1702 );
1703
1704 WHEN fnd_api.g_exc_unexpected_error THEN
1705 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1706 x_reservable_quantity := 0;
1707
1708 -- Get message count and data
1709 fnd_msg_pub.count_and_get
1710 ( p_count => x_msg_count
1711 , p_data => x_msg_data
1712 , p_encoded => 'F'
1713 );
1714
1715 WHEN OTHERS THEN
1716 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1717 x_reservable_quantity := 0;
1718
1719 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1720 THEN
1721 fnd_msg_pub.add_exc_msg
1722 ( g_pkg_name
1723 , l_api_name
1724 );
1725 END IF;
1726
1727 -- Get message count and data
1728 fnd_msg_pub.count_and_get
1729 ( p_count => x_msg_count
1730 , p_data => x_msg_data
1731 , p_encoded => 'F'
1732 );
1733 END get_reservable_quantity;
1734
1735 -- GME CONVERGENCE BEGIN
1736 PROCEDURE create_move_order_header
1737 (
1738 p_api_version_number IN NUMBER
1739 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1740 , p_organization_id IN NUMBER
1741 , x_return_status OUT NOCOPY VARCHAR2
1742 , x_msg_count OUT NOCOPY NUMBER
1743 , x_msg_data OUT NOCOPY VARCHAR2
1744 , x_header_id OUT NOCOPY NUMBER
1745 ) is
1746 l_api_version_number CONSTANT NUMBER := 1.0;
1747 l_api_name CONSTANT VARCHAR2(30) := 'create_move_order_header';
1748
1749 l_user_id NUMBER := fnd_global.user_id;
1750 l_return_status VARCHAR2(1);
1751 l_in_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
1752 l_in_trohdr_val_rec INV_MOVE_ORDER_PUB.Trohdr_Val_Rec_Type;
1753 l_out_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
1754 l_out_trohdr_val_rec INV_MOVE_ORDER_PUB.Trohdr_Val_Rec_Type;
1755
1756 BEGIN
1757 -- Initialize return status
1758 x_return_status := fnd_api.g_ret_sts_success;
1759
1760 -- Standard call to check for call compatibility
1761 IF NOT fnd_api.compatible_api_call(l_api_version_number
1762 , p_api_version_number
1763 , l_api_name
1764 , G_PKG_NAME
1765 ) THEN
1766 RAISE fnd_api.g_exc_unexpected_error;
1767 END IF;
1768 --
1769 -- Initialize message list.
1770 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1771 fnd_msg_pub.initialize;
1772 END IF;
1773
1774 l_in_trohdr_rec.organization_id := p_organization_id;
1775 l_in_trohdr_rec.move_order_type := 8;
1776 l_in_trohdr_rec.operation := inv_globals.g_opr_create;
1777 l_in_trohdr_rec.request_number := FND_API.G_MISS_CHAR;
1778 l_in_trohdr_rec.header_id := FND_API.G_MISS_NUM;
1779 l_in_trohdr_rec.creation_date := SYSDATE;
1780 l_in_trohdr_rec.created_by := l_user_id;
1781 l_in_trohdr_rec.last_update_date := SYSDATE;
1782 l_in_trohdr_rec.last_updated_by := l_user_id;
1783 inv_move_order_pub.create_move_order_header
1784 (p_api_version_number => 1.0,
1785 p_init_msg_list => FND_API.G_FALSE,
1786 p_return_values => FND_API.G_FALSE,
1787 p_commit => FND_API.G_FALSE,
1788 x_return_status => l_return_status,
1789 x_msg_count => x_msg_count,
1790 x_msg_data => x_msg_data,
1791 p_trohdr_rec => l_in_trohdr_rec,
1792 p_trohdr_val_rec => l_in_trohdr_val_rec,
1793 x_trohdr_rec => l_out_trohdr_rec,
1794 x_trohdr_val_rec => l_out_trohdr_val_rec,
1795 p_validation_flag => inv_move_order_pub.g_validation_yes);
1796
1797 IF l_return_status = fnd_api.g_ret_sts_error THEN
1798 RAISE fnd_api.g_exc_error;
1799 END IF ;
1800
1801 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1802 RAISE fnd_api.g_exc_unexpected_error;
1803 END IF;
1804
1805 x_header_id := l_out_trohdr_rec.header_id;
1806
1807 EXCEPTION
1808
1809 WHEN fnd_api.g_exc_error THEN
1810 x_return_status := fnd_api.g_ret_sts_error;
1811
1812 -- Get message count and data
1813 fnd_msg_pub.count_and_get
1814 ( p_count => x_msg_count
1815 , p_data => x_msg_data
1816 , p_encoded => 'F'
1817 );
1818
1819 WHEN fnd_api.g_exc_unexpected_error THEN
1820 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1821
1822 -- Get message count and data
1823 fnd_msg_pub.count_and_get
1824 ( p_count => x_msg_count
1825 , p_data => x_msg_data
1826 , p_encoded => 'F'
1827 );
1828
1829 WHEN OTHERS THEN
1830 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1831
1832 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1833 THEN
1834 fnd_msg_pub.add_exc_msg
1835 ( g_pkg_name
1836 , l_api_name
1837 );
1838 END IF;
1839
1840 -- Get message count and data
1841 fnd_msg_pub.count_and_get
1842 ( p_count => x_msg_count
1843 , p_data => x_msg_data
1844 , p_encoded => 'F'
1845 );
1846 END create_move_order_header;
1847
1848 PROCEDURE create_move_order_line
1849 (
1850 p_api_version_number IN NUMBER
1851 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1852 , p_organization_id IN NUMBER
1853 , p_move_order_header_id IN NUMBER
1854 , p_inventory_item_id IN NUMBER
1855 , p_quantity IN NUMBER
1856 , p_uom_code IN VARCHAR2
1857 , p_secondary_quantity IN NUMBER DEFAULT NULL
1858 , p_secondary_uom IN VARCHAR2 DEFAULT NULL
1859 , p_revision IN VARCHAR2
1860 , p_date_required IN DATE
1861 , p_source_type_id IN NUMBER
1862 , p_source_id IN NUMBER
1863 , p_source_line_id IN NUMBER
1864 , p_grade_code IN VARCHAR2
1865 , x_return_status OUT NOCOPY VARCHAR2
1866 , x_msg_count OUT NOCOPY NUMBER
1867 , x_msg_data OUT NOCOPY VARCHAR2
1868 , x_line_id OUT NOCOPY NUMBER
1869 ) is
1870 l_api_version_number CONSTANT NUMBER := 1.0;
1871 l_api_name CONSTANT VARCHAR2(30) := 'create_move_order_line';
1872
1873 l_user_id NUMBER := fnd_global.user_id;
1874 l_return_status VARCHAR2(1);
1875 l_in_trolin_tbl INV_MOVE_ORDER_PUB.Trolin_Tbl_Type;
1876 l_in_trolin_val_tbl INV_MOVE_ORDER_PUB.Trolin_Val_Tbl_Type;
1877 l_out_trolin_tbl INV_MOVE_ORDER_PUB.Trolin_Tbl_Type;
1878 l_out_trolin_val_tbl INV_MOVE_ORDER_PUB.Trolin_Val_Tbl_Type;
1879
1880 BEGIN
1881 -- Initialize return status
1882 x_return_status := fnd_api.g_ret_sts_success;
1883
1884 -- Standard call to check for call compatibility
1885 IF NOT fnd_api.compatible_api_call(l_api_version_number
1886 , p_api_version_number
1887 , l_api_name
1888 , G_PKG_NAME
1889 ) THEN
1890 RAISE fnd_api.g_exc_unexpected_error;
1891 END IF;
1892 --
1893 -- Initialize message list.
1894 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1895 fnd_msg_pub.initialize;
1896 END IF;
1897
1898 l_in_trolin_tbl(1).operation := inv_globals.g_opr_create;
1899 l_in_trolin_tbl(1).header_id := p_move_order_header_id;
1900 l_in_trolin_tbl(1).inventory_item_id := p_inventory_item_id;
1901 l_in_trolin_tbl(1).organization_id := p_organization_id;
1902 l_in_trolin_tbl(1).quantity := p_quantity;
1903 l_in_trolin_tbl(1).uom_code := p_uom_code;
1904 l_in_trolin_tbl(1).secondary_quantity := p_secondary_quantity;
1905 l_in_trolin_tbl(1).secondary_uom := p_secondary_uom;
1906 l_in_trolin_tbl(1).revision := p_revision;
1907 l_in_trolin_tbl(1).date_required := p_date_required;
1908 l_in_trolin_tbl(1).creation_date := SYSDATE;
1909 l_in_trolin_tbl(1).created_by := l_user_id;
1910 l_in_trolin_tbl(1).last_update_date := SYSDATE;
1911 l_in_trolin_tbl(1).last_updated_by := l_user_id;
1912 l_in_trolin_tbl(1).transaction_type_id := INV_GLOBALS.G_TYPE_XFER_ORDER_REPL_SUBXFR;
1913 l_in_trolin_tbl(1).transaction_source_type_id := p_source_type_id;
1914 l_in_trolin_tbl(1).txn_source_id := p_source_id;
1915 l_in_trolin_tbl(1).txn_source_line_id := p_source_line_id;
1916 l_in_trolin_tbl(1).grade_code := p_grade_code;
1917 -- For dual track items, secondary quantity may need to be zeroed.
1918 IF l_in_trolin_tbl(1).secondary_uom is NOT NULL AND
1919 l_in_trolin_tbl(1).secondary_quantity IS NULL THEN
1920 l_in_trolin_tbl(1).secondary_quantity := 0;
1921 END IF;
1922 -- bug 5671641 begin
1923 IF l_in_trolin_tbl(1).transaction_source_type_id = 2 then -- for sales order
1924 -- populate reference field as 'ORDER_LINE_ID_RSV'
1925 l_in_trolin_tbl(1).reference := 'ORDER_LINE_ID_RSV';
1926 l_in_trolin_tbl(1).reference_id := p_source_line_id;
1927 l_in_trolin_tbl(1).transaction_type_id := INV_GLOBALS.G_TYPE_TRANSFER_ORDER_STGXFR;
1928 END IF;
1929 -- bug 5671641 end
1930
1931 inv_move_order_pub.create_move_order_lines
1932 (p_api_version_number => 1.0,
1933 p_init_msg_list => FND_API.G_FALSE,
1934 p_return_values => FND_API.G_FALSE,
1935 p_commit => FND_API.G_FALSE,
1936 x_return_status => l_return_status,
1937 x_msg_count => x_msg_count,
1938 x_msg_data => x_msg_data,
1939 p_trolin_tbl => l_in_trolin_tbl,
1940 p_trolin_val_tbl => l_in_trolin_val_tbl,
1941 x_trolin_tbl => l_out_trolin_tbl,
1942 x_trolin_val_tbl => l_out_trolin_val_tbl,
1943 p_validation_flag => inv_move_order_pub.g_validation_yes);
1944
1945 IF l_return_status = fnd_api.g_ret_sts_error THEN
1946 RAISE fnd_api.g_exc_error;
1947 END IF ;
1948
1949 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1950 RAISE fnd_api.g_exc_unexpected_error;
1951 END IF;
1952
1953 x_line_id := l_out_trolin_tbl(1).line_id;
1954
1955 EXCEPTION
1956
1957 WHEN fnd_api.g_exc_error THEN
1958 x_return_status := fnd_api.g_ret_sts_error;
1959
1960 -- Get message count and data
1961 fnd_msg_pub.count_and_get
1962 ( p_count => x_msg_count
1963 , p_data => x_msg_data
1964 , p_encoded => 'F'
1965 );
1966
1967 WHEN fnd_api.g_exc_unexpected_error THEN
1968 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1969
1970 -- Get message count and data
1971 fnd_msg_pub.count_and_get
1972 ( p_count => x_msg_count
1973 , p_data => x_msg_data
1974 , p_encoded => 'F'
1975 );
1976
1977 WHEN OTHERS THEN
1978 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1979
1980 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1981 THEN
1982 fnd_msg_pub.add_exc_msg
1983 ( g_pkg_name
1984 , l_api_name
1985 );
1986 END IF;
1987
1988 -- Get message count and data
1989 fnd_msg_pub.count_and_get
1990 ( p_count => x_msg_count
1991 , p_data => x_msg_data
1992 , p_encoded => 'F'
1993 );
1994 END create_move_order_line;
1995
1996 PROCEDURE delete_move_order
1997 (
1998 p_api_version_number IN NUMBER
1999 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
2000 , p_move_order_header_id IN NUMBER
2001 , x_return_status OUT NOCOPY VARCHAR2
2002 , x_msg_count OUT NOCOPY NUMBER
2003 , x_msg_data OUT NOCOPY VARCHAR2
2004 ) is
2005 l_api_version_number CONSTANT NUMBER := 1.0;
2006 l_api_name CONSTANT VARCHAR2(30) := 'delete_move_order';
2007
2008 l_user_id NUMBER := fnd_global.user_id;
2009 l_return_status VARCHAR2(1);
2010 l_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
2011 l_in_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
2012 l_trohdr_val_rec INV_MOVE_ORDER_PUB.Trohdr_Val_Rec_Type;
2013 l_trolin_tbl INV_MOVE_ORDER_PUB.Trolin_Tbl_Type;
2014 l_trolin_val_tbl INV_MOVE_ORDER_PUB.Trolin_Val_Tbl_Type;
2015
2016 BEGIN
2017 -- Initialize return status
2018 x_return_status := fnd_api.g_ret_sts_success;
2019
2020 -- Standard call to check for call compatibility
2021 IF NOT fnd_api.compatible_api_call(l_api_version_number
2022 , p_api_version_number
2023 , l_api_name
2024 , G_PKG_NAME
2025 ) THEN
2026 RAISE fnd_api.g_exc_unexpected_error;
2027 END IF;
2028 --
2029 -- Initialize message list.
2030 IF fnd_api.to_boolean(p_init_msg_lst) THEN
2031 fnd_msg_pub.initialize;
2032 END IF;
2033
2034 l_in_trohdr_rec.operation := inv_globals.g_opr_delete;
2035 l_in_trohdr_rec.header_id := p_move_order_header_id;
2036 inv_move_order_pub.process_move_order
2037 (p_api_version_number => 1.0,
2038 p_init_msg_list => FND_API.G_TRUE,
2039 p_return_values => FND_API.G_FALSE,
2040 p_commit => FND_API.G_FALSE,
2041 x_return_status => l_return_status,
2042 x_msg_count => x_msg_count,
2043 x_msg_data => x_msg_data,
2044 p_trohdr_rec => l_in_trohdr_rec,
2045 x_trohdr_rec => l_trohdr_rec,
2046 x_trohdr_val_rec => l_trohdr_val_rec,
2047 x_trolin_tbl => l_trolin_tbl,
2048 x_trolin_val_tbl => l_trolin_val_tbl);
2049
2050 IF l_return_status = fnd_api.g_ret_sts_error THEN
2051 RAISE fnd_api.g_exc_error;
2052 END IF ;
2053
2054 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2055 RAISE fnd_api.g_exc_unexpected_error;
2056 END IF;
2057
2058
2059 EXCEPTION
2060
2061 WHEN fnd_api.g_exc_error THEN
2062 x_return_status := fnd_api.g_ret_sts_error;
2063
2064 -- Get message count and data
2065 fnd_msg_pub.count_and_get
2066 ( p_count => x_msg_count
2067 , p_data => x_msg_data
2068 , p_encoded => 'F'
2069 );
2070
2071 WHEN fnd_api.g_exc_unexpected_error THEN
2072 x_return_status := fnd_api.g_ret_sts_unexp_error ;
2073
2074 -- Get message count and data
2075 fnd_msg_pub.count_and_get
2076 ( p_count => x_msg_count
2077 , p_data => x_msg_data
2078 , p_encoded => 'F'
2079 );
2080
2081 WHEN OTHERS THEN
2082 x_return_status := fnd_api.g_ret_sts_unexp_error ;
2083
2084 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
2085 THEN
2086 fnd_msg_pub.add_exc_msg
2087 ( g_pkg_name
2088 , l_api_name
2089 );
2090 END IF;
2091
2092 -- Get message count and data
2093 fnd_msg_pub.count_and_get
2094 ( p_count => x_msg_count
2095 , p_data => x_msg_data
2096 , p_encoded => 'F'
2097 );
2098 END delete_move_order;
2099 -- GME CONVERGENCE END
2100
2101 --bug 4097848
2102
2103 FUNCTION demand_source_line_number(
2104 p_line_number IN NUMBER
2105 , p_shipment_number IN NUMBER
2106 , p_option_number IN NUMBER
2107 , p_component_number IN NUMBER
2108 , p_service_number IN NUMBER
2109 )
2110 RETURN VARCHAR2
2111 IS
2112
2113 x_concat_line_number VARCHAR2(256);
2114
2115
2116 BEGIN
2117 IF p_service_number is not null then
2118 IF p_option_number is not null then
2119 IF p_component_number is not null then
2120 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2121 p_option_number||'.'||p_component_number||'.'||
2122 p_service_number;
2123 ELSE
2124 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2125 p_option_number||'..'||p_service_number;
2126 END IF;
2127
2128 --- if option is not attached
2129 ELSE
2130 IF p_component_number is not null then
2131
2132 x_concat_line_number := p_line_number||'.'||p_shipment_number||'..'||
2133 p_component_number||'.'||p_service_number;
2134 ELSE
2135 x_concat_line_number := p_line_number||'.'||p_shipment_number||
2136 '...'||p_service_number;
2137 END IF;
2138
2139 END IF; /* if option number is not null */
2140 -- if the service number is null
2141 ELSE
2142 IF p_option_number is not null then
2143 IF p_component_number is not null then
2144 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2145 p_option_number||'.'||p_component_number;
2146 ELSE
2147 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2148 p_option_number;
2149 END IF;
2150
2151 --- if option is not attached
2152 ELSE
2153 IF p_component_number is not null then
2154 x_concat_line_number := p_line_number||'.'||p_shipment_number||'..'||
2155 p_component_number;
2156 ELSE
2157
2158 IF (p_line_number is NULL and p_shipment_number is NULL ) THEN
2159 x_concat_line_number := NULL;
2160 ELSE
2161 x_concat_line_number := p_line_number||'.'||p_shipment_number;
2162 END IF;
2163 END IF;
2164
2165 END IF; /* if option number is not null */
2166
2167 END IF; /* if service number is not null */
2168
2169 return x_concat_line_number;
2170
2171 EXCEPTION WHEN OTHERS THEN
2172 return NULL;
2173
2174 END demand_source_line_number;
2175
2176 END inv_reservation_form_pkg ;