[Home] [Help]
PACKAGE BODY: APPS.INV_RESERVATION_FORM_PKG
Source
1 PACKAGE body inv_reservation_form_pkg AS
2 /* $Header: INVRSVFB.pls 120.10.12020000.4 2013/03/14 07:30:34 avrose 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 l_fulfill_base VARCHAR2(1) := 'P';
1273 BEGIN
1274
1275 -- Standard call to check for call compatibility
1276 IF NOT fnd_api.compatible_api_call(l_api_version_number
1277 , p_api_version_number
1278 , l_api_name
1279 , G_PKG_NAME
1280 ) THEN
1281 RAISE fnd_api.g_exc_unexpected_error;
1282 END IF;
1283
1284 -- Initialize message list.
1285 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1286 fnd_msg_pub.initialize;
1287 END IF;
1288
1289 -- construct the record type for the original reservation
1290 IF p_from_reservation_id IS NOT NULL
1291 AND p_from_reservation_id <> fnd_api.g_miss_num THEN
1292 l_orig_rsv_rec.reservation_id := p_from_reservation_id;
1293 ELSE
1294 l_orig_rsv_rec.requirement_date := p_from_requirement_date;
1295 l_orig_rsv_rec.organization_id := p_from_organization_id;
1296 l_orig_rsv_rec.inventory_item_id := p_from_inventory_item_id;
1297 l_orig_rsv_rec.demand_source_type_id := p_from_demand_type_id;
1298 l_orig_rsv_rec.demand_source_name := p_from_demand_name;
1299 l_orig_rsv_rec.demand_source_header_id := p_from_demand_header_id;
1300 l_orig_rsv_rec.demand_source_line_id := p_from_demand_line_id;
1301 l_orig_rsv_rec.demand_source_delivery := p_from_demand_delivery_id;
1302 l_orig_rsv_rec.primary_uom_code := p_from_primary_uom_code;
1303 l_orig_rsv_rec.primary_uom_id := p_from_primary_uom_id;
1304 l_orig_rsv_rec.secondary_uom_code := p_from_secondary_uom_code; -- INVCONV
1305 l_orig_rsv_rec.secondary_uom_id := p_from_secondary_uom_id; -- INVCONV
1306 l_orig_rsv_rec.reservation_uom_code := p_from_reservation_uom_code;
1307 l_orig_rsv_rec.reservation_uom_id := p_from_reservation_uom_id;
1308 l_orig_rsv_rec.reservation_quantity := p_from_reservation_quantity;
1309 l_orig_rsv_rec.primary_reservation_quantity := p_from_primary_rsv_quantity;
1310 l_orig_rsv_rec.secondary_reservation_quantity := p_from_secondary_rsv_quantity; -- INVCONV
1311 l_orig_rsv_rec.autodetail_group_id := p_from_autodetail_group_id;
1312 l_orig_rsv_rec.external_source_code := p_from_external_source_code;
1313 l_orig_rsv_rec.external_source_line_id := p_from_external_source_line;
1314 l_orig_rsv_rec.supply_source_type_id := p_from_supply_type_id;
1315 l_orig_rsv_rec.supply_source_header_id := p_from_supply_header_id;
1316 l_orig_rsv_rec.supply_source_line_id := p_from_supply_line_id;
1317 l_orig_rsv_rec.supply_source_name := p_from_supply_name;
1318 l_orig_rsv_rec.supply_source_line_detail := p_from_supply_line_detail;
1319 l_orig_rsv_rec.revision := p_from_revision;
1320 l_orig_rsv_rec.subinventory_code := p_from_subinventory_code;
1321 l_orig_rsv_rec.subinventory_id := p_from_subinventory_id;
1322 l_orig_rsv_rec.locator_id := p_from_locator_id;
1323 l_orig_rsv_rec.lot_number := p_from_lot_number;
1324 l_orig_rsv_rec.lot_number_id := p_from_lot_number_id;
1325 l_orig_rsv_rec.pick_slip_number := p_from_pick_slip_number;
1326 l_orig_rsv_rec.lpn_id := p_from_lpn_id;
1327 l_orig_rsv_rec.project_id := p_from_project_id;
1328 l_orig_rsv_rec.task_id := p_from_task_id;
1329 l_orig_rsv_rec.ship_ready_flag := p_from_ship_ready_flag;
1330 l_orig_rsv_rec.attribute_category := p_from_attribute_category;
1331 l_orig_rsv_rec.attribute1 := p_from_attribute1 ;
1332 l_orig_rsv_rec.attribute2 := p_from_attribute2 ;
1333 l_orig_rsv_rec.attribute3 := p_from_attribute3 ;
1334 l_orig_rsv_rec.attribute4 := p_from_attribute4 ;
1335 l_orig_rsv_rec.attribute5 := p_from_attribute5 ;
1336 l_orig_rsv_rec.attribute6 := p_from_attribute6 ;
1337 l_orig_rsv_rec.attribute7 := p_from_attribute7 ;
1338 l_orig_rsv_rec.attribute8 := p_from_attribute8 ;
1339 l_orig_rsv_rec.attribute9 := p_from_attribute9 ;
1340 l_orig_rsv_rec.attribute10 := p_from_attribute10;
1341 l_orig_rsv_rec.attribute11 := p_from_attribute11;
1342 l_orig_rsv_rec.attribute12 := p_from_attribute12;
1343 l_orig_rsv_rec.attribute13 := p_from_attribute13;
1344 l_orig_rsv_rec.attribute14 := p_from_attribute14;
1345 l_orig_rsv_rec.attribute15 := p_from_attribute15;
1346 END IF;
1347
1348 -- construct the record type for the transfer to record
1349 l_to_rsv_rec.demand_source_type_id := p_to_demand_type_id;
1350 l_to_rsv_rec.demand_source_name := p_to_demand_name;
1351 l_to_rsv_rec.demand_source_header_id := p_to_demand_header_id;
1352 l_to_rsv_rec.demand_source_line_id := p_to_demand_line_id;
1353 l_to_rsv_rec.demand_source_delivery := p_to_demand_delivery_id;
1354 l_to_rsv_rec.reservation_uom_code := p_to_reservation_uom_code;
1355 l_to_rsv_rec.reservation_quantity := p_to_reservation_quantity;
1356 l_to_rsv_rec.secondary_uom_code := p_to_secondary_uom_code; -- INVCONV
1357 l_to_rsv_rec.secondary_reservation_quantity := p_to_secondary_rsv_quantity; -- INVCONV
1358 l_to_rsv_rec.project_id := p_to_project_id;
1359 l_to_rsv_rec.task_id := p_to_task_id;
1360 -- Bug 16467863 MUOM Fulfillment Project
1361 IF p_from_demand_line_id IS NOT NULL AND p_from_organization_id IS NOT NULL THEN
1362 inv_utilities.get_inv_fulfillment_base(
1363 p_source_line_id => p_from_demand_line_id,
1364 p_demand_source_type_id => p_from_demand_type_id,
1365 p_org_id => p_from_organization_id,
1366 x_fulfillment_base => l_fulfill_base
1367 );
1368 END IF;
1369
1370 IF l_fulfill_base = 'S' AND p_from_primary_rsv_quantity is NOT NULL
1371 AND p_from_secondary_rsv_quantity = p_to_secondary_rsv_quantity THEN
1372 l_to_rsv_rec.primary_reservation_quantity := p_from_primary_rsv_quantity;
1373 END IF;
1374 -- End of Bug 16467863
1375 inv_reservation_pvt.transfer_reservation
1376 (
1377 p_api_version_number => 1.0
1378 , p_init_msg_lst => p_init_msg_lst
1379 , x_return_status => l_return_status
1380 , x_msg_count => x_msg_count
1381 , x_msg_data => x_msg_data
1382 , p_original_rsv_rec => l_orig_rsv_rec
1383 , p_to_rsv_rec => l_to_rsv_rec
1384 , p_original_serial_number => l_dummy_serial_number
1385 , p_validation_flag => p_validation_flag
1386 , x_reservation_id => x_to_reservation_id
1387 );
1388
1389 IF l_return_status = fnd_api.g_ret_sts_error THEN
1390 RAISE fnd_api.g_exc_error;
1391 END IF ;
1392
1393 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1394 RAISE fnd_api.g_exc_unexpected_error;
1395 END IF;
1396
1397 x_return_status := l_return_status;
1398
1399 EXCEPTION
1400
1401 WHEN fnd_api.g_exc_error THEN
1402 x_return_status := fnd_api.g_ret_sts_error;
1403
1404 -- Get message count and data
1405 fnd_msg_pub.count_and_get
1406 ( p_count => x_msg_count
1407 , p_data => x_msg_data
1408 , p_encoded => 'F'
1409 );
1410
1411 WHEN fnd_api.g_exc_unexpected_error THEN
1412 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1413
1414 -- Get message count and data
1415 fnd_msg_pub.count_and_get
1416 ( p_count => x_msg_count
1417 , p_data => x_msg_data
1418 , p_encoded => 'F'
1419 );
1420
1421 WHEN OTHERS THEN
1422 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1423
1424 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1425 THEN
1426 fnd_msg_pub.add_exc_msg
1427 ( g_pkg_name
1428 , l_api_name
1429 );
1430 END IF;
1431
1432 -- Get message count and data
1433 fnd_msg_pub.count_and_get
1434 ( p_count => x_msg_count
1435 , p_data => x_msg_data
1436 , p_encoded => 'F'
1437 );
1438
1439 END transfer_demand;
1440 --
1441 PROCEDURE query_reservation
1442 (
1443 p_api_version_number IN NUMBER
1444 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1445 , x_return_status OUT NOCOPY VARCHAR2
1446 , x_msg_count OUT NOCOPY NUMBER
1447 , x_msg_data OUT NOCOPY VARCHAR2
1448 , p_reservation_id IN NUMBER
1449 , p_lock_records IN VARCHAR2 DEFAULT fnd_api.g_false
1450 , p_sort_by_req_date IN NUMBER
1451 , p_cancel_order_mode IN NUMBER
1452 , x_mtl_reservation_tbl
1453 OUT NOCOPY inv_reservation_global.mtl_reservation_tbl_type
1454 , x_mtl_reservation_tbl_count OUT NOCOPY NUMBER
1455 , x_error_code OUT NOCOPY NUMBER
1456 ) IS
1457 l_api_version_number CONSTANT NUMBER := 1.0;
1458 l_api_name CONSTANT VARCHAR2(30) := 'Query_Reservation';
1459 l_return_status VARCHAR2(1) := fnd_api.g_ret_sts_success;
1460 l_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
1461 BEGIN
1462 -- Standard call to check for call compatibility
1463 IF NOT fnd_api.compatible_api_call(l_api_version_number
1464 , p_api_version_number
1465 , l_api_name
1466 , G_PKG_NAME
1467 ) THEN
1468 RAISE fnd_api.g_exc_unexpected_error;
1469 END IF;
1470 --
1471 -- Initialize message list.
1472 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1473 fnd_msg_pub.initialize;
1474 END IF;
1475 --
1476 l_rsv_rec.reservation_id := p_reservation_id;
1477 inv_reservation_pub.query_reservation
1478 ( p_api_version_number => 1.0
1479 , p_init_msg_lst => fnd_api.g_false
1480 , x_return_status => l_return_status
1481 , x_msg_count => x_msg_count
1482 , x_msg_data => x_msg_data
1483 , p_query_input => l_rsv_rec
1484 , p_lock_records => p_lock_records
1485 , p_sort_by_req_date => p_sort_by_req_date
1486 , p_cancel_order_mode => p_cancel_order_mode
1487 , x_mtl_reservation_tbl => x_mtl_reservation_tbl
1488 , x_mtl_reservation_tbl_count => x_mtl_reservation_tbl_count
1489 , x_error_code => x_error_code
1490 );
1491 IF l_return_status = fnd_api.g_ret_sts_error THEN
1492 RAISE fnd_api.g_exc_error;
1493 END IF ;
1494
1495 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1496 RAISE fnd_api.g_exc_unexpected_error;
1497 END IF;
1498
1499 x_return_status := l_return_status;
1500
1501 EXCEPTION
1502
1503 WHEN fnd_api.g_exc_error THEN
1504 x_return_status := fnd_api.g_ret_sts_error;
1505
1506 -- Get message count and data
1507 fnd_msg_pub.count_and_get
1508 ( p_count => x_msg_count
1509 , p_data => x_msg_data
1510 , p_encoded => 'F'
1511 );
1512
1513 WHEN fnd_api.g_exc_unexpected_error THEN
1514 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1515
1516 -- Get message count and data
1517 fnd_msg_pub.count_and_get
1518 ( p_count => x_msg_count
1519 , p_data => x_msg_data
1520 , p_encoded => 'F'
1521 );
1522
1523 WHEN OTHERS THEN
1524 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1525
1526 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1527 THEN
1528 fnd_msg_pub.add_exc_msg
1529 ( g_pkg_name
1530 , l_api_name
1531 );
1532 END IF;
1533
1534 -- Get message count and data
1535 fnd_msg_pub.count_and_get
1536 ( p_count => x_msg_count
1537 , p_data => x_msg_data
1538 , p_encoded => 'F'
1539 );
1540 END query_reservation;
1541
1542 PROCEDURE get_reservable_quantity
1543 (
1544 p_api_version_number IN NUMBER
1545 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1546 , x_return_status OUT NOCOPY VARCHAR2
1547 , x_msg_count OUT NOCOPY NUMBER
1548 , x_msg_data OUT NOCOPY VARCHAR2
1549 , p_reservation_id IN NUMBER
1550 , p_reservation_uom_code IN VARCHAR2
1551 , p_demand_type_id IN NUMBER
1552 , p_demand_name IN VARCHAR2
1553 , p_demand_header_id IN NUMBER
1554 , p_demand_line_id IN NUMBER
1555 , p_demand_delivery_id IN NUMBER DEFAULT NULL
1556 , p_Project_Id In Number
1557 , p_Task_ID In Number
1558 , x_reservable_quantity OUT NOCOPY NUMBER
1559 , x_reservation_margin_above OUT NOCOPY NUMBER -- INVCONV
1560 ) is
1561 l_api_version_number CONSTANT NUMBER := 1.0;
1562 l_api_name CONSTANT VARCHAR2(30) := 'get_reservable_quantity';
1563
1564 --l_line_rec OE_Order_PUB.Line_Rec_Type;
1565 l_ordered_quantity_rsv_uom NUMBER := 0;
1566 l_primary_uom_code VARCHAR2(3);
1567 l_primary_reserved_quantity NUMBER := 0;
1568 l_reserved_quantity NUMBER := 0;
1569 l_ship_tolerance_above NUMBER; -- INVCONV
1570
1571 l_org_id NUMBER;
1572 l_line_rec_inventory_item_id oe_order_lines_all.inventory_item_id%TYPE;
1573 l_line_rec_ordered_quantity oe_order_lines_all.ordered_quantity%TYPE;
1574 l_line_rec_order_quantity_uom oe_order_lines_all.order_quantity_uom%TYPE;
1575 l_line_rec_org_id oe_order_lines_all.org_id%TYPE;
1576 -- R12 Project : SU
1577 lx_Qty_Available Number;
1578
1579 lx_Qty_Available2 Number;
1580 l_Reservable_Quantity2 number;
1581 BEGIN
1582 -- Initialize return status
1583 x_return_status := fnd_api.g_ret_sts_success;
1584
1585 -- Standard call to check for call compatibility
1586 IF NOT fnd_api.compatible_api_call(l_api_version_number
1587 , p_api_version_number
1588 , l_api_name
1589 , G_PKG_NAME
1590 ) THEN
1591 RAISE fnd_api.g_exc_unexpected_error;
1592 END IF;
1593 --
1594 -- Initialize message list.
1595 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1596 fnd_msg_pub.initialize;
1597 END IF;
1598
1599 if p_demand_type_id in (inv_reservation_global.g_source_type_oe,
1600 inv_reservation_global.g_source_type_internal_ord,
1601 inv_reservation_global.g_source_type_rma) then
1602
1603 -- Fetch row from oe_order_lines
1604 --l_line_rec := OE_Line_Util.Query_Row(p_line_id => p_demand_line_id);
1605 -- Because oe_lines_util.query_row was changed to private, so we need to
1606 -- query order lines manually
1607
1608 -- Fix bug 2024374, remove the constraint on org_id,
1609 -- when the sales order is in another operating unit
1610 -- it will not get the correct org.
1611 /*l_org_id := OE_GLOBALS.G_ORG_ID;
1612 if l_org_id IS NULL THEN
1613 OE_GLOBALS.Set_Context;
1614 l_org_id := OE_GLOBALS.G_ORG_ID;
1615 end if;*/
1616 --INVCONV - Retrieve ship tolerance above for lot indivisible scenarios
1617 SELECT inventory_item_id, ordered_quantity, order_quantity_uom, ship_from_org_id,
1618 ship_tolerance_above
1619 INTO l_line_rec_inventory_item_id,
1620 l_line_rec_ordered_quantity,
1621 l_line_rec_order_quantity_uom,
1622 l_line_rec_org_id,
1623 l_ship_tolerance_above
1624 FROM oe_order_lines_all
1625 WHERE line_id = p_demand_line_id ;
1626 --AND NVL(ORG_ID,NVL(l_org_id,0))= NVL(l_org_id,0) ;
1627
1628 -- Convert order quantity into reservation uom code
1629 l_ordered_quantity_rsv_uom :=
1630 inv_convert.inv_um_convert
1631 (
1632 l_line_rec_inventory_item_id,
1633 NULL,
1634 l_line_rec_ordered_quantity,
1635 l_line_rec_order_quantity_uom,
1636 p_reservation_uom_code,
1637 NULL,
1638 NULL);
1639
1640
1641 -- Fetch quantity reserved so far
1642 select nvl(sum(primary_reservation_quantity),0)
1643 into l_primary_reserved_quantity
1644 from mtl_reservations
1645 where demand_source_type_id = p_demand_type_id
1646 and demand_source_header_id = p_demand_header_id
1647 and demand_source_line_id = p_demand_line_id
1648 and reservation_id <> p_reservation_id;
1649
1650 if l_primary_reserved_quantity > 0 then
1651
1652 -- Get primary UOM
1653 select primary_uom_code
1654 into l_primary_uom_code
1655 from mtl_system_items
1656 where organization_id = l_line_rec_org_id
1657 and inventory_item_id = l_line_rec_inventory_item_id;
1658
1659 -- Convert primary reservation quantity into
1660 -- reservation uom code
1661 l_reserved_quantity :=
1662 inv_convert.inv_um_convert
1663 (
1664 l_line_rec_inventory_item_id,
1665 NULL,
1666 l_primary_reserved_quantity,
1667 l_primary_uom_code,
1668 p_reservation_uom_code,
1669 NULL,
1670 NULL);
1671 else
1672 l_reserved_quantity := 0;
1673 end if;
1674
1675 -- Quantity that can be still reserved
1676 x_reservable_quantity := l_ordered_quantity_rsv_uom -
1677 l_reserved_quantity;
1678 -- INVCONV
1679 -- Calculate the upper limit on the reservation using ship_tolerance above
1680 x_reservation_margin_above :=
1681 l_ordered_quantity_rsv_uom * NVL(l_ship_tolerance_above,0) / 100;
1682 -- R12 Project Changes : SU
1683 Else -- For any other demand call following API
1684 -- For any other Demand call following API
1685 Inv_Reservation_Avail_Pvt.Available_Demand_To_Reserve (
1686 x_Return_Status => x_Return_Status
1687 ,x_Msg_Count => x_Msg_Count
1688 ,X_Msg_Data => x_Msg_Data
1689 ,x_qty_Available_to_Reserve => x_Reservable_Quantity
1690 ,x_Qty_Available => lx_Qty_Available
1691 ,x_qty_available_to_reserve2 => l_Reservable_Quantity2
1692 ,x_qty_available2 => lx_Qty_Available2
1693 ,p_Demand_Source_Type_Id => p_Demand_Type_ID
1694 ,p_Demand_Source_Header_ID => p_Demand_HEader_ID
1695 ,p_Demand_Source_Line_ID => p_Demand_Line_Id
1696 ,p_Demand_Source_Line_Detail => p_Demand_Delivery_Id
1697 ,P_Project_Id => p_Project_Id
1698 ,p_Task_Id => P_Task_Id
1699 ,p_API_Version_Number => 1.0
1700 ,p_Init_Msg_Lst => p_Init_Msg_lst );
1701
1702 IF x_return_status = fnd_api.g_ret_sts_error THEN
1703 RAISE fnd_api.g_exc_error;
1704 END IF ;
1705
1706 IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1707 RAISE fnd_api.g_exc_unexpected_error;
1708 END IF;
1709 end if;
1710
1711 EXCEPTION
1712
1713 WHEN fnd_api.g_exc_error THEN
1714 x_return_status := fnd_api.g_ret_sts_error;
1715 x_reservable_quantity := 0;
1716
1717 -- Get message count and data
1718 fnd_msg_pub.count_and_get
1719 ( p_count => x_msg_count
1720 , p_data => x_msg_data
1721 , p_encoded => 'F'
1722 );
1723
1724 WHEN fnd_api.g_exc_unexpected_error THEN
1725 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1726 x_reservable_quantity := 0;
1727
1728 -- Get message count and data
1729 fnd_msg_pub.count_and_get
1730 ( p_count => x_msg_count
1731 , p_data => x_msg_data
1732 , p_encoded => 'F'
1733 );
1734
1735 WHEN OTHERS THEN
1736 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1737 x_reservable_quantity := 0;
1738
1739 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1740 THEN
1741 fnd_msg_pub.add_exc_msg
1742 ( g_pkg_name
1743 , l_api_name
1744 );
1745 END IF;
1746
1747 -- Get message count and data
1748 fnd_msg_pub.count_and_get
1749 ( p_count => x_msg_count
1750 , p_data => x_msg_data
1751 , p_encoded => 'F'
1752 );
1753 END get_reservable_quantity;
1754
1755 -- GME CONVERGENCE BEGIN
1756 PROCEDURE create_move_order_header
1757 (
1758 p_api_version_number IN NUMBER
1759 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1760 , p_organization_id IN NUMBER
1761 , x_return_status OUT NOCOPY VARCHAR2
1762 , x_msg_count OUT NOCOPY NUMBER
1763 , x_msg_data OUT NOCOPY VARCHAR2
1764 , x_header_id OUT NOCOPY NUMBER
1765 ) is
1766 l_api_version_number CONSTANT NUMBER := 1.0;
1767 l_api_name CONSTANT VARCHAR2(30) := 'create_move_order_header';
1768
1769 l_user_id NUMBER := fnd_global.user_id;
1770 l_return_status VARCHAR2(1);
1771 l_in_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
1772 l_in_trohdr_val_rec INV_MOVE_ORDER_PUB.Trohdr_Val_Rec_Type;
1773 l_out_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
1774 l_out_trohdr_val_rec INV_MOVE_ORDER_PUB.Trohdr_Val_Rec_Type;
1775
1776 BEGIN
1777 -- Initialize return status
1778 x_return_status := fnd_api.g_ret_sts_success;
1779
1780 -- Standard call to check for call compatibility
1781 IF NOT fnd_api.compatible_api_call(l_api_version_number
1782 , p_api_version_number
1783 , l_api_name
1784 , G_PKG_NAME
1785 ) THEN
1786 RAISE fnd_api.g_exc_unexpected_error;
1787 END IF;
1788 --
1789 -- Initialize message list.
1790 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1791 fnd_msg_pub.initialize;
1792 END IF;
1793
1794 l_in_trohdr_rec.organization_id := p_organization_id;
1795 l_in_trohdr_rec.move_order_type := 8;
1796 l_in_trohdr_rec.operation := inv_globals.g_opr_create;
1797 l_in_trohdr_rec.request_number := FND_API.G_MISS_CHAR;
1798 l_in_trohdr_rec.header_id := FND_API.G_MISS_NUM;
1799 l_in_trohdr_rec.creation_date := SYSDATE;
1800 l_in_trohdr_rec.created_by := l_user_id;
1801 l_in_trohdr_rec.last_update_date := SYSDATE;
1802 l_in_trohdr_rec.last_updated_by := l_user_id;
1803 inv_move_order_pub.create_move_order_header
1804 (p_api_version_number => 1.0,
1805 p_init_msg_list => FND_API.G_FALSE,
1806 p_return_values => FND_API.G_FALSE,
1807 p_commit => FND_API.G_FALSE,
1808 x_return_status => l_return_status,
1809 x_msg_count => x_msg_count,
1810 x_msg_data => x_msg_data,
1811 p_trohdr_rec => l_in_trohdr_rec,
1812 p_trohdr_val_rec => l_in_trohdr_val_rec,
1813 x_trohdr_rec => l_out_trohdr_rec,
1814 x_trohdr_val_rec => l_out_trohdr_val_rec,
1815 p_validation_flag => inv_move_order_pub.g_validation_yes);
1816
1817 IF l_return_status = fnd_api.g_ret_sts_error THEN
1818 RAISE fnd_api.g_exc_error;
1819 END IF ;
1820
1821 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1822 RAISE fnd_api.g_exc_unexpected_error;
1823 END IF;
1824
1825 x_header_id := l_out_trohdr_rec.header_id;
1826
1827 EXCEPTION
1828
1829 WHEN fnd_api.g_exc_error THEN
1830 x_return_status := fnd_api.g_ret_sts_error;
1831
1832 -- Get message count and data
1833 fnd_msg_pub.count_and_get
1834 ( p_count => x_msg_count
1835 , p_data => x_msg_data
1836 , p_encoded => 'F'
1837 );
1838
1839 WHEN fnd_api.g_exc_unexpected_error THEN
1840 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1841
1842 -- Get message count and data
1843 fnd_msg_pub.count_and_get
1844 ( p_count => x_msg_count
1845 , p_data => x_msg_data
1846 , p_encoded => 'F'
1847 );
1848
1849 WHEN OTHERS THEN
1850 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1851
1852 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
1853 THEN
1854 fnd_msg_pub.add_exc_msg
1855 ( g_pkg_name
1856 , l_api_name
1857 );
1858 END IF;
1859
1860 -- Get message count and data
1861 fnd_msg_pub.count_and_get
1862 ( p_count => x_msg_count
1863 , p_data => x_msg_data
1864 , p_encoded => 'F'
1865 );
1866 END create_move_order_header;
1867
1868 PROCEDURE create_move_order_line
1869 (
1870 p_api_version_number IN NUMBER
1871 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
1872 , p_organization_id IN NUMBER
1873 , p_move_order_header_id IN NUMBER
1874 , p_inventory_item_id IN NUMBER
1875 , p_quantity IN NUMBER
1876 , p_uom_code IN VARCHAR2
1877 , p_secondary_quantity IN NUMBER DEFAULT NULL
1878 , p_secondary_uom IN VARCHAR2 DEFAULT NULL
1879 , p_revision IN VARCHAR2
1880 , p_date_required IN DATE
1881 , p_source_type_id IN NUMBER
1882 , p_source_id IN NUMBER
1883 , p_source_line_id IN NUMBER
1884 , p_grade_code IN VARCHAR2
1885 , x_return_status OUT NOCOPY VARCHAR2
1886 , x_msg_count OUT NOCOPY NUMBER
1887 , x_msg_data OUT NOCOPY VARCHAR2
1888 , x_line_id OUT NOCOPY NUMBER
1889 ) is
1890 l_api_version_number CONSTANT NUMBER := 1.0;
1891 l_api_name CONSTANT VARCHAR2(30) := 'create_move_order_line';
1892
1893 l_user_id NUMBER := fnd_global.user_id;
1894 l_return_status VARCHAR2(1);
1895 l_in_trolin_tbl INV_MOVE_ORDER_PUB.Trolin_Tbl_Type;
1896 l_in_trolin_val_tbl INV_MOVE_ORDER_PUB.Trolin_Val_Tbl_Type;
1897 l_out_trolin_tbl INV_MOVE_ORDER_PUB.Trolin_Tbl_Type;
1898 l_out_trolin_val_tbl INV_MOVE_ORDER_PUB.Trolin_Val_Tbl_Type;
1899
1900 BEGIN
1901 -- Initialize return status
1902 x_return_status := fnd_api.g_ret_sts_success;
1903
1904 -- Standard call to check for call compatibility
1905 IF NOT fnd_api.compatible_api_call(l_api_version_number
1906 , p_api_version_number
1907 , l_api_name
1908 , G_PKG_NAME
1909 ) THEN
1910 RAISE fnd_api.g_exc_unexpected_error;
1911 END IF;
1912 --
1913 -- Initialize message list.
1914 IF fnd_api.to_boolean(p_init_msg_lst) THEN
1915 fnd_msg_pub.initialize;
1916 END IF;
1917
1918 l_in_trolin_tbl(1).operation := inv_globals.g_opr_create;
1919 l_in_trolin_tbl(1).header_id := p_move_order_header_id;
1920 l_in_trolin_tbl(1).inventory_item_id := p_inventory_item_id;
1921 l_in_trolin_tbl(1).organization_id := p_organization_id;
1922 l_in_trolin_tbl(1).quantity := p_quantity;
1923 l_in_trolin_tbl(1).uom_code := p_uom_code;
1924 l_in_trolin_tbl(1).secondary_quantity := p_secondary_quantity;
1925 l_in_trolin_tbl(1).secondary_uom := p_secondary_uom;
1926 l_in_trolin_tbl(1).revision := p_revision;
1927 l_in_trolin_tbl(1).date_required := p_date_required;
1928 l_in_trolin_tbl(1).creation_date := SYSDATE;
1929 l_in_trolin_tbl(1).created_by := l_user_id;
1930 l_in_trolin_tbl(1).last_update_date := SYSDATE;
1931 l_in_trolin_tbl(1).last_updated_by := l_user_id;
1932 l_in_trolin_tbl(1).transaction_type_id := INV_GLOBALS.G_TYPE_XFER_ORDER_REPL_SUBXFR;
1933 l_in_trolin_tbl(1).transaction_source_type_id := p_source_type_id;
1934 l_in_trolin_tbl(1).txn_source_id := p_source_id;
1935 l_in_trolin_tbl(1).txn_source_line_id := p_source_line_id;
1936 l_in_trolin_tbl(1).grade_code := p_grade_code;
1937 -- For dual track items, secondary quantity may need to be zeroed.
1938 IF l_in_trolin_tbl(1).secondary_uom is NOT NULL AND
1939 l_in_trolin_tbl(1).secondary_quantity IS NULL THEN
1940 l_in_trolin_tbl(1).secondary_quantity := 0;
1941 END IF;
1942 -- bug 5671641 begin
1943 IF l_in_trolin_tbl(1).transaction_source_type_id = 2 then -- for sales order
1944 -- populate reference field as 'ORDER_LINE_ID_RSV'
1945 l_in_trolin_tbl(1).reference := 'ORDER_LINE_ID_RSV';
1946 l_in_trolin_tbl(1).reference_id := p_source_line_id;
1947 l_in_trolin_tbl(1).transaction_type_id := INV_GLOBALS.G_TYPE_TRANSFER_ORDER_STGXFR;
1948 END IF;
1949 -- bug 5671641 end
1950
1951 inv_move_order_pub.create_move_order_lines
1952 (p_api_version_number => 1.0,
1953 p_init_msg_list => FND_API.G_FALSE,
1954 p_return_values => FND_API.G_FALSE,
1955 p_commit => FND_API.G_FALSE,
1956 x_return_status => l_return_status,
1957 x_msg_count => x_msg_count,
1958 x_msg_data => x_msg_data,
1959 p_trolin_tbl => l_in_trolin_tbl,
1960 p_trolin_val_tbl => l_in_trolin_val_tbl,
1961 x_trolin_tbl => l_out_trolin_tbl,
1962 x_trolin_val_tbl => l_out_trolin_val_tbl,
1963 p_validation_flag => inv_move_order_pub.g_validation_yes);
1964
1965 IF l_return_status = fnd_api.g_ret_sts_error THEN
1966 RAISE fnd_api.g_exc_error;
1967 END IF ;
1968
1969 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
1970 RAISE fnd_api.g_exc_unexpected_error;
1971 END IF;
1972
1973 x_line_id := l_out_trolin_tbl(1).line_id;
1974
1975 EXCEPTION
1976
1977 WHEN fnd_api.g_exc_error THEN
1978 x_return_status := fnd_api.g_ret_sts_error;
1979
1980 -- Get message count and data
1981 fnd_msg_pub.count_and_get
1982 ( p_count => x_msg_count
1983 , p_data => x_msg_data
1984 , p_encoded => 'F'
1985 );
1986
1987 WHEN fnd_api.g_exc_unexpected_error THEN
1988 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1989
1990 -- Get message count and data
1991 fnd_msg_pub.count_and_get
1992 ( p_count => x_msg_count
1993 , p_data => x_msg_data
1994 , p_encoded => 'F'
1995 );
1996
1997 WHEN OTHERS THEN
1998 x_return_status := fnd_api.g_ret_sts_unexp_error ;
1999
2000 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
2001 THEN
2002 fnd_msg_pub.add_exc_msg
2003 ( g_pkg_name
2004 , l_api_name
2005 );
2006 END IF;
2007
2008 -- Get message count and data
2009 fnd_msg_pub.count_and_get
2010 ( p_count => x_msg_count
2011 , p_data => x_msg_data
2012 , p_encoded => 'F'
2013 );
2014 END create_move_order_line;
2015
2016 PROCEDURE delete_move_order
2017 (
2018 p_api_version_number IN NUMBER
2019 , p_init_msg_lst IN VARCHAR2 DEFAULT fnd_api.g_false
2020 , p_move_order_header_id IN NUMBER
2021 , x_return_status OUT NOCOPY VARCHAR2
2022 , x_msg_count OUT NOCOPY NUMBER
2023 , x_msg_data OUT NOCOPY VARCHAR2
2024 ) is
2025 l_api_version_number CONSTANT NUMBER := 1.0;
2026 l_api_name CONSTANT VARCHAR2(30) := 'delete_move_order';
2027
2028 l_user_id NUMBER := fnd_global.user_id;
2029 l_return_status VARCHAR2(1);
2030 l_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
2031 l_in_trohdr_rec INV_MOVE_ORDER_PUB.Trohdr_Rec_Type;
2032 l_trohdr_val_rec INV_MOVE_ORDER_PUB.Trohdr_Val_Rec_Type;
2033 l_trolin_tbl INV_MOVE_ORDER_PUB.Trolin_Tbl_Type;
2034 l_trolin_val_tbl INV_MOVE_ORDER_PUB.Trolin_Val_Tbl_Type;
2035
2036 BEGIN
2037 -- Initialize return status
2038 x_return_status := fnd_api.g_ret_sts_success;
2039
2040 -- Standard call to check for call compatibility
2041 IF NOT fnd_api.compatible_api_call(l_api_version_number
2042 , p_api_version_number
2043 , l_api_name
2044 , G_PKG_NAME
2045 ) THEN
2046 RAISE fnd_api.g_exc_unexpected_error;
2047 END IF;
2048 --
2049 -- Initialize message list.
2050 IF fnd_api.to_boolean(p_init_msg_lst) THEN
2051 fnd_msg_pub.initialize;
2052 END IF;
2053
2054 l_in_trohdr_rec.operation := inv_globals.g_opr_delete;
2055 l_in_trohdr_rec.header_id := p_move_order_header_id;
2056 inv_move_order_pub.process_move_order
2057 (p_api_version_number => 1.0,
2058 p_init_msg_list => FND_API.G_TRUE,
2059 p_return_values => FND_API.G_FALSE,
2060 p_commit => FND_API.G_FALSE,
2061 x_return_status => l_return_status,
2062 x_msg_count => x_msg_count,
2063 x_msg_data => x_msg_data,
2064 p_trohdr_rec => l_in_trohdr_rec,
2065 x_trohdr_rec => l_trohdr_rec,
2066 x_trohdr_val_rec => l_trohdr_val_rec,
2067 x_trolin_tbl => l_trolin_tbl,
2068 x_trolin_val_tbl => l_trolin_val_tbl);
2069
2070 IF l_return_status = fnd_api.g_ret_sts_error THEN
2071 RAISE fnd_api.g_exc_error;
2072 END IF ;
2073
2074 IF l_return_status = fnd_api.g_ret_sts_unexp_error THEN
2075 RAISE fnd_api.g_exc_unexpected_error;
2076 END IF;
2077
2078
2079 EXCEPTION
2080
2081 WHEN fnd_api.g_exc_error THEN
2082 x_return_status := fnd_api.g_ret_sts_error;
2083
2084 -- Get message count and data
2085 fnd_msg_pub.count_and_get
2086 ( p_count => x_msg_count
2087 , p_data => x_msg_data
2088 , p_encoded => 'F'
2089 );
2090
2091 WHEN fnd_api.g_exc_unexpected_error THEN
2092 x_return_status := fnd_api.g_ret_sts_unexp_error ;
2093
2094 -- Get message count and data
2095 fnd_msg_pub.count_and_get
2096 ( p_count => x_msg_count
2097 , p_data => x_msg_data
2098 , p_encoded => 'F'
2099 );
2100
2101 WHEN OTHERS THEN
2102 x_return_status := fnd_api.g_ret_sts_unexp_error ;
2103
2104 IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
2105 THEN
2106 fnd_msg_pub.add_exc_msg
2107 ( g_pkg_name
2108 , l_api_name
2109 );
2110 END IF;
2111
2112 -- Get message count and data
2113 fnd_msg_pub.count_and_get
2114 ( p_count => x_msg_count
2115 , p_data => x_msg_data
2116 , p_encoded => 'F'
2117 );
2118 END delete_move_order;
2119 -- GME CONVERGENCE END
2120
2121 --bug 4097848
2122
2123 FUNCTION demand_source_line_number(
2124 p_line_number IN NUMBER
2125 , p_shipment_number IN NUMBER
2126 , p_option_number IN NUMBER
2127 , p_component_number IN NUMBER
2128 , p_service_number IN NUMBER
2129 )
2130 RETURN VARCHAR2
2131 IS
2132
2133 x_concat_line_number VARCHAR2(256);
2134
2135
2136 BEGIN
2137 IF p_service_number is not null then
2138 IF p_option_number is not null then
2139 IF p_component_number is not null then
2140 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2141 p_option_number||'.'||p_component_number||'.'||
2142 p_service_number;
2143 ELSE
2144 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2145 p_option_number||'..'||p_service_number;
2146 END IF;
2147
2148 --- if option is not attached
2149 ELSE
2150 IF p_component_number is not null then
2151
2152 x_concat_line_number := p_line_number||'.'||p_shipment_number||'..'||
2153 p_component_number||'.'||p_service_number;
2154 ELSE
2155 x_concat_line_number := p_line_number||'.'||p_shipment_number||
2156 '...'||p_service_number;
2157 END IF;
2158
2159 END IF; /* if option number is not null */
2160 -- if the service number is null
2161 ELSE
2162 IF p_option_number is not null then
2163 IF p_component_number is not null then
2164 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2165 p_option_number||'.'||p_component_number;
2166 ELSE
2167 x_concat_line_number := p_line_number||'.'||p_shipment_number||'.'||
2168 p_option_number;
2169 END IF;
2170
2171 --- if option is not attached
2172 ELSE
2173 IF p_component_number is not null then
2174 x_concat_line_number := p_line_number||'.'||p_shipment_number||'..'||
2175 p_component_number;
2176 ELSE
2177
2178 IF (p_line_number is NULL and p_shipment_number is NULL ) THEN
2179 x_concat_line_number := NULL;
2180 ELSE
2181 x_concat_line_number := p_line_number||'.'||p_shipment_number;
2182 END IF;
2183 END IF;
2184
2185 END IF; /* if option number is not null */
2186
2187 END IF; /* if service number is not null */
2188
2189 return x_concat_line_number;
2190
2191 EXCEPTION WHEN OTHERS THEN
2192 return NULL;
2193
2194 END demand_source_line_number;
2195
2196 END inv_reservation_form_pkg ;