[Home] [Help]
PACKAGE BODY: APPS.ARP_GLOBAL
Source
1 PACKAGE BODY ARP_GLOBAL AS
2 /*$Header: ARCUGLBB.pls 120.6.12010000.2 2008/11/05 06:22:43 ankuagar ship $*/
3
4 l_sob_test gl_sets_of_books.set_of_books_id%type; --temp variable for error testing
5
6 --
7 PROCEDURE INIT_GLOBAL(p_org_id number default null) IS
8 l_gr ar_mo_cache_utils.GlobalsRecord;
9 l_count PLS_INTEGER;
10 l_default_org_id NUMBER;
11 l_default_ou_name mo_glob_org_access_tmp.organization_name%type; --Bug Fix 6814490
12
13 BEGIN
14 --
15 arp_util.debug( 'arp_global.init_global()+' );
16 --
17 user_id := nvl(FND_GLOBAL.user_id,-1);
18 created_by := nvl(FND_GLOBAL.user_id,-1);
19 creation_date := SYSDATE;
20 last_updated_by := nvl(FND_GLOBAL.user_id,-1);
21 last_update_date := SYSDATE;
22 last_update_login := nvl(FND_GLOBAL.conc_login_id,FND_GLOBAL.login_id);
23 --
24 IF ( FND_GLOBAL.conc_request_id = -1 ) OR
25 ( FND_GLOBAL.conc_request_id IS NULL )
26 THEN
27 request_id := NULL;
28 ELSE
29 request_id := FND_GLOBAL.conc_request_id;
30 END IF;
31 --
32 IF ( FND_GLOBAL.conc_program_id = -1 ) OR
33 ( FND_GLOBAL.conc_program_id IS NULL )
34 THEN
35 program_id := NULL;
36 ELSE
37 program_id := FND_GLOBAL.conc_program_id;
38 END IF;
39 --
40 IF ( FND_GLOBAL.prog_appl_id = -1 ) OR
41 ( FND_GLOBAL.prog_appl_id IS NULL )
42 THEN
43 program_application_id := NULL;
44 ELSE
45 program_application_id := FND_GLOBAL.prog_appl_id;
46 END IF;
47 --
48 IF ( program_id IS NULL )
49 THEN
50 program_update_date := NULL;
51 ELSE
52 program_update_date := SYSDATE;
53 END IF;
54
55 --Populate global variable sysparam
56 /* --------------------------------------------------------------------------------
57 If you pass p_org_id to INIT_GLOBAL it will the set the current org to p_org_id
58 else it will get the default org_id based on mo_utils.get_default_ou output
59 --------------------------------------------------------------------------------- */
60
61 IF p_org_id is NOT NULL then
62 ar_mo_global_cache.set_current_org_id(p_org_id);
63 ELSE
64 IF ARP_STANDARD.sysparm.org_id is NULL then
65 mo_utils.get_default_ou(l_default_org_id,l_default_ou_name,l_count);
66 ELSE
67 l_default_org_id := ARP_STANDARD.sysparm.org_id;
68 END IF;
69
70 IF l_default_org_id is null then
71 begin
72 select min(org_id) into l_default_org_id from ar_system_parameters;
73 end;
74 end if;
75 END IF;
76
77 /* --------------------------------------------------------------------------------
78 Get the cached attribute info for the org you pass p_org_id to INIT_GLOBAL into
79 Local Variable l_gr
80 --------------------------------------------------------------------------------- */
81
82 l_gr := ar_mo_global_cache.get_org_attributes(nvl(p_org_id,l_default_org_id));
83
84 /* --------------------------------------------------------------------------------
85 Begin populate all attribute of global variable, sysparm of ar_system_parameters%rowtype
86 from Local Variable, l_gr, retieved from cache for the passed org
87 --------------------------------------------------------------------------------- */
88
89 ARP_GLOBAL.sysparam.org_id := l_gr.org_id;
90 ARP_GLOBAL.sysparam.set_of_books_id := l_gr.set_of_books_id;
91 ARP_GLOBAL.sysparam.accounting_method := l_gr.accounting_method;
92 ARP_GLOBAL.sysparam.accrue_interest := l_gr.accrue_interest;
93 ARP_GLOBAL.sysparam.unearned_discount := l_gr.unearned_discount;
94 ARP_GLOBAL.sysparam.partial_discount_flag := l_gr.partial_discount_flag;
95 ARP_GLOBAL.sysparam.print_remit_to := l_gr.print_remit_to;
96 ARP_GLOBAL.sysparam.default_cb_due_date := l_gr.default_cb_due_date;
97 ARP_GLOBAL.sysparam.auto_site_numbering := l_gr.auto_site_numbering;
98 ARP_GLOBAL.sysparam.cash_basis_set_of_books_id := l_gr.cash_basis_set_of_books_id;
99 ARP_GLOBAL.sysparam.code_combination_id_gain := l_gr.code_combination_id_gain;
100 ARP_GLOBAL.sysparam.autocash_hierarchy_id := l_gr.autocash_hierarchy_id;
101 ARP_GLOBAL.sysparam.run_gl_journal_import_flag := l_gr.run_gl_journal_import_flag;
102 ARP_GLOBAL.sysparam.cer_split_amount := l_gr.cer_split_amount;
103 ARP_GLOBAL.sysparam.cer_dso_days := l_gr.cer_dso_days;
104
105 ARP_GLOBAL.sysparam.posting_days_per_cycle := l_gr.posting_days_per_cycle;
106 ARP_GLOBAL.sysparam.address_validation := l_gr.address_validation;
107 ARP_GLOBAL.sysparam.calc_discount_on_lines_flag:= l_gr.calc_discount_on_lines_flag;
108 ARP_GLOBAL.sysparam.change_printed_invoice_flag:= l_gr.change_printed_invoice_flag;
109 ARP_GLOBAL.sysparam.code_combination_id_loss := l_gr.code_combination_id_loss;
110 ARP_GLOBAL.sysparam.create_reciprocal_flag := l_gr.create_reciprocal_flag;
111 ARP_GLOBAL.sysparam.default_country := l_gr.default_country;
112 ARP_GLOBAL.sysparam.default_territory := l_gr.default_territory;
113
114 ARP_GLOBAL.sysparam.generate_customer_number := l_gr.generate_customer_number;
115 ARP_GLOBAL.sysparam.invoice_deletion_flag := l_gr.invoice_deletion_flag;
116 ARP_GLOBAL.sysparam.location_structure_id := l_gr.location_structure_id;
117 ARP_GLOBAL.sysparam.site_required_flag := l_gr.site_required_flag;
118 ARP_GLOBAL.sysparam.tax_allow_compound_flag := l_gr.tax_allow_compound_flag;
119 ARP_GLOBAL.sysparam.tax_header_level_flag := l_gr.tax_header_level_flag;
120 ARP_GLOBAL.sysparam.tax_rounding_allow_override:= l_gr.tax_rounding_allow_override;
121 ARP_GLOBAL.sysparam.tax_invoice_print := l_gr.tax_invoice_print;
122 ARP_GLOBAL.sysparam.tax_method := l_gr.tax_method;
123
124 ARP_GLOBAL.sysparam.tax_use_customer_exempt_flag:= l_gr.tax_use_customer_exempt_flag;
125 ARP_GLOBAL.sysparam.tax_use_cust_exc_rate_flag := l_gr.tax_use_cust_exc_rate_flag;
126 ARP_GLOBAL.sysparam.tax_use_loc_exc_rate_flag := l_gr.tax_use_loc_exc_rate_flag;
127 ARP_GLOBAL.sysparam.tax_use_product_exempt_flag:= l_gr.tax_use_product_exempt_flag;
128 ARP_GLOBAL.sysparam.tax_use_prod_exc_rate_flag := l_gr.tax_use_prod_exc_rate_flag;
129 ARP_GLOBAL.sysparam.tax_use_site_exc_rate_flag := l_gr.tax_use_site_exc_rate_flag;
130 ARP_GLOBAL.sysparam.ai_log_file_message_level := l_gr.ai_log_file_message_level;
131 ARP_GLOBAL.sysparam.ai_max_memory_in_bytes := l_gr.ai_max_memory_in_bytes;
132
133 ARP_GLOBAL.sysparam.ai_acct_flex_key_left_prompt:= l_gr.ai_acct_flex_key_left_prompt;
134 ARP_GLOBAL.sysparam.ai_mtl_items_key_left_prompt:= l_gr.ai_mtl_items_key_left_prompt;
135 ARP_GLOBAL.sysparam.ai_territory_key_left_prompt:= l_gr.ai_territory_key_left_prompt;
136 ARP_GLOBAL.sysparam.ai_purge_interface_tables_flag:= l_gr.ai_purge_int_tables_flag;
137 ARP_GLOBAL.sysparam.ai_activate_sql_trace_flag := l_gr.ai_activate_sql_trace_flag;
138 ARP_GLOBAL.sysparam.default_grouping_rule_id := l_gr.default_grouping_rule_id;
139 ARP_GLOBAL.sysparam.salesrep_required_flag := l_gr.salesrep_required_flag;
140
141 ARP_GLOBAL.sysparam.auto_rec_invoices_per_commit:= l_gr.auto_rec_invoices_per_commit;
142 ARP_GLOBAL.sysparam.auto_rec_receipts_per_commit:= l_gr.auto_rec_receipts_per_commit;
143 ARP_GLOBAL.sysparam.pay_unrelated_invoices_flag:= l_gr.pay_unrelated_invoices_flag;
144 ARP_GLOBAL.sysparam.print_home_country_flag := l_gr.print_home_country_flag;
145 ARP_GLOBAL.sysparam.location_tax_account := l_gr.location_tax_account;
146 ARP_GLOBAL.sysparam.from_postal_code := l_gr.from_postal_code;
147 ARP_GLOBAL.sysparam.to_postal_code := l_gr.to_postal_code;
148
149 ARP_GLOBAL.sysparam.tax_registration_number := l_gr.tax_registration_number;
150 ARP_GLOBAL.sysparam.populate_gl_segments_flag := l_gr.populate_gl_segments_flag;
151 ARP_GLOBAL.sysparam.unallocated_revenue_ccid := l_gr.unallocated_revenue_ccid;
152
153 ARP_GLOBAL.sysparam.inclusive_tax_used := l_gr.inclusive_tax_used;
154 ARP_GLOBAL.sysparam.tax_enforce_account_flag := l_gr.tax_enforce_account_flag;
155
156 ARP_GLOBAL.sysparam.ta_installed_flag := l_gr.ta_installed_flag;
157 ARP_GLOBAL.sysparam.bills_receivable_enabled_flag:= l_gr.br_enabled_flag;
158
159 ARP_GLOBAL.sysparam.attribute_category := l_gr.attribute_category;
160 ARP_GLOBAL.sysparam.attribute1 := l_gr.attribute1;
161 ARP_GLOBAL.sysparam.attribute2 := l_gr.attribute2;
162 ARP_GLOBAL.sysparam.attribute3 := l_gr.attribute3;
163 ARP_GLOBAL.sysparam.attribute4 := l_gr.attribute4;
164 ARP_GLOBAL.sysparam.attribute5 := l_gr.attribute5;
165 ARP_GLOBAL.sysparam.attribute6 := l_gr.attribute6;
166 ARP_GLOBAL.sysparam.attribute7 := l_gr.attribute7;
167 ARP_GLOBAL.sysparam.attribute8 := l_gr.attribute8;
168 ARP_GLOBAL.sysparam.attribute9 := l_gr.attribute9;
169 ARP_GLOBAL.sysparam.attribute10 := l_gr.attribute10;
170 ARP_GLOBAL.sysparam.attribute11 := l_gr.attribute11;
171 ARP_GLOBAL.sysparam.attribute12 := l_gr.attribute12;
172 ARP_GLOBAL.sysparam.attribute13 := l_gr.attribute13;
173 ARP_GLOBAL.sysparam.attribute14 := l_gr.attribute14;
174 ARP_GLOBAL.sysparam.attribute15 := l_gr.attribute15;
175
176 ARP_GLOBAL.sysparam.created_by := l_gr.created_by;
177 ARP_GLOBAL.sysparam.creation_date := l_gr.creation_date;
178 ARP_GLOBAL.sysparam.last_updated_by := l_gr.last_updated_by;
179 ARP_GLOBAL.sysparam.last_update_date := l_gr.last_update_date;
180 ARP_GLOBAL.sysparam.last_update_login := l_gr.last_update_login;
181
182 ARP_GLOBAL.sysparam.tax_code := l_gr.tax_code;
183 ARP_GLOBAL.sysparam.tax_currency_code := l_gr.tax_currency_code;
184 ARP_GLOBAL.sysparam.tax_minimum_accountable_unit:= l_gr.tax_minimum_accountable_unit;
185 ARP_GLOBAL.sysparam.tax_precision := l_gr.tax_precision;
186 ARP_GLOBAL.sysparam.tax_rounding_rule := l_gr.tax_rounding_rule;
187 ARP_GLOBAL.sysparam.tax_use_account_exc_rate_flag:= l_gr.tax_use_acc_exc_rate_flag;
188 ARP_GLOBAL.sysparam.tax_use_system_exc_rate_flag:= l_gr.tax_use_system_exc_rate_flag;
189 ARP_GLOBAL.sysparam.tax_hier_site_exc_rate := l_gr.tax_hier_site_exc_rate;
190 ARP_GLOBAL.sysparam.tax_hier_cust_exc_rate := l_gr.tax_hier_cust_exc_rate;
191 ARP_GLOBAL.sysparam.tax_hier_prod_exc_rate := l_gr.tax_hier_prod_exc_rate;
192 ARP_GLOBAL.sysparam.tax_hier_account_exc_rate := l_gr.tax_hier_account_exc_rate;
193 ARP_GLOBAL.sysparam.tax_hier_system_exc_rate := l_gr.tax_hier_system_exc_rate;
194 ARP_GLOBAL.sysparam.tax_database_view_set := l_gr.tax_database_view_set;
195
196 ARP_GLOBAL.sysparam.global_attribute1 := l_gr.global_attribute1;
197 ARP_GLOBAL.sysparam.global_attribute2 := l_gr.global_attribute2;
198 ARP_GLOBAL.sysparam.global_attribute3 := l_gr.global_attribute3;
199 ARP_GLOBAL.sysparam.global_attribute4 := l_gr.global_attribute4;
200 ARP_GLOBAL.sysparam.global_attribute5 := l_gr.global_attribute5;
201 ARP_GLOBAL.sysparam.global_attribute6 := l_gr.global_attribute6;
202 ARP_GLOBAL.sysparam.global_attribute7 := l_gr.global_attribute7;
203 ARP_GLOBAL.sysparam.global_attribute8 := l_gr.global_attribute8;
204 ARP_GLOBAL.sysparam.global_attribute9 := l_gr.global_attribute9;
205 ARP_GLOBAL.sysparam.global_attribute10 := l_gr.global_attribute10;
206 ARP_GLOBAL.sysparam.global_attribute11 := l_gr.global_attribute11;
207 ARP_GLOBAL.sysparam.global_attribute12 := l_gr.global_attribute12;
208 ARP_GLOBAL.sysparam.global_attribute13 := l_gr.global_attribute13;
209 ARP_GLOBAL.sysparam.global_attribute14 := l_gr.global_attribute14;
210 ARP_GLOBAL.sysparam.global_attribute15 := l_gr.global_attribute15;
211 ARP_GLOBAL.sysparam.global_attribute16 := l_gr.global_attribute16;
212 ARP_GLOBAL.sysparam.global_attribute17 := l_gr.global_attribute17;
213 ARP_GLOBAL.sysparam.global_attribute18 := l_gr.global_attribute18;
214 ARP_GLOBAL.sysparam.global_attribute19 := l_gr.global_attribute19;
215 ARP_GLOBAL.sysparam.global_attribute20 := l_gr.global_attribute20;
216 ARP_GLOBAL.sysparam.global_attribute_category := l_gr.global_attribute_category;
217
218 ARP_GLOBAL.sysparam.rule_set_id := l_gr.rule_set_id;
219 ARP_GLOBAL.sysparam.code_combination_id_round := l_gr.code_combination_id_round;
220 ARP_GLOBAL.sysparam.trx_header_level_rounding := l_gr.trx_header_level_rounding;
221 ARP_GLOBAL.sysparam.trx_header_round_ccid := l_gr.trx_header_round_ccid;
222 ARP_GLOBAL.sysparam.finchrg_receivables_trx_id := l_gr.finchrg_receivables_trx_id;
223 ARP_GLOBAL.sysparam.sales_tax_geocode := l_gr.sales_tax_geocode;
224 ARP_GLOBAL.sysparam.rev_transfer_clear_ccid := l_gr.rev_transfer_clear_ccid;
225 ARP_GLOBAL.sysparam.sales_credit_pct_limit := l_gr.sales_credit_pct_limit;
226 ARP_GLOBAL.sysparam.max_wrtoff_amount := l_gr.max_wrtoff_amount;
227 ARP_GLOBAL.sysparam.irec_cc_receipt_method_id := l_gr.irec_cc_receipt_method_id;
228 ARP_GLOBAL.sysparam.show_billing_number_flag := l_gr.show_billing_number_flag;
229 ARP_GLOBAL.sysparam.cross_currency_rate_type := l_gr.cross_currency_rate_type;
230 ARP_GLOBAL.sysparam.document_seq_gen_level := l_gr.document_seq_gen_level;
231 ARP_GLOBAL.sysparam.calc_tax_on_credit_memo_flag:= l_gr.calc_tax_on_credit_memo_flag;
232 ARP_GLOBAL.sysparam.calc_tax_on_credit_memo_flag:= l_gr.calc_tax_on_credit_memo_flag;
233 ARP_GLOBAL.sysparam.IREC_BA_RECEIPT_METHOD_ID := l_gr.IREC_BA_RECEIPT_METHOD_ID;
234 ARP_GLOBAL.sysparam.payment_threshold := l_gr.payment_threshold;
235 ARP_GLOBAL.sysparam.standard_refund := l_gr.standard_refund;
236 ARP_GLOBAL.sysparam.credit_classification1 := l_gr.credit_classification1;
237 ARP_GLOBAL.sysparam.credit_classification2 := l_gr.credit_classification2;
238 ARP_GLOBAL.sysparam.credit_classification3 := l_gr.credit_classification3;
239 ARP_GLOBAL.sysparam.unmtch_claim_creation_flag := l_gr.unmtch_claim_creation_flag;
240 ARP_GLOBAL.sysparam.matched_claim_creation_flag := l_gr.matched_claim_creation_flag;
241 ARP_GLOBAL.sysparam.matched_claim_excl_cm_flag := l_gr.matched_claim_excl_cm_flag;
242 ARP_GLOBAL.sysparam.min_wrtoff_amount := l_gr.min_wrtoff_amount;
243 ARP_GLOBAL.sysparam.min_refund_amount := l_gr.min_refund_amount;
244
245 ARP_GLOBAL.set_of_books_id := l_gr.set_of_books_id;
246 ARP_GLOBAL.chart_of_accounts_id := l_gr.chart_of_accounts_id;
247 ARP_GLOBAL.functional_currency := l_gr.currency_code;
248 ARP_GLOBAL.period_set_name := l_gr.period_set_name;
249 ARP_GLOBAL.base_precision := l_gr.base_precision;
250 ARP_GLOBAL.base_min_acc_unit := l_gr.base_MIN_ACCOUNTABLE_UNIT;
251
252 -- Bug 3251839 - tm_installed_flag global is set to prevent repeated
253 -- calls to ozf check_installed function; likewise tm_default_setup_flag
254 tm_installed_flag := l_gr.tm_installed_flag;
255 tm_default_setup_flag := l_gr.tm_default_setup_flag;
256
257 arp_trx_global.init;
258
259 --
260 arp_util.debug( 'arp_global.init_global()-' );
261 --
262
263 EXCEPTION
264 WHEN OTHERS THEN
265 arp_util.debug( 'EXCEPTION: arp_global.init_global' );
266 RAISE;
267 --
268
269 END INIT_GLOBAL;
270
271 /* Bug 3251839 - function added to make tm_installed_flag available to forms */
272 FUNCTION TM_INSTALLED RETURN VARCHAR2
273 IS
274 BEGIN
275 RETURN tm_installed_flag;
276 END;
277
278 BEGIN
279
280 /* Bug 1679088 : define new public procedure, this process can be
281 called from other modules to run initialization whenever required */
282 arp_standard.debug('Initialisation section ARP_GLOBAL.INIT_GLOBAL()');
283
284 /* Bug 4624926 API failing in R12-Starts*/
288 ELSE
285 IF mo_global.get_current_org_id is null then
286
287 ARP_GLOBAL.INIT_GLOBAL;
289
290 ARP_GLOBAL.INIT_GLOBAL(mo_global.get_current_org_id);
291 END IF;
292 /* Bug 4624926 API failing in R12-Ends*/
293 /*Bug 3678916*/
294
295 IF fnd_global.conc_program_id IS NOT NULL
296 THEN
297 BEGIN
298
299 SELECT concurrent_program_name
300 INTO conc_program_name
301 FROM fnd_concurrent_programs_vl
302 WHERE concurrent_program_id = fnd_global.conc_program_id
303 AND application_id = 222;
304
305 EXCEPTION
306 WHEN others THEN
307 conc_program_name := 'NONE';
308 END;
309 END IF;
310
311 END ARP_GLOBAL;