DBA Data[Home] [Help]

PACKAGE BODY: APPS.GL_GLOBAL

Source


1 PACKAGE BODY GL_GLOBAL as
2 /* $Header: glustglb.pls 120.5 2005/11/22 19:34:47 spala ship $ */
3 
4   --
5   -- PRIVATE VARIABLES
6   --
7 
8   -- Current ledger id
9      current_ledger_id  NUMBER;
10 
11   --
12   -- PUBLIC FUNCTIONS
13   --
14 
15   PROCEDURE  set_aff_validation (context_type VARCHAR2,
16                                  context_id   NUMBER)
17                                 IS
18    l_profile_increment  NUMBER;
19    l_old_prof_val      	NUMBER;
20 
21 
22   BEGIN
23 
24 
25      IF (Context_Type = 'LG') THEN
26 
27           current_ledger_id := Context_Id;
28 
29        ELSIF (Context_Type = 'OU') THEN
30 
31            SELECT set_of_books_id INTO current_ledger_id
32            FROM   HR_OPERATING_UNITS
33            WHERE  organization_id = Context_Id;
34 
35        ELSIF(Context_Type = 'LE') THEN
36 
37            SELECT prilgr.ledger_id
38            INTO   current_ledger_id
39            FROM   GL_LEDGER_CONFIG_DETAILS cfgDet,
40                   GL_LEDGER_CONFIGURATIONS cfg,
41                   GL_LEDGERS Prilgr
42            WHERE  cfgDet.object_id = Context_Id
43            AND    cfgDet.object_type_code  = 'LEGAL_ENTITY'
44            AND    cfgDet.configuration_id  = cfg.configuration_id
45            AND    cfg.configuration_id = prilgr.configuration_id
46            AND    prilgr.ledger_category_code = 'PRIMARY';
47 
48       ELSIF(Context_Type = 'XX') THEN
49 
50        current_ledger_id := NULL;
51 
52       ELSE
53 
54             RAISE NO_DATA_FOUND;
55 
56       END IF;
57 
58      EXCEPTION
59          WHEN NO_DATA_FOUND THEN
60 
61           IF ( context_type = 'OU') THEN
62             FND_MESSAGE.Set_Name('SQLGL', 'GL_GLOBAL_INVALID_OU');
63             -- Operating unit _OP_UNIT does not exist in the target database.
64             FND_MESSAGE.Set_Token('OP_UNIT',TO_CHAR(Context_Id));
65             APP_EXCEPTION.Raise_Exception;
66           ELSIF ( context_type = 'LE') THEN
67             FND_MESSAGE.Set_Name('SQLGL', 'GL_GLOBAL_INVALID_LE');
68             -- Legal entity  _LE does not exist in the target database.
69             FND_MESSAGE.Set_Token('LE',TO_CHAR(Context_Id));
70             APP_EXCEPTION.Raise_Exception;
71           ELSIF ((context_type <> 'LG') OR (context_type <> 'XX')) THEN
72             APP_EXCEPTION.Raise_Exception;
73           END IF;
74 
75         WHEN OTHERS THEN
76            APP_EXCEPTION.Raise_Exception;
77 
78    END set_aff_validation;
79 
80   --
81   -- Function
82   --   Context_Ledger_Id
83   -- Purpose
84   --   Returns set context ledger_id
85   --
86   --
87   -- History
88   --   02-AUG-05  Srini Pala   Created
89   --
90   --
91   -- Arguments
92   --
93   --
94   -- Example
95   --   gl_global.Context_Ledger_Id;
96   -- Notes
97   --
98 
99   Function Context_Ledger_Id Return NUMBER IS
100    BEGIN
101       Return current_ledger_id;
102    EXCEPTION
103      WHEN OTHERS THEN
104       APP_EXCEPTION.raise_exception;
105   END Context_Ledger_Id;
106 
107 END GL_GLOBAL;