DBA Data[Home] [Help]

PACKAGE BODY: APPS.GMI_RESERVATION_PUB

Source


1 PACKAGE BODY GMI_Reservation_PUB AS
2 /*  $Header: GMIPRSVB.pls 120.0 2005/05/25 16:00:01 appldev noship $
3  +=========================================================================+
4  |                Copyright (c) 2000 Oracle Corporation                    |
5  |                        TVP, Reading, England                            |
6  |                         All rights reserved                             |
7  +=========================================================================+
8  | FILENAME                                                                |
9  |    GMIPRSVS.pls                                                         |
10  |                                                                         |
11  | DESCRIPTION                                                             |
12  |     This package contains public procedures relating to OPM             |
13  |     reservation.                                                        |
14  |                                                                         |
15  | - Query_Reservation                                                     |
16  | - Create_Reservation                                                    |
17  | - Update_Reservation                                                    |
18  | - Delete_Reservation                                                    |
19  | - Transfer_Reservation                                                  |
20  |                                                                         |
21  | HISTORY                                                                 |
22  |     21-FEB-2000  odaboval        Created                                |
23  |   	                                                                   |
24  | B1479751 odaboval 15-Nov-2000 : Removed all variable x_msg_data from    |
25  |   	     any GMI_Reservation_Util.PrintLn.                             |
26  |   	     And removed all FND_MSG_PUB.Get calls (at public level)       |
27  | 03-OCT-2001  odaboval, local fix for bug 2025611                        |
28  |                        Call procedure Check_Shipping_Details            |
29  |  As a local fix, this is now removed.                                   |
30  |   	                                                                   |
31  |   	                                                                   |
32  |   	                                                                   |
33  |   	                                                                   |
34  |   	                                                                   |
35  +=========================================================================+
36   API Name  : GMI_Reservation_PUB
37   Type      : Global - Package Body
38   Function  : This package contains Global procedures used to
39               OPM reservation process.
40  -
41   Pre-reqs  : N/A
42   Parameters: Per function
43 
44   Current Vers  : 1.0
45 */
46 
47 /*  Global variables   */
48 G_PKG_NAME      CONSTANT  VARCHAR2(30):='GMI_Reservation_PUB';
49 
50 
51 /*  Api start of comments
52  +==========================================================================+
53  | PROCEDURE NAME                                                           |
54  |    Query_Reservation                                                     |
55  |                                                                          |
56  | TYPE                                                                     |
57  |    Global                                                                |
58  |                                                                          |
59  | USAGE                                                                    |
60  |   Query reservations included in table IC_TRAN_PND.                      |
61  |   If found, fetch data into a table of rec_type.                         |
62  |                                                                          |
63  | DESCRIPTION                                                              |
64  |   Query reservations included in table IC_TRAN_PND.                      |
65  |   If found, fetch data into a table of rec_type.                         |
66  |                                                                          |
67  | PARAMETERS                                                               |
68  |    p_api_version_number        IN  NUMBER       - API version            |
69  |    p_init_msg_lst              IN  VARCHAR2     - Msg init               |
70  |    x_return_status             OUT NOCOPY VARCHAR2     - Return Status   |
71  |    x_msg_count                 OUT NOCOPY NUMBER       -                 |
72  |    x_msg_data                  OUT NOCOPY VARCHAR2     -                 |
73  |    p_validation_flag           IN  VARCHAR2     -                        |
74  |    p_query_input               IN  rec_type     -                        |
75  |    p_lock_records              IN  VARCHAR2     -                        |
76  |    x_mtl_reservation_tbl       OUT NOCOPY rec_type     -                 |
77  |    x_mtl_reservation_tbl_count OUT NOCOPY NUMBER       -                 |
78  |    x_error_code                OUT NOCOPY NUMBER       -                 |
79  |                                                                          |
80  | RETURNS                                                                  |
81  |    None                                                                  |
82  |                                                                          |
83  | HISTORY                                                                  |
84  |     21-FEB-2000  odaboval        Created                                 |
85  |                                                                          |
86  +==========================================================================+
87   Api end of comments
88 */
89 PROCEDURE Query_Reservation
90   (
91      p_api_version_number            IN  NUMBER
92    , p_init_msg_lst                  IN  VARCHAR2 DEFAULT fnd_api.g_false
93    , x_return_status                 OUT NOCOPY VARCHAR2
94    , x_msg_count                     OUT NOCOPY NUMBER
95    , x_msg_data                      OUT NOCOPY VARCHAR2
96    , p_validation_flag               IN  VARCHAR2 DEFAULT FND_API.G_TRUE
97    , p_query_input                   IN  inv_reservation_global.mtl_reservation_rec_type
98    , p_lock_records                  IN  VARCHAR2 DEFAULT fnd_api.g_false
99    , p_sort_by_req_date              IN  NUMBER   DEFAULT inv_reservation_global.g_query_no_sort
100    , p_cancel_order_mode             IN  NUMBER   DEFAULT inv_reservation_global.g_cancel_order_no
101    , x_mtl_reservation_tbl           OUT NOCOPY inv_reservation_global.mtl_reservation_tbl_type
102    , x_mtl_reservation_tbl_count     OUT NOCOPY NUMBER
103    , x_error_code                    OUT NOCOPY NUMBER
104    ) IS
105 
106 l_api_name           CONSTANT VARCHAR2 (30) := 'Query_Reservation';
107 
108 BEGIN
109 
110 /*  Initialize API return status to success   */
111 x_return_status := FND_API.G_RET_STS_SUCCESS;
112 
113 GMI_Reservation_Util.PrintLn('(opm_dbg) in proc GMI_Reservation_PUB.query_reservation ');
114 
115 GMI_Reservation_Util.PrintLn('(opm_dbg) in QueryPub org_id='||p_query_input.organization_id);
116 GMI_Reservation_Util.PrintLn('(opm_dbg) in QueryPub header='||p_query_input.demand_source_header_id);
117 GMI_Reservation_Util.PrintLn('(opm_dbg) in QueryPub line_id='||p_query_input.demand_source_line_id);
118 /* =====================================================================
119   Check the validation flag :
120   If validation flag is G_TRUE, then check
121                           ( used if another process calls the procedure)
122   If validation flag is NONE, then no check.
123                           ( used if the call comes from another GMI_reservation)
124  =======================================================================  */
125 
126 GMI_Reservation_Util.PrintLn('(opm_dbg) in proc PUB q : before Check_Missing : flag='||p_validation_flag||', G_TRUE='||FND_API.G_TRUE);
127 IF (p_validation_flag = FND_API.G_TRUE)
128 THEN
129    /* ==========================================================================
130      Call Data Validation
131      =========================================================================*/
132    GMI_Reservation_Util.Check_Missing(
133         p_event                     => 'QUERY'
134       , p_rec_to_check              => p_query_input
135       , x_return_status	            => x_return_status
136       , x_msg_count                 => x_msg_count
137       , x_msg_data                  => x_msg_data
138       );
139 
140 GMI_Reservation_Util.PrintLn('(opm_dbg) in proc PUB q : after Check_Missing : return='||x_return_status||', Succes='||FND_API.G_RET_STS_SUCCESS);
141    IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
142       FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
143       FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_Util.Check_Missing');
144       FND_MESSAGE.Set_Token('WHERE', 'Query_Reservation');
145       FND_MSG_PUB.Add;
146       raise FND_API.G_EXC_ERROR;
147    END IF;
148 
149 END IF;
150 
151 /* ==========================================================================
152   Call The private query_reservation
153 ============================================================================= */
154 GMI_Reservation_Util.PrintLn('(opm_dbg) in GMI_Reservation_PUB.query_reservation before calling PVT');
155 
156 GMI_Reservation_PVT.Query_Reservation(
157         x_return_status	            => x_return_status
158       , x_msg_count                 => x_msg_count
159       , x_msg_data                  => x_msg_data
160       , p_validation_flag           => p_validation_flag
161       , p_query_input	            => p_query_input
162       , p_lock_records	            => p_lock_records
163       , x_mtl_reservation_tbl	    => x_mtl_reservation_tbl
164       , x_mtl_reservation_tbl_count => x_mtl_reservation_tbl_count
165       , x_error_code                => x_error_code
166    );
167 
168 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
169    FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
170    FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_PVT.Query_Reservation');
171    FND_MESSAGE.Set_Token('WHERE', 'Query_Reservation');
172    FND_MSG_PUB.Add;
173    GMI_Reservation_Util.PrintLn('(opm_dbg) in end of PUB q ERROR:Returned by PVT q.');
174    RAISE FND_API.G_EXC_ERROR;
175 END IF;
176 
177 
178 
179 /* ============================================================================
180   Set the return values
181    =========================================================================  */
182 GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.query_reservation NO Error');
183 
184 EXCEPTION
185    WHEN FND_API.G_EXC_ERROR THEN
186       x_return_status := FND_API.G_RET_STS_ERROR;
187 
188       /*   Get message count and data   */
189       FND_MSG_Pub.Count_and_Get
190        (   p_count  => x_msg_count
191          , p_data  => x_msg_data
192        );
193 
194 /*       IF (x_msg_count > 1)
195        THEN
196          FND_MSG_PUB.Get(
197           p_data           => x_msg_data
198         , p_msg_index_out  => x_msg_count
199         );
200        END IF;
201 */
202       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.Query_Reservation Exp_Error count='||x_msg_count);
203 
204    WHEN OTHERS THEN
205       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
206 
207       FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
208                                , l_api_name
209                               );
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        );
216 
217 /*       IF (x_msg_count > 1)
218        THEN
219          FND_MSG_PUB.Get(
220           p_data           => x_msg_data
221         , p_msg_index_out  => x_msg_count
222         );
223        END IF;
224 */
225       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_Pub.Query_Reservation OTHERS count='||x_msg_count);
226 
227 END Query_Reservation;
228 
229 /*  Api start of comments
230  +==========================================================================+
231  | PROCEDURE NAME                                                           |
232  |    Create_Reservation                                                    |
233  |                                                                          |
234  | TYPE                                                                     |
235  |    Global                                                                |
236  |                                                                          |
237  | USAGE                                                                    |
238  |   Create reservation by calling OPM_Allocation manager.                  |
239  |                                                                          |
240  | DESCRIPTION                                                              |
241  |   Create reservation by calling OPM_Allocation manager.                  |
242  |                                                                          |
243  | PARAMETERS                                                               |
244  |    p_api_version_number        IN  NUMBER       - API version            |
245  |    p_init_msg_lst              IN  VARCHAR2     - Msg init               |
246  |    x_return_status             OUT NOCOPY VARCHAR2     - Return Status   |
247  |    x_msg_count                 OUT NOCOPY NUMBER       -                 |
248  |    x_msg_data                  OUT NOCOPY VARCHAR2     -                 |
249  |    p_validation_flag           IN  VARCHAR2     -                        |
250  |    p_rsv_rec                   IN  rec_type     -                        |
251  |    p_serial_number             IN  rec_type     -                        |
252  |    x_serial_number             OUT NOCOPY rec_type     -                 |
253  |    x_quantity_reserved         OUT NOCOPY rec_type     -                 |
254  |    x_reservation_id            OUT NOCOPY NUMBER       -                 |
255  |                                                                          |
256  | RETURNS                                                                  |
257  |    None                                                                  |
258  |                                                                          |
259  | HISTORY                                                                  |
260  |     21-FEB-2000  odaboval        Created                                 |
261  |                                                                          |
262  +==========================================================================+
263   Api end of comments
264 */
265 PROCEDURE Create_Reservation
266   (
267      p_api_version_number            IN  NUMBER
268    , p_init_msg_lst                  IN  VARCHAR2 DEFAULT fnd_api.g_false
269    , x_return_status                 OUT NOCOPY VARCHAR2
273    , p_rsv_rec                       IN  inv_reservation_global.mtl_reservation_rec_type
270    , x_msg_count                     OUT NOCOPY NUMBER
271    , x_msg_data                      OUT NOCOPY VARCHAR2
272    , p_validation_flag               IN  VARCHAR2 DEFAULT FND_API.G_TRUE
274    , p_serial_number                 IN  inv_reservation_global.serial_number_tbl_type
275    , x_serial_number                 OUT NOCOPY inv_reservation_global.serial_number_tbl_type
276    , p_partial_reservation_flag      IN  VARCHAR2 DEFAULT fnd_api.g_false
277    , p_force_reservation_flag        IN  VARCHAR2 DEFAULT fnd_api.g_false
278    , x_quantity_reserved             OUT NOCOPY NUMBER
279    , x_reservation_id                OUT NOCOPY NUMBER
280   ) IS
281 
282 l_api_name           CONSTANT VARCHAR2 (30) := 'Create_Reservation';
283 
284 BEGIN
285 
286 /*  Initialize API return status to success   */
287 x_return_status := FND_API.G_RET_STS_SUCCESS;
288 SAVEPOINT GMI_Create_Reservation_PUB;
289 
290 GMI_Reservation_Util.PrintLn('(opm_dbg) in proc GMI_Reservation_PUB.create_reservation ');
291 
292 /*======================================================================
293   Check the validation flag :
294   If validation flag is <>0, then check
295                         ( used if another process calls the procedure)
296   If validation flag is 0, then no check.
297                         ( used if the call comes from another OPM_reservation)
298 ========================================================================= */
299 
300 GMI_Reservation_Util.PrintLn('(opm_dbg) in proc PUB q : before Check_Missing : flag='||p_validation_flag||', G_TRUE='||FND_API.G_TRUE);
301 IF (p_validation_flag = FND_API.G_TRUE)
302 THEN
303    /*========================================================================
304      Call Data Validation
305    ========================================================================*/
306    GMI_Reservation_Util.Check_Missing(
307         p_event                     => 'CREATE'
308       , p_rec_to_check              => p_rsv_rec
309       , x_return_status             => x_return_status
310       , x_msg_count                 => x_msg_count
311       , x_msg_data                  => x_msg_data
312       );
313 
314    IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
315       FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
316       FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_Util.Check_Missing');
317       FND_MESSAGE.Set_Token('WHERE', 'Create_Reservation');
318       FND_MSG_PUB.Add;
319       GMI_Reservation_Util.PrintLn('(opm_dbg) in proc PUB c : after Check_Missing : Error='||x_return_status);
320       RAISE FND_API.G_EXC_ERROR;
321    END IF;
322 END IF;
323 
324 
325 /* =====================================================================
326   Call The private create_reservation
327 ======================================================================= */
328 GMI_Reservation_Util.PrintLn('(opm_dbg) in GMI_Reservation_PUB.create_reservation before calling PVT');
329 
330 GMI_Reservation_PVT.Create_Reservation(
331         x_return_status		       => x_return_status
332       , x_msg_count		       => x_msg_count
333       , x_msg_data		       => x_msg_data
334       , p_validation_flag              => p_validation_flag
335       , p_rsv_rec                      => p_rsv_rec
336       , p_serial_number                => p_serial_number
337       , x_serial_number                => x_serial_number
338       , p_partial_reservation_flag     =>  p_partial_reservation_flag
339       , p_force_reservation_flag       =>  p_force_reservation_flag
340       , x_quantity_reserved            => x_quantity_reserved
341       , x_reservation_id               => x_reservation_id
342    );
343 
344 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
345    FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
346    FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_PVT.Create_Reservation');
347    FND_MESSAGE.Set_Token('WHERE', 'Create_Reservation');
348    FND_MSG_PUB.Add;
349    GMI_Reservation_Util.PrintLn('(opm_dbg) in proc PUB c : after create(PVT) : Error='||x_return_status);
350    RAISE FND_API.G_EXC_ERROR;
351 END IF;
352 
353 /* ========================================================================
354   Set the return values
355 ========================================================================= */
356 GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.create_reservation : NO Error');
357 
358 
359 EXCEPTION
360    WHEN FND_API.G_EXC_ERROR THEN
361       GMI_Reservation_Util.PrintLn('in end of GMI_Reservation_PUB.create_reservation : Error');
362       ROLLBACK TO SAVEPOINT GMI_Create_Reservation_PUB;
363       x_return_status := FND_API.G_RET_STS_ERROR;
364 
365       /*   Get message count and data  */
366       FND_MSG_Pub.Count_and_Get
367        (   p_count  => x_msg_count
368          , p_data  => x_msg_data
369        );
370 
371       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_Pub.Create_Reservation Exp_Error count='||x_msg_count);
372 
373 
374    WHEN OTHERS THEN
375       GMI_Reservation_Util.PrintLn('in end of GMI_Reservation_PUB.create_reservation : ErrorOther');
376       ROLLBACK TO SAVEPOINT GMI_Create_Reservation_PUB;
377       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
378 
379       FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
380                                , l_api_name
381                               );
382 
383       /*   Get message count and data   */
387        );
384       FND_MSG_PUB.count_and_get
385        (  p_count => x_msg_count
386         , p_data  => x_msg_data
388 
389       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_Pub.Create_Reservation OTHERS count='||x_msg_count);
390 
391 END Create_Reservation;
392 
393 /*  Api start of comments
394  +==========================================================================+
395  | PROCEDURE NAME                                                           |
396  |    Update_Reservation                                                    |
397  |                                                                          |
398  | TYPE                                                                     |
399  |    Global                                                                |
400  |                                                                          |
401  | USAGE                                                                    |
402  |   Update reservation by calling OPM_Allocation manager.                  |
403  |                                                                          |
404  | DESCRIPTION                                                              |
405  |   Update reservation by calling OPM_Allocation manager.                  |
406  |                                                                          |
407  | PARAMETERS                                                               |
408  |    p_api_version_number        IN  NUMBER       - API version            |
409  |    p_init_msg_lst              IN  VARCHAR2     - Msg init               |
410  |    x_return_status             OUT NOCOPY VARCHAR2     - Return Status   |
411  |    x_msg_count                 OUT NOCOPY NUMBER       -                 |
412  |    x_msg_data                  OUT NOCOPY VARCHAR2     -                 |
413  |    p_validation_flag           IN  VARCHAR2     -                        |
414  |    p_original_rsv_rec          IN  rec_type     -                        |
415  |    p_to_rsv_rec                IN  rec_type     -                        |
416  |    p_serial_number             IN  rec_type     -                        |
417  |    x_serial_number             OUT NOCOPY rec_type     -                 |
418  |                                                                          |
419  | RETURNS                                                                  |
420  |    None                                                                  |
421  |                                                                          |
422  | HISTORY                                                                  |
423  |     21-FEB-2000  odaboval        Created                                 |
424  |                                                                          |
425  +==========================================================================+
426   Api end of comments
427 */
428 PROCEDURE Update_Reservation
429   (
430      p_api_version_number            IN  NUMBER
431    , p_init_msg_lst                  IN  VARCHAR2 DEFAULT fnd_api.g_false
432    , x_return_status                 OUT NOCOPY VARCHAR2
433    , x_msg_count                     OUT NOCOPY NUMBER
434    , x_msg_data                      OUT NOCOPY VARCHAR2
435    , p_validation_flag               IN  VARCHAR2 DEFAULT FND_API.G_TRUE
436    , p_original_rsv_rec              IN  inv_reservation_global.mtl_reservation_rec_type
437    , p_to_rsv_rec                    IN  inv_reservation_global.mtl_reservation_rec_type
438    , p_original_serial_number        IN  inv_reservation_global.serial_number_tbl_type
439    , p_to_serial_number              IN  inv_reservation_global.serial_number_tbl_type
440    ) IS
441 
442 l_api_name           CONSTANT VARCHAR2 (30) := 'Update_Reservation';
443 
444 BEGIN
445 
446 /*  Initialize API return status to success   */
447 x_return_status := FND_API.G_RET_STS_SUCCESS;
448 SAVEPOINT GMI_Update_Reservation_PUB;
449 
450 /* ==============================================================
451   Check the validation flag :
452   If validation flag is G_TRUE, then check
453                           ( used if another process calls the procedure)
454   If validation flag is NONE, then no check.
455                           ( used if the call comes from another GMI_reservation)
456 ================================================================ */
457 
458 GMI_Reservation_Util.PrintLn('(opm_dbg) in proc PUB q : before Check_Missing : flag='||p_validation_flag||', G_TRUE='||FND_API.G_TRUE);
459 IF (p_validation_flag = FND_API.G_TRUE)
460 THEN
461    /* =================================================================
462      Call Data Validation
463    ==================================================================== */
464    GMI_Reservation_Util.Check_Missing(
465         p_event                     => 'UPDATE'
466       , p_rec_to_check              => p_to_rsv_rec
467       , x_return_status	            => x_return_status
468       , x_msg_count                 => x_msg_count
469       , x_msg_data                  => x_msg_data
470       );
471 
472    IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
473       FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
474       FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_Util.Check_Missing');
475       FND_MESSAGE.Set_Token('WHERE', 'Update_Reservation');
476       FND_MSG_PUB.Add;
477       raise FND_API.G_EXC_ERROR;
478    END IF;
479 
480 END IF;
481 
482 /* =====================================================================
483   Call The private update_reservation_reservation
487 GMI_Reservation_PVT.Update_Reservation(
484 ====================================================================== */
485 GMI_Reservation_Util.PrintLn('(opm_dbg) in GMI_Reservation_PUB.update_reservation before calling PVT');
486 
488         x_return_status	            => x_return_status
489       , x_msg_count                 => x_msg_count
490       , x_msg_data                  => x_msg_data
491       , p_validation_flag           => p_validation_flag
492       , p_original_rsv_rec          => p_original_rsv_rec
493       , p_to_rsv_rec 	            => p_to_rsv_rec
494       , p_original_serial_number    => p_original_serial_number
495       , p_to_serial_number          => p_to_serial_number
496    );
497 
498 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
499    FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
500    FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_PVT.Update_Reservation');
501    FND_MESSAGE.Set_Token('WHERE', 'Update_Reservation');
502    FND_MSG_PUB.Add;
503    GMI_Reservation_Util.PrintLn('(opm_dbg) in end of PUB u: ERROR:Returned by PVT u.');
504    RAISE FND_API.G_EXC_ERROR;
505 END IF;
506 
507 
508 
509 /* =============================================================================
510   Set the return values
511 ============================================================================= */
512 GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.update_reservation NO Error');
513 
514 EXCEPTION
515    WHEN FND_API.G_EXC_ERROR THEN
516       ROLLBACK TO SAVEPOINT GMI_Update_Reservation_PUB;
517       x_return_status := FND_API.G_RET_STS_ERROR;
518 
519       /*   Get message count and data  */
520       FND_MSG_Pub.Count_and_Get
521        (   p_count  => x_msg_count
522          , p_data  => x_msg_data
523        );
524 
525      GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.update_reservation Exp_Error count='||x_msg_count);
526 
527 
528    WHEN OTHERS THEN
529       ROLLBACK TO SAVEPOINT GMI_Update_Reservation_PUB;
530       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
531 
532       FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
533                                , l_api_name
534                               );
535 
536       /*    Get message count and data   */
537       FND_MSG_Pub.Count_and_Get
538        (   p_count  => x_msg_count
539          , p_data  => x_msg_data
540        );
541 
542      GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.update_reservation OTHERS count='||x_msg_count);
543 
544 
545 
546 END Update_Reservation;
547 
548 
549 
550 /*  Api start of comments
551  +==========================================================================+
552  | PROCEDURE NAME                                                           |
553  |    Delete_Reservation                                                    |
554  |                                                                          |
555  | TYPE                                                                     |
556  |    Global                                                                |
557  |                                                                          |
558  | USAGE                                                                    |
559  |   Delete reservation by calling OPM_Allocation manager.                  |
560  |                                                                          |
561  | DESCRIPTION                                                              |
562  |   Delete reservation by calling OPM_Allocation manager.                  |
563  |                                                                          |
564  | PARAMETERS                                                               |
565  |    p_api_version_number        IN  NUMBER       - API version            |
566  |    p_init_msg_lst              IN  VARCHAR2     - Msg init               |
567  |    x_return_status             OUT NOCOPY VARCHAR2     - Return Status   |
568  |    x_msg_count                 OUT NOCOPY NUMBER       -                 |
569  |    x_msg_data                  OUT NOCOPY VARCHAR2     -                 |
570  |    p_validation_flag           IN  VARCHAR2     -                        |
571  |    p_rsv_rec                   IN  rec_type     -                        |
572  |    p_serial_number             IN  rec_type     -                        |
573  |                                                                          |
574  | RETURNS                                                                  |
575  |    None                                                                  |
576  |                                                                          |
577  | HISTORY                                                                  |
578  |     21-FEB-2000  odaboval        Created                                 |
579  |                                                                          |
580  +==========================================================================+
581   Api end of comments
582 */
583 PROCEDURE Delete_Reservation
584   (
585      p_api_version_number       IN  NUMBER
586    , p_init_msg_lst             IN  VARCHAR2 DEFAULT fnd_api.g_false
587    , x_return_status            OUT NOCOPY VARCHAR2
588    , x_msg_count                OUT NOCOPY NUMBER
589    , x_msg_data                 OUT NOCOPY VARCHAR2
590    , p_validation_flag          IN  VARCHAR2 DEFAULT FND_API.G_TRUE
591    , p_rsv_rec                  IN  inv_reservation_global.mtl_reservation_rec_type
595 l_api_name           CONSTANT VARCHAR2 (30) := 'Delete_Reservation';
592    , p_serial_number            IN  inv_reservation_global.serial_number_tbl_type
593    ) IS
594 
596 
597 -- odaboval, Oct-2001, standalone fix for Tropicana.
598 CURSOR c_get_wsh_released_status( l_so_line_id IN NUMBER) IS
599 SELECT released_status
600 FROM wsh_delivery_details
601 WHERE released_status IN ('Y', 'C')
602 AND source_line_id = l_so_line_id;
603 
604 BEGIN
605 
606 /*  Initialize API return status to success   */
607 x_return_status := FND_API.G_RET_STS_SUCCESS;
608 
609 /* =========================================================================
610   Check the validation flag :
611   If validation flag is G_TRUE, then check
612                           ( used if another process calls the procedure)
613   If validation flag is NONE, then no check.
614                        ( used if the call comes from another GMI_reservation)
615 ============================================================================ */
616 
617 GMI_Reservation_Util.PrintLn('(opm_dbg) in proc PUB q : before Check_Missing : flag='||p_validation_flag||', G_TRUE='||FND_API.G_TRUE);
618 IF (p_validation_flag = FND_API.G_TRUE)
619 THEN
620 /* =======================================================================
621     Call Data Validation
622   ====================================================================== */
623    GMI_Reservation_Util.Check_Missing(
624         p_event                     => 'DELETE'
625       , p_rec_to_check              => p_rsv_rec
626       , x_return_status	            => x_return_status
627       , x_msg_count                 => x_msg_count
628       , x_msg_data                  => x_msg_data
629       );
630 
631    IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
632       FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
633       FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_Util.Check_Missing');
634       FND_MESSAGE.Set_Token('WHERE', 'Delete_Reservation');
635       FND_MSG_PUB.Add;
636       raise FND_API.G_EXC_ERROR;
637    END IF;
638 
639 END IF;
640 
641 -- Bug 2025611, odaboval, Oct-2001, added a check for not calling
642 --     delete_reservation when the released_status of the shipping details
643 --     is Y or C :
644 /* This local fix is now removed (odaboval, for Tropicana only)
645 GMI_Reservation_PVT.Check_Shipping_Details(
646         p_rsv_rec    	            => p_rsv_rec
647       , x_return_status	            => x_return_status
648       , x_msg_count                 => x_msg_count
649       , x_msg_data                  => x_msg_data);
650 
651 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
652    FND_MESSAGE.Set_Name('GMI','GMI_NOT_ALLOWED_TO_DELETE_RSV');
653    FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_PVT.Check_Shipping_Details');
654    FND_MESSAGE.Set_Token('WHERE', 'Delete_Reservation');
655    FND_MSG_PUB.Add;
656    GMI_Reservation_Util.PrintLn('(opm_dbg) in end of PUB d: WARNING: Cannot call Delete_Reservation because of shipping status.');
657    RAISE FND_API.G_EXC_ERROR;
658 END IF;
659 (odaboval) */
660 
661 /* ==========================================================================
662   Call The private delete_reservation_reservation
663    ======================================================================= */
664 GMI_Reservation_Util.PrintLn('(opm_dbg) in GMI_Reservation_PUB.delete_reservation before calling PVT');
665 
666 GMI_Reservation_PVT.Delete_Reservation(
667         x_return_status	            => x_return_status
668       , x_msg_count                 => x_msg_count
669       , x_msg_data                  => x_msg_data
670       , p_validation_flag           => p_validation_flag
671       , p_rsv_rec    	            => p_rsv_rec
672       , p_serial_number             => p_serial_number
673    );
674 
675 IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
676    FND_MESSAGE.Set_Name('GMI','GMI_ERROR');
677    FND_MESSAGE.Set_Token('BY_PROC', 'GMI_Reservation_PVT.Delete_Reservation');
678    FND_MESSAGE.Set_Token('WHERE', 'Delete_Reservation');
679    FND_MSG_PUB.Add;
680    GMI_Reservation_Util.PrintLn('(opm_dbg) in end of PUB d: ERROR:Returned by PVT d.');
681    RAISE FND_API.G_EXC_ERROR;
682 END IF;
683 
684 
685 
686 /* ===========================================================================
687   Set the return values
688 =========================================================================== */
689 GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.delete_reservation NO Error');
690 
691 
692 
693 EXCEPTION
694    WHEN FND_API.G_EXC_ERROR THEN
695       x_return_status := FND_API.G_RET_STS_ERROR;
696 
697       /*   Get message count and data   */
698       FND_MSG_Pub.Count_and_Get
699        (   p_count  => x_msg_count
700          , p_data  => x_msg_data
701        );
702 
703       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.delete_reservation Exp_Error count='||x_msg_count);
704 
705    WHEN OTHERS THEN
706       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
707 
708       FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
709                                , l_api_name
710                               );
711 
712       /*    Get message count and data */
713       FND_MSG_Pub.Count_and_Get
714        (   p_count  => x_msg_count
715          , p_data  => x_msg_data
716        );
717 
718       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.delete_reservation OTHERS count='||x_msg_count);
719 
720 
721 END Delete_Reservation;
722 
723 /*   Api start of comments
724  +==========================================================================+
725  | PROCEDURE NAME                                                           |
726  |    Transfer_Reservation                                                  |
727  |                                                                          |
728  | TYPE                                                                     |
729  |    Global                                                                |
730  |                                                                          |
731  | USAGE                                                                    |
732  |   Transfer reservation - Not Used, just a message                        |
733  |                                                                          |
734  | DESCRIPTION                                                              |
735  |   Transfer reservation - Not Used, just a message                        |
736  |                                                                          |
737  | PARAMETERS                                                               |
738  |    p_api_version_number        IN  NUMBER       - API version            |
739  |    p_init_msg_lst              IN  VARCHAR2     - Msg init               |
740  |    x_return_status             OUT NOCOPY VARCHAR2     - Return Status   |
741  |    x_msg_count                 OUT NOCOPY NUMBER       -                 |
742  |    x_msg_data                  OUT NOCOPY VARCHAR2     -                 |
743  |    p_is_transfer_supply        IN  VARCHAR2     -                        |
744  |    p_original_rsv_rec          IN  rec_type     -                        |
745  |    p_to_rsv_rec                IN  rec_type     -                        |
746  |    p_original_serial_number    IN  rec_type     -                        |
747  |    p_to_serial_number          IN  rec_type     -                        |
748  |    p_validation_flag           IN  VARCHAR2     -                        |
749  |    x_to_reservation_id         OUT NOCOPY NUMBER       -                 |
750  |                                                                          |
751  | RETURNS                                                                  |
752  |    None                                                                  |
753  |                                                                          |
754  | HISTORY                                                                  |
755  |     21-FEB-2000  odaboval        Created                                 |
756  |                                                                          |
757  +==========================================================================+
758   Api end of comments
759 */
760 PROCEDURE Transfer_Reservation
761   (
762      p_api_version_number            IN  NUMBER
763    , p_init_msg_lst                  IN  VARCHAR2 DEFAULT fnd_api.g_false
764    , x_return_status                 OUT NOCOPY VARCHAR2
765    , x_msg_count                     OUT NOCOPY NUMBER
766    , x_msg_data                      OUT NOCOPY VARCHAR2
767    , p_validation_flag               IN  VARCHAR2 DEFAULT FND_API.G_TRUE
768    , p_is_transfer_supply            IN  VARCHAR2 DEFAULT fnd_api.g_true
769    , p_original_rsv_rec              IN  inv_reservation_global.mtl_reservation_rec_type
770    , p_to_rsv_rec                    IN  inv_reservation_global.mtl_reservation_rec_type
771    , p_original_serial_number        IN  inv_reservation_global.serial_number_tbl_type
772    , p_to_serial_number              IN  inv_reservation_global.serial_number_tbl_type
773    , x_to_reservation_id             OUT NOCOPY NUMBER
774    ) IS
775 
776 l_api_name           CONSTANT VARCHAR2 (30) := 'Transfer_Reservation';
777 
778 BEGIN
779 
780     FND_MESSAGE.SET_NAME('GMI','GMI_RSV_UNAVAILABLE');
781     FND_MSG_PUB.Add;
782     RAISE FND_API.G_EXC_ERROR;
783 
784 EXCEPTION
785    WHEN FND_API.G_EXC_ERROR THEN
786       x_return_status := FND_API.G_RET_STS_ERROR;
787 
788       /*   Get message count and data  */
789       FND_MSG_Pub.Count_and_Get
790        (   p_count  => x_msg_count
791          , p_data  => x_msg_data
792        );
793 
794       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.transfer_reservation Exp_Error count='||x_msg_count);
795 
796    WHEN OTHERS THEN
797       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
798 
799       FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
800                                , l_api_name
801                               );
802 
803       /*   Get message count and data  */
804       FND_MSG_Pub.Count_and_Get
805        (   p_count  => x_msg_count
806          , p_data  => x_msg_data
807        );
808 
809       GMI_Reservation_Util.PrintLn('(opm_dbg) in end of GMI_Reservation_PUB.transfer_reservation OTHERS count='||x_msg_count);
810 
811 END Transfer_Reservation;
812 
813 END GMI_Reservation_PUB;