DBA Data[Home] [Help]

PACKAGE BODY: APPS.INV_GMI_RSV_BRANCH

Source


4 --+=========================================================================+
1 PACKAGE BODY INV_GMI_RSV_BRANCH AS
2 -- $Header: INVGGMIB.pls 120.1 2005/06/11 13:35:19 appldev  $
3 -- API start comments
5 --|                Copyright (c) 2000 Oracle Corporation                    |
6 --|                        TVP, Reading, England                            |
7 --|                         All rights reserved                             |
8 --+=========================================================================+
9 --| FILENAME                                                                |
10 --|    INVGGMIS.pls                                                         |
14 --|     Logic that will cause the code to call PROCESS  Iventory ( GMI)     |
11 --|                                                                         |
12 --| DESCRIPTION                                                             |
13 --|     This package contains Global procedures relating to Branching       |
15 --|     Instead Of DISCRETE Invemtory (INV).                                |
16 --|                                                                         |
17 --| HISTORY                                                                 |
18 --|     14-FEB-2000  H.Verdding      Created                                |
19 --|                                                                         |
20 --+=========================================================================+
21 -- API Name  : INV_GMI_RSV_BRANCH
22 -- Type      : Global - Package Body Specification
23 -- Function  : This package contains Global procedures used to Branch code
24 --             From Within Discrete Inventory (INV) to Process Inventory
25 ---            (GMI).
26 -- Pre-reqs  : N/A
27 -- Parameters: Per function
28 --
29 -- Current Vers  : 1.0
30 -- Api end of comments
31 
32 -- Global variables
33 G_PKG_NAME             CONSTANT VARCHAR2(30):='INV_GMI_RSV_BRANCH';
34 l_process_rec          INV_GMI_RSV_BRANCH.process_org_rec;
35 l_process_rec_tbl      INV_GMI_RSV_BRANCH.process_org_rec_tbl;
36 l_discrete_rec         INV_GMI_RSV_BRANCH.discrete_org_rec;
37 l_discrete_rec_tbl     INV_GMI_RSV_BRANCH.discrete_org_rec_tbl;
38 
39 -- Api start of comments
40 --+==========================================================================+
41 --| PROCEDURE NAME                                                           |
42 --|   PROCESS_BRANCH                                                         |
43 --|                                                                          |
44 --| TYPE                                                                     |
45 --|    Global                                                                |
46 --|                                                                          |
47 --| USAGE                                                                    |
48 --|   Allow Calling Function To Branch between DISCRETE Inventory (INV)      |
49 --|   Functionality and PROCESS Inventory Functionality.                     |
50 --|                                                                          |
51 --| DESCRIPTION                                                              |
52 --|   Allow Calling Function To Branch between DISCRETE Inventory (INV)      |
53 --|   Functionality and PROCESS Inventory Functionality.                     |
54 --|                                                                          |
55 --| PARAMETERS                                                               |
56 --|    p_organization_id  IN  NUMBER       - Organization Identifier         |
57 --|                                                                          |
58 --| RETURNS                                                                  |
59 --|    None                                                                  |
60 --|                                                                          |
61 --| HISTORY                                                                  |
62 --|     14-FEB-2000  H.Verdding      Created                                 |
63 --|                                                                          |
64 --+==========================================================================+
65 -- Api end of comments
66 FUNCTION PROCESS_BRANCH
67 (
68   p_organization_id  IN   NUMBER
69 )
70 RETURN BOOLEAN
71 IS
72 
73 BEGIN
74 
75 -- Validate Input Attribute p_organization_id;
76    IF p_organization_id IS NULL  OR p_organization_id = fnd_api.g_miss_num THEN
77       RETURN FALSE;
78    END IF;
79 
80 -- Check IF Process Inventory Is Installed.
81 /* No need to check if Process Inventory is installed - INVCONV
82    IF INV_GMI_RSV_BRANCH.G_PROCESS_INV_INSTALLED <> 'I' THEN
83       RETURN FALSE;
84    ELSE */
85 -- ELSE check IF Organization Parameter is defined as a PROCESS ORG.
86    IF IS_ORG_PROCESS_ORG(p_organization_id) THEN
87         RETURN TRUE;
88    END IF;
89 -- END IF; /* INVCONV */
90 
91 RETURN FALSE;
92 
93 EXCEPTION
94    WHEN fnd_api.g_exc_error THEN
95       RETURN FALSE;
96 
97    WHEN OTHERS THEN
98       --
99       IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
100         THEN
101          fnd_msg_pub.add_exc_msg
102            (  g_pkg_name
103               , 'BRANCHING LOGIC'
104               );
105         END IF;
106       RETURN FALSE;
107 
108 END PROCESS_BRANCH;
109 
110 -- Api start of comments
111 --+==========================================================================+
112 --| PROCEDURE NAME                                                           |
113 --|    GET_PROCESS_ORG                                                       |
114 --|                                                                          |
115 --| TYPE                                                                     |
116 --|    Global                                                                |
117 --|                                                                          |
118 --| USAGE                                                                    |
119 --|   This Procedure will Return OPM Organization Values From A Global       |
120 --|   CACHE. If the specified row does not EXIST in the cache it will        |
121 --|   try and Retrive this from the database                                 |
122 --|                                                                          |
123 --| DESCRIPTION                                                              |
124 --|   This Procedure will Return OPM Organization Values From A Global       |
125 --|   CACHE. If the specified row does not EXIST in the cache it will        |
126 --|   try and Retrive this from the database                                 |
127 --|                                                                          |
128 --| PARAMETERS                                                               |
129 --|    p_organization_id  IN  NUMBER       - Organization Identifier         |
130 --|    x_opm_whse_code    OUT VARCHAR2     - OPM Whse Code                   |
131 --|    x_opm_co_code      OUT NUMBER       - OPM Company Code                |
132 --|    x_opm_orgn_code    OUT VARCHAR2     - OPM Organization Code           |
133 --|    x_return_status    OUT VARCHAR2     - Return Status                   |
134 --|                                                                          |
135 --| RETURNS                                                                  |
136 --|    See Above OUT PARAMETERS                                              |
137 --|                                                                          |
138 --| HISTORY                                                                  |
139 --|     14-FEB-2000  H.Verdding      Created                                 |
140 --|                                                                          |
141 --+==========================================================================+
142 
143 PROCEDURE GET_PROCESS_ORG
144 (
145    P_ORGANIZATION_ID IN  NUMBER
146   ,X_OPM_WHSE_CODE   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
147   ,X_OPM_CO_CODE     OUT NOCOPY /* file.sql.39 change */ VARCHAR2
148   ,X_OPM_ORGN_CODE   OUT NOCOPY /* file.sql.39 change */ VARCHAR2
149   ,X_RETURN_STATUS   OUT NOCOPY /* file.sql.39 change */  VARCHAR2
150 )
151 IS
152 tbl_index BINARY_INTEGER :=1;
153 l_opm_whse_code VARCHAR2(4);
154 l_opm_orgn_code VARCHAR2(4);
155 l_opm_co_code   VARCHAR2(4);
156 
157 BEGIN
158 
159 -- Initialize API return status to sucess
160   x_return_status := FND_API.G_RET_STS_SUCCESS;
161 
162 -- As long as there are records in the Global cache
163 -- search It to find matching organization id.
164 
165 -- INVCONV
166 /* IF l_process_rec_tbl.COUNT > 0 THEN
167     WHILE tbl_index <= l_process_rec_tbl.COUNT
168     LOOP
169      IF l_process_rec_tbl(tbl_index).organization_id = P_ORGANIZATION_ID THEN
170         l_opm_whse_code := l_process_rec_tbl(tbl_index).whse_code;
171         l_opm_co_code   := l_process_rec_tbl(tbl_index).co_code;
172         l_opm_orgn_code := l_process_rec_tbl(tbl_index).orgn_code;
173         EXIT;
174      END IF;
175      tbl_index := tbl_index +1;
176     END LOOP;
177 ELSE */
178    -- Seach the database
179    IF SEARCH_PROCESS_ORG_DB(P_ORGANIZATION_ID) THEN
180       -- If this is successful then the global rec type
181       -- l_process_rec will have the record we need
182 
183       x_opm_whse_code := l_process_rec.whse_code;
184       x_opm_co_code   := l_process_rec.co_code;
185       x_opm_orgn_code := l_process_rec.orgn_code;
186 
187       -- Call Add To CACHE Since We May need This Again
188       -- add_process_org_to_cache(l_process_rec); /* INVCONV */
189       RETURN;
190     ELSE
191     -- Return Expected Error do I need A MESSAGE!!!
192        RAISE  FND_API.G_EXC_ERROR;
193     END IF;
194 -- END IF; End INVCONV
195 /*  INVCONV x_opm_whse_code := l_opm_whse_code;
196 x_opm_co_code   := l_opm_co_code;
197 x_opm_orgn_code := l_opm_orgn_code; INVCONV */
198 
199 EXCEPTION
200 
201    WHEN fnd_api.g_exc_error THEN
202       x_return_status := fnd_api.g_ret_sts_error;
203       --
204    WHEN fnd_api.g_exc_unexpected_error THEN
205       x_return_status := fnd_api.g_ret_sts_unexp_error ;
206       --
207    WHEN OTHERS THEN
208       x_return_status := fnd_api.g_ret_sts_unexp_error ;
209       --
210       IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error)
211         THEN
212          fnd_msg_pub.add_exc_msg
213            (  g_pkg_name
214               , 'GET PROCESS ORG'
215             );
216        END IF;
217 
218 END get_process_org;
219 
220 -- Api start of comments
221 --+==========================================================================+
222 --| PROCEDURE NAME                                                           |
223 --|   SEARCH_PROCESS_ORG_CACHE                                               |
224 --|                                                                          |
225 --| TYPE                                                                     |
226 --|    Global                                                                |
227 --|                                                                          |
228 --| USAGE                                                                    |
229 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
230 --|   The cache of Organizations defined as PROCESS Orgs to find a matching  |
231 --|   Record.If Found It Will Return TRUE, Otherwise It Will Return False.   |
232 --|                                                                          |
233 --| DESCRIPTION                                                              |
234 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
235 --|   The cache of Organizations defined as PROCESS Orgs to find a matching  |
236 --|   Record.If Found It Will Return TRUE, Otherwise It Will Return False.   |
237 --|                                                                          |
238 --| PARAMETERS                                                               |
239 --|   p_organization_id  IN  NUMBER       - Organization Identifier          |
240 --|                                                                          |
241 --| RETURNS                                                                  |
242 --|   NONE 								     |
243 --|                                                                          |
244 --| HISTORY                                                                  |
245 --|     14-FEB-2000  H.Verdding      Created                                 |
246 --|                                                                          |
247 --+==========================================================================+
248 -- Api end of comments
249 
250 FUNCTION search_process_org_cache
251 (
252    P_ORGANIZATION_ID IN  NUMBER
253 )
254 RETURN BOOLEAN
255 IS
256 
257 tbl_index BINARY_INTEGER :=1;
258 
259 BEGIN
260 
261 -- As long as there are records in the cache
262 -- Search the cache Else return FALSE.
263 
264 IF l_process_rec_tbl.COUNT > 0 THEN
265     WHILE tbl_index <= l_process_rec_tbl.COUNT
266     LOOP
267      IF l_process_rec_tbl(tbl_index).organization_id = P_ORGANIZATION_ID THEN
268         RETURN TRUE;
269      END IF;
270      tbl_index := tbl_index +1;
271     END LOOP;
272 END IF;
273 
274  RETURN FALSE;
275 
276 EXCEPTION
277 
278   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
279     RETURN FALSE;
280 
281   WHEN OTHERS THEN
282     FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
283                              , 'Search_process_org_cache'
284                             );
285     RETURN FALSE;
286 
287 
288 END search_process_org_cache;
289 -- Api start of comments
290 --+==========================================================================+
291 --| PROCEDURE NAME                                                           |
292 --|    SET_INSTALLED                                                         |
293 --|                                                                          |
294 --| TYPE                                                                     |
295 --|    Global                                                                |
296 --|                                                                          |
297 --| USAGE                                                                    |
298 --|   This Procedure Will Be called the First Time That This Package         |
299 --|   Is Instantiated ( Loaded into Memory).                                 |
300 --|                                                                          |
301 --| DESCRIPTION                                                              |
302 --|   This will set The GLOBAL VARIABLE G_PROCESS_INV_INSTALLED to the       |
303 --|   Installed Status of The Passed in Application Short Name (GMI).        |
304 --|                                                                          |
305 --| PARAMETERS                                                               |
306 --|    P_APP_SHORT_NAME    IN VARCHAR2    - Application Short name           |
307 --|                                                                          |
308 --| RETURNS                                                                  |
309 --|    None                                                                  |
310 --|                                                                          |
311 --| HISTORY                                                                  |
312 --|     14-FEB-2000  H.Verdding      Created                                 |
313 --|                                                                          |
314 --+==========================================================================+
315 
316 Procedure SET_INSTALLED
317 (
318    P_APP_SHORT_NAME IN VARCHAR2
319 )
320 IS
321 l_status   VARCHAR2(1);
322 l_industry VARCHAR2(1);
323 l_schema   VARCHAR2(30);
324 
325 BEGIN
326 
327 
328 -- Call FND API to set Installed Flag
329 IF  fnd_installation.get_app_info( 'GMI',l_status,l_industry,l_schema) THEN
330     INV_GMI_RSV_BRANCH.G_PROCESS_INV_INSTALLED := l_status;
331 END IF;
332 
333 EXCEPTION
334 
335   WHEN OTHERS THEN
336     FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
337                              , 'SET INSTALLED'
338                             );
339 
340 END set_installed;
341 
342 -- Api start of comments
343 --+==========================================================================+
344 --| PROCEDURE NAME                                                           |
345 --|   SEARCH_PROCESS_ORG_DB                                                  |
346 --|                                                                          |
347 --| TYPE                                                                     |
348 --|    Global                                                                |
349 --|                                                                          |
350 --| USAGE                                                                    |
351 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
352 --|   The cache of Organizations defined as PROCESS Orgs to find a matching  |
353 --|   Record.If Found It Will Return TRUE, Otherwise It Will Return False.   |
354 --|                                                                          |
355 --| DESCRIPTION                                                              |
356 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
357 --|   The the database using a Cursor Select For the Input Organization      |
358 --|   If It Finds A matching record It Will return TRUE Otherwise It Will    |
359 --|   Return False.                                                          |
360 --|                                                                          |
361 --| PARAMETERS                                                               |
362 --|   p_organization_id  IN  NUMBER       - Organization Identifier          |
363 --|                                                                          |
364 --| RETURNS                                                                  |
365 --|   NONE 								     |
366 --|                                                                          |
367 --| HISTORY                                                                  |
368 --|     14-FEB-2000  H.Verdding      Created                                 |
369 --|                                                                          |
370 --+==========================================================================+
371 -- Api end of comments
372 
373 FUNCTION SEARCH_PROCESS_ORG_DB
374 (
375    P_ORGANIZATION_ID IN  NUMBER
376 )
377 RETURN BOOLEAN
378 IS
379 
380 BEGIN
381 -- Open the Defined Global Cursor
382 
383   OPEN Cur_get_aprocess_org(P_ORGANIZATION_ID);
384   FETCH Cur_get_aprocess_org INTO l_process_rec;
385   IF(Cur_get_aprocess_org%NOTFOUND) THEN
386   CLOSE Cur_get_aprocess_org;
387   -- If failed To retrive Row , return FALSE.
388      RETURN FALSE;
389   ELSE
390   CLOSE Cur_get_aprocess_org;
391   -- Close This cursor If Matching Row Found, return TRUE.
392      RETURN TRUE;
393   END IF;
394 
395 EXCEPTION
396 
397   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
398     RETURN FALSE;
399 
400   WHEN OTHERS THEN
401     FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
402                              , 'SEARCH_PROCESS_ORG_DB'
403                             );
404     RETURN FALSE;
405 
406 END search_process_org_db;
407 
408 -- Api start of comments
409 --+==========================================================================+
410 --| PROCEDURE NAME                                                           |
411 --|   ADD_PROCESS_ORG_TO_CACHE                                               |
412 --|                                                                          |
413 --| TYPE                                                                     |
414 --|    Global                                                                |
415 --|                                                                          |
416 --| USAGE                                                                    |
417 --|   This Function Will Find the MAXIMUM rows in the Organization Cache     |
418 --|   And then Add this INPUT record To the end of the cache.                |
419 --|                                                                          |
420 --| DESCRIPTION                                                              |
421 --|   This Function Will Find the MAXIMUM rows in the Organization Cache     |
422 --|   And then Add this INPUT record To the end of the cache.                |
423 --|                                                                          |
424 --| PARAMETERS                                                               |
425 --|   p_process_org_rec  IN  INV_GMI_RSV_BRANCH.process_org_rec              |
426 --|                                                                          |
427 --| RETURNS                                                                  |
428 --|   NONE 								     |
429 --|                                                                          |
430 --| HISTORY                                                                  |
431 --|     14-FEB-2000  H.Verdding      Created                                 |
432 --|                                                                          |
433 --+==========================================================================+
434 -- Api end of comments
435 
436 Procedure add_process_org_to_cache
437 (
438     p_process_org_rec IN  INV_GMI_RSV_BRANCH.process_org_rec
439 )
440 IS
441 tbl_index BINARY_INTEGER :=0;
442 
443 BEGIN
444    -- Set counter To the End Row Of the cache.
445    tbl_index := l_process_rec_tbl.COUNT;
446    -- Increment counter
447    tbl_index := tbl_index +1;
448    -- Add this record to Global CACHE.
449    l_process_rec_tbl(tbl_index) := l_process_rec;
450 
451 EXCEPTION
452   WHEN OTHERS THEN
453     FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
454                              , 'ADD_PROCESS_ORG_TO_CACHE'
455                             );
456 
457 
458 END add_process_org_to_cache;
459 
460 -- Api start of comments
461 --+==========================================================================+
462 --| FUNCTION NAME                                                            |
466 --|    Global                                                                |
463 --|   IS_ORG_PROCESS_ORG                                                     |
464 --|                                                                          |
465 --| TYPE                                                                     |
467 --|                                                                          |
468 --| USAGE                                                                    |
469 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
470 --|   A cache of locally defined Discrete Orgs. IF it finds a matching row   |
471 --|   It will then return FALSE. Else it will then search The cache of       |
472 --|   Organizations defined as PROCESS Orgs to find a matching  record.      |
473 --|   If Found It Will Return TRUE, Otherwise It Will Go To the database     |
474 --|   to find a matching row. If found It Will Add this record to the        |
475 --|   process cache and Return TRUE else it Will Return FALSE and add this   |
476 --|   record to the discrete CACHE..                                         |
477 --|                                                                          |
478 --| DESCRIPTION                                                              |
479 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
480 --|   A cache of locally defined Discrete Orgs. IF it finds a matching row   |
481 --|   It will then return FALSE. Else it will then search The cache of       |
482 --|   Organizations defined as PROCESS Orgs to find a matching  record.      |
483 --|   If Found It Will Return TRUE, Otherwise It Will Go To the database     |
484 --|   to find a matching row. If found It Will Add this record to the        |
485 --|   process cache and Return TRUE else it Will Return FALSE and add this   |
486 --|   record to the discrete CACHE..                                         |
487 --|                                                                          |
488 --| PARAMETERS                                                               |
489 --|   p_organization_id  IN  NUMBER       - Organization Identifier          |
490 --|                                                                          |
491 --| RETURNS                                                                  |
492 --|   NONE 								     |
493 --|                                                                          |
494 --| HISTORY                                                                  |
495 --|     14-FEB-2000  H.Verdding      Created                                 |
496 --|     14-Mar-2005 Rajesh Kulkarni. Removed the earlier caching mechanism.  |
497 --|                Now only cache G_PROCESS_ORGN for the organization        |
498 --|                instance                                                  |
499 --+==========================================================================+
500 -- Api end of comments
501 
502 FUNCTION IS_ORG_PROCESS_ORG
503 (
504    P_ORGANIZATION_ID IN  NUMBER
505 )
506 RETURN BOOLEAN
507 IS
508 
509 /* INVCONV */
510 -- tbl_index BINARY_INTEGER :=1;
511 process_enabled mtl_parameters.process_enabled_flag%TYPE;
512    CURSOR process_org IS
513      SELECT process_enabled_flag
514      FROM   mtl_parameters
515      WHERE  organization_id = p_organization_id;
516 
517 BEGIN
518 
519 -- Always Search Discrete Cache First.
520 
521 -- INVCONV
522 /* IF ( search_discrete_org_cache ( P_ORGANIZATION_ID) ) THEN
523      RETURN FALSE;
524 END IF;
525 
526 IF l_process_rec_tbl.COUNT > 0 THEN
527    -- search cache
528    IF ( search_process_org_cache( P_ORGANIZATION_ID)) THEN
529       RETURN TRUE;
530    ELSE
531    -- if not found in cache, search database.
532       IF ( search_process_org_db( P_ORGANIZATION_ID)) THEN
533 	     -- IF This Select is True l_process_rec will
534 	     -- Hold all the record characteristics We Need
535 	     -- In Global l_process_rec Therefore Add this to the cache.
536          add_process_org_to_cache(l_process_rec);
537 	    RETURN TRUE;
538       ELSE
539          add_discrete_org_to_cache(P_ORGANIZATION_ID);
540 	    RETURN FALSE;
541       END IF;
542    END IF;
543 ELSE
544 -- No records EXITS in cache Load Form the database.
545 -- if not found in cache, search database.
546 
547    IF ( search_process_org_db( P_ORGANIZATION_ID)) THEN
548       add_process_org_to_cache(l_process_rec);
549 	 RETURN TRUE;
550    ELSE
551       add_discrete_org_to_cache(P_ORGANIZATION_ID);
552 	 RETURN FALSE;
553    END IF;
554 
555 END IF; */
556 -- Validate Input Attribute p_organization_id;
557    IF p_organization_id IS NULL  OR p_organization_id = fnd_api.g_miss_num THEN
558       RETURN FALSE;
559    END IF;
560    process_enabled := 'N';
561    INV_GMI_RSV_BRANCH.G_PROCESS_ORGN := 'N';
562    OPEN process_org;
563    FETCH process_org into process_enabled;
564    CLOSE process_org;
565 
566    If process_enabled = 'Y'
567    Then
568         INV_GMI_RSV_BRANCH.G_PROCESS_ORGN := 'Y';
569         RETURN TRUE;
570    Else
571         RETURN FALSE;
572    End If;
573 
574 EXCEPTION
575 
576   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
577     RETURN FALSE;
578 
579   WHEN OTHERS THEN
580     FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
581                              , 'IS_ORG_PROCESS_ORG'
582                             );
583     RETURN FALSE;
584 
585 END IS_ORG_PROCESS_ORG;
586 -- Api start of comments
587 --+==========================================================================+
588 --| PROCEDURE NAME                                                           |
589 --|   SEARCH_DISCRETE_ORG_CACHE                                              |
590 --|                                                                          |
594 --| USAGE                                                                    |
591 --| TYPE                                                                     |
592 --|    Global                                                                |
593 --|                                                                          |
595 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
596 --|   The cache of Organizations defined as DISCRETE Orgs to find a matching |
597 --|   Record.If Found It Will Return TRUE, Otherwise It Will Return False.   |
598 --|                                                                          |
599 --| DESCRIPTION                                                              |
600 --|   This Function Will Return  A BOOLEAN TRUE or FALSE. It Will Search     |
601 --|   The cache of Organizations defined as DISCRETE Orgs to find a matching |
602 --|   Record.If Found It Will Return TRUE, Otherwise It Will Return False.   |
603 --|                                                                          |
604 --| PARAMETERS                                                               |
605 --|   p_organization_id  IN  NUMBER       - Organization Identifier          |
606 --|                                                                          |
607 --| RETURNS                                                                  |
608 --|   NONE 								     |
609 --|                                                                          |
610 --| HISTORY                                                                  |
611 --|     14-FEB-2000  H.Verdding      Created                                 |
612 --|                                                                          |
613 --+==========================================================================+
614 -- Api end of comments
615 
616 FUNCTION search_discrete_org_cache
617 (
618    P_ORGANIZATION_ID IN  NUMBER
619 )
620 RETURN BOOLEAN
621 IS
622 
623 tbl_index BINARY_INTEGER :=1;
624 
625 BEGIN
626 
627 -- As long as there are records in the cache
628 -- Search the cache Else return FALSE.
629 
630 IF l_discrete_rec_tbl.COUNT > 0 THEN
631     WHILE tbl_index <= l_discrete_rec_tbl.COUNT
632     LOOP
633      IF l_discrete_rec_tbl(tbl_index).organization_id = P_ORGANIZATION_ID THEN
634         RETURN TRUE;
635      END IF;
636      tbl_index := tbl_index +1;
637     END LOOP;
638 END IF;
639 
640  RETURN FALSE;
641 
642 EXCEPTION
643 
644   WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
645     RETURN FALSE;
646 
647   WHEN OTHERS THEN
648     FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
649                              , 'Search_discrete_org_cache'
650                             );
651     RETURN FALSE;
652 
653 
654 END search_discrete_org_cache;
655 
656 -- Api start of comments
657 --+==========================================================================+
658 --| PROCEDURE NAME                                                           |
659 --|   ADD_DISCRETE_ORG_TO_CACHE                                              |
660 --|                                                                          |
661 --| TYPE                                                                     |
662 --|    Global                                                                |
663 --|                                                                          |
664 --| USAGE                                                                    |
665 --|   This Function Will Find the MAXIMUM rows in the Organization Cache     |
666 --|   And then Add this INPUT record To the end of the cache.                |
667 --|                                                                          |
668 --| DESCRIPTION                                                              |
669 --|   This Function Will Find the MAXIMUM rows in the Organization Cache     |
670 --|   And then Add this INPUT record To the end of the cache.                |
671 --|                                                                          |
672 --| PARAMETERS                                                               |
673 --|   p_organization_id  IN  NUMBER                                          |
674 --|                                                                          |
675 --| RETURNS                                                                  |
676 --|   NONE 								     |
677 --|                                                                          |
678 --| HISTORY                                                                  |
679 --|     14-FEB-2000  H.Verdding      Created                                 |
680 --|                                                                          |
681 --+==========================================================================+
682 -- Api end of comments
683 
684 Procedure add_discrete_org_to_cache
685 (
686     P_ORGANIZATION_ID  IN NUMBER
687 )
688 IS
689 tbl_index BINARY_INTEGER :=0;
690 
691 BEGIN
692    -- Set counter To the End Row Of the cache.
693    tbl_index := l_discrete_rec_tbl.COUNT;
694    -- Increment counter
695    tbl_index := tbl_index +1;
696    -- Add this record to Global CACHE.
697    l_discrete_rec_tbl(tbl_index).organization_id := P_ORGANIZATION_ID;
698 
699 EXCEPTION
700   WHEN OTHERS THEN
701     FND_MSG_PUB.Add_Exc_Msg (  G_PKG_NAME
702                              , 'ADD_DISCRETE_ORG_TO_CACHE'
703                             );
704 
705 
706 END add_discrete_org_to_cache;
707 
708 
709 -- Set Initailization Logic
710 -- This Following Procedures Are called once Per SESSION
711 BEGIN
712    set_installed('GMI');
713 END INV_GMI_RSV_BRANCH;