1 PACKAGE BODY cn_global_var AS
2 -- $Header: cnsygin1b.pls 120.2 2005/07/13 16:37:03 appldev ship $
3
4 /*
5 Package Name
6 cn_global_var
7 Purpose
8 This package is used to initialize global variables for the 'current'
9 commissions instance
10
11 History
12 16-JUN-94 P Cook Created
13 08-MAY-95 P Cook Added srp_batch_size
14 08-JUN-95 P Cook Hardcode repository schema join to 'cn_global_var' instead of
15 user pseudo column. Caused problem in demo db
16 26-JUN-95 A Erickson cn_periods.period_name column name update.
17 30-JUN-95 P Cook Added set_of_books_id and replaced join to schema
18 with join to application_id.
19 Adding it to procedure will break code. revisit when
20 required.
21 12-JUL-95 P Cook No longer using concept of current period as a sys
22 parameter. Removed initialization of current period
23 effective srp and revclass hierachies. Retaining
24 parameters to reduce impact of change.
25 19-SEP-95 P Cook Added currency code
26 22-APR-01 N Kodkani Made g_currency_code a function for JSP app use
27 05-Mar-02 S Venkat Included new Function g_srp_batch_size
28 Removed existing global variable g_srp_batch_size from query
29 30-May-02 S Venkat Bring g_salesrep_batch_size/package name change(cn_global_var) in sync
30 */
31
32 PROCEDURE initialize_instance_info(p_org_id IN NUMBER) IS
33 BEGIN
34 SELECT r.repository_id
35 ,r.current_period_id
36 ,p.period_name
37 ,trunc(p.start_date)
38 ,trunc(p.end_date)
39 ,r.rev_class_hierarchy_id
40 ,r.srp_rollup_hierarchy_id
41 ,system_batch_size
42 ,transfer_batch_size
43 ,r.srp_rollup_flag
44 -- ,r.srp_batch_size
45 ,r.cls_package_size
46 -- ,r.salesrep_batch_size
47 ,r.system_start_period_id
48 ,r.system_start_date
49 ,r.set_of_books_id
50 ,s.currency_code
51 INTO g_repository_id
52 ,g_curr_period_id
53 ,g_curr_period_name
54 ,g_curr_period_start_date
55 ,g_curr_period_end_date
56 ,g_rev_class_hierarchy_id
57 ,g_srp_rollup_hierarchy_id
58 ,g_system_batch_size
59 ,g_transfer_batch_size
60 ,g_srp_rollup_flag
61 -- ,g_srp_batch_size
62 ,g_cls_package_size
63 -- ,g_salesrep_batch_size
64 ,g_system_start_period_id
65 ,g_system_start_date
66 ,g_set_of_books_id
67 ,gl_currency_code
68 FROM cn_period_statuses_all p
69 ,cn_repositories r
70 ,gl_sets_of_books s
71 WHERE r.current_period_id = p.period_id(+)
72 AND r.org_id = p.org_id(+)
73 AND r.application_id = 283
74 AND r.org_id = p_org_id
75 AND r.set_of_books_id = s.set_of_books_id;
76
77 fnd_currency.get_info(gl_currency_code,
78 g_precision,
79 g_ext_precision,
80 g_min_acct_unit);
81 EXCEPTION
82 WHEN no_data_found THEN
83 fnd_message.set_name('CN','ALL_NO_INSTANCE_INFO');
84 app_exception.raise_exception;
85 END initialize_instance_info;
86
87 FUNCTION get_currency_code(p_org_id IN NUMBER) RETURN VARCHAR2
88 IS
89 l_currency_code VARCHAR2(30);
90 BEGIN
91
92 SELECT s.currency_code
93 INTO l_currency_code
94 FROM gl_sets_of_books s
95 ,cn_repositories r
96 WHERE r.set_of_books_id = s.set_of_books_id
97 AND r.application_id = 283
98 AND r.org_id = p_org_id
99 ;
100
101
102 RETURN l_currency_code;
103
104 EXCEPTION
105 WHEN no_data_found THEN
106 fnd_message.set_name('CN','ALL_NO_INSTANCE_INFO');
107 app_exception.raise_exception;
108 END;
109
110
111 --Function added by Sundar Venkat on 05 Mar 2002
112 --This is done to fetch batch size from the database
113 --This is used in the procedure posting_details
114 FUNCTION get_srp_batch_size(p_org_id IN NUMBER) RETURN NUMBER
115 IS
116 l_srp_batch_size number;
117 BEGIN
118 SELECT srp_batch_size
119 INTO l_srp_batch_size
120 FROM cn_repositories
121 WHERE org_id = p_org_id ;
122 RETURN l_srp_batch_size;
123 EXCEPTION
124 WHEN no_data_found THEN
125 fnd_message.set_name('CN','ALL_NO_INSTANCE_INFO');
126 app_exception.raise_exception;
127 END;
128
129
130 -- a change was made by Sundar Venkat on 05 Mar 2002 in the following section
131 -- the global variable g_srp_batch_size was removed
132
133 FUNCTION get_salesrep_batch_size(p_org_id IN NUMBER) RETURN NUMBER
134 IS
135 l_salesrep_batch_size NUMBER;
136 BEGIN
137
138 SELECT r.salesrep_batch_size
139 INTO l_salesrep_batch_size
140 FROM cn_repositories r
141 WHERE r.org_id = p_org_id;
142
143
144 RETURN l_salesrep_batch_size;
145
146 EXCEPTION
147 WHEN no_data_found THEN
148 fnd_message.set_name('CN','ALL_NO_INSTANCE_INFO');
149 app_exception.raise_exception;
150 END;
151
152 END cn_global_var;