DBA Data[Home] [Help]

PACKAGE BODY: APPS.GL_CONC_CONTROL_PKG

Source


1 PACKAGE BODY GL_CONC_CONTROL_PKG AS
2 /*  $Header: glicurcb.pls 120.2 2003/04/24 01:28:00 djogg ship $ */
3 
4 
5   --
6   -- PUBLIC FUNCTIONS
7   --
8 
9   PROCEDURE insert_conc_ledger(
10     x_ledger_id             NUMBER,
11     x_last_update_date      DATE,
12     x_last_updated_by       NUMBER,
13     x_creation_date         DATE,
14     x_created_by            NUMBER,
15     x_last_update_login     NUMBER )  IS
16 
17   BEGIN
18     LOCK TABLE GL_CONCURRENCY_CONTROL IN SHARE UPDATE MODE;
19     INSERT INTO gl_concurrency_control(
20       concurrency_class,
21       concurrency_entity_name,
22       concurrency_entity_id,
23       last_update_date,
24       last_updated_by,
25       creation_date,
26       created_by,
27       last_update_login )
28     SELECT
29       lk.lookup_code,
30       'LEDGER',
31       to_char( x_ledger_id ),
32       x_last_update_date,
33       x_last_updated_by,
34       x_creation_date,
35       x_created_by,
36       x_last_update_login
37     FROM
38       gl_lookups lk
39     WHERE
40       lk.lookup_type = 'CONCURRENCY_LEDGER'
41       AND NOT EXISTS(
42         SELECT	1
43         FROM	gl_concurrency_control cc
44         WHERE	cc.concurrency_class = lk.lookup_code
45         AND	cc.concurrency_entity_name = 'LEDGER'
46         AND	cc.concurrency_entity_id = to_char( x_ledger_id ) );
47 
48     INSERT INTO gl_concurrency_control(
49       concurrency_class,
50       concurrency_entity_name,
51       concurrency_entity_id,
52       last_update_date,
53       last_updated_by,
54       creation_date,
55       created_by,
56       last_update_login )
57     SELECT
58       'FETCH_TEMPLATE_ORDER',
59       'ASC',
60       to_char( x_ledger_id ),
61       x_last_update_date,
62       x_last_updated_by,
63       x_creation_date,
64       x_created_by,
65       x_last_update_login
66     FROM
67       dual
68     WHERE
69       NOT EXISTS(
70         SELECT  1
71         FROM    gl_concurrency_control cc
72         WHERE   cc.concurrency_class = 'FETCH_TEMPLATE_ORDER'
73         AND     cc.concurrency_entity_id = to_char( x_ledger_id ) );
74 
75   EXCEPTION
76     WHEN app_exceptions.application_exception THEN
77       RAISE;
78     WHEN OTHERS THEN
79       fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
80       fnd_message.set_token('PROCEDURE',
81         'GL_CONC_CONTROL_PKG.insert_conc_ledger');
82       RAISE;
83 
84   END insert_conc_ledger;
85 
86 -- ************************************************************************
87 
88 
89   PROCEDURE insert_conc_subs(
90     x_subsidiary_id		NUMBER,
91     x_last_update_date		DATE,
92     x_last_updated_by		NUMBER,
93     x_creation_date		DATE,
94     x_created_by		NUMBER,
95     x_last_update_login		NUMBER )  IS
96 
97   BEGIN
98     LOCK TABLE GL_CONCURRENCY_CONTROL IN SHARE UPDATE MODE;
99     INSERT INTO gl_concurrency_control(
100       concurrency_class,
101       concurrency_entity_name,
102       concurrency_entity_id,
103       last_update_date,
104       last_updated_by,
105       creation_date,
106       created_by,
107       last_update_login )
108     SELECT
109       lk.lookup_code,
110       'SUBSIDIARY',
111       to_char( x_subsidiary_id ),
112       x_last_update_date,
113       x_last_updated_by,
114       x_creation_date,
115       x_created_by,
116       x_last_update_login
117     FROM
118       gl_lookups lk
119     WHERE
120       lk.lookup_type = 'CONCURRENCY_SUBS'
121       AND NOT EXISTS(
122         SELECT	1
123         FROM	gl_concurrency_control cc
124         WHERE	cc.concurrency_class = lk.lookup_code
125         AND	cc.concurrency_entity_name = 'SUBSIDIARY'
126         AND	cc.concurrency_entity_id = to_char( x_subsidiary_id ) );
127 
128 
129   EXCEPTION
130     WHEN app_exceptions.application_exception THEN
131       RAISE;
132     WHEN OTHERS THEN
133       fnd_message.set_name('SQLGL', 'GL_UNHANDLED_EXCEPTION');
134       fnd_message.set_token('PROCEDURE',
135         'GL_CONC_CONTROL_PKG.insert_conc_subs');
136       RAISE;
137 
138   END insert_conc_subs;
139 
140 -- ************************************************************************
141 
142 END GL_CONC_CONTROL_PKG;