1 PACKAGE BODY arp_cache_util AS
2 /* $Header: ARXCAUTB.pls 120.2.12010000.1 2008/07/24 16:59:50 appldev ship $ */
3
4 PG_DEBUG varchar2(1) := NVL(FND_PROFILE.value('AFLOG_ENABLED'), 'N');
5
6 PROCEDURE refresh_cache IS
7
8 BEGIN
9
10 IF PG_DEBUG = 'Y' THEN
11 arp_util.debug('arp_cache_util.Refresh_Cache()+');
12 END IF;
13
14 -- if the org_id has not changed, then do nothing, return.
15 -- arp_global.init_global is called in several places, so not
16 -- relying on sysparam record type, but checking if the all other
17 -- cache/global variables are refreshed
18
19 IF (arp_trx_global.system_info.system_parameters.org_id is null
20 and ((substrb(userenv('CLIENT_INFO'),1,1) = ' ')
21 or (userenv('CLIENT_INFO') is null))) THEN
22 IF PG_DEBUG = 'Y' THEN
23 arp_util.debug('Non Multi-Org; '||
24 'Trx Global org_id is null as well as CLIENT_INFO org');
25 END IF;
26
27 IF arp_trx_global.system_info.system_parameters.set_of_books_id IS NOT NULL THEN
28 IF PG_DEBUG = 'Y' THEN
29 arp_util.debug('Non Multi-Org and cache exists ');
30 arp_util.debug('SOB from arp_global is '|| arp_global.sysparam.set_of_books_id
31 || ' , SOB from trx_global is '|| arp_trx_global.system_info.system_parameters.set_of_books_id);
32 arp_util.debug('Not Refreshing Cache');
33 END IF;
34
35 return;
36
37 END IF;
38 --5885313 compare with current operating unit because ARP_GLOBal itself initialized arp_trx_global
39 ELSIF ( (arp_trx_global.system_info.system_parameters.org_id is not null)
40 and (substrb(userenv('CLIENT_INFO'),1,1) <> ' ')
41 and (pg_old_org_id =
42 to_number(substrb(userenv('CLIENT_INFO'),1,10)))) THEN
43 IF PG_DEBUG = 'Y' THEN
44 arp_util.debug('Org from CLIENT_INFO matches Trx Global org');
45 arp_util.debug(' Org from arp_global is ' || arp_global.sysparam.org_id
46 || ' , SOB from arp_global is '|| arp_global.sysparam.set_of_books_id
47 || ' , SOB from trx_global is '|| arp_trx_global.system_info.system_parameters.set_of_books_id);
48 arp_util.debug('Not Refreshing Cache');
49 END IF;
50 return;
51 END IF;
52
53 -- Otherwise cache does not exist or
54 -- Cache is incorrect, so need to be refreshed
55
56 IF PG_DEBUG = 'Y' THEN
57 arp_util.debug('Refreshing Cache');
58 END IF;
59
60 ARP_TRX_GLOBAL.init;
61 ARP_PROCESS_CREDIT_UTIL.init;
62 ARP_TRX_UTIL.init;
63 ARPCURR.init;
64 ARP_TRX_DEFAULTS_2.init;
65 ARP_TRX_DEFAULTS_3.init;
66 ARP_PROCESS_CREDIT.init;
67 ARP_AUTO_ACCOUNTING.init;
68 ARP_PROCESS_HEADER.init;
69 ARP_CTLS_PKG.init;
70 ARP_PROCESS_FREIGHT.init;
71 ARP_CREDIT_MEMO_MODULE.init;
72 -- ARP_TAX.initialize; -- obsolete
73 ARP_PROCESS_HEADER_POST_COMMIT.init;
74 ARP_TRX_VALIDATE.init;
75 ARP_TRX_COMPLETE_CHK.init;
76 ARP_MAINTAIN_PS.init;
77 ARP_MAINTAIN_PS2.init;
78 -- AR_MC_INFO.init; -- obsolete
79 --5885313 set variable to current org
80 PG_OLD_ORG_ID := arp_trx_global.system_info.system_parameters.org_id;
81 IF PG_DEBUG = 'Y' THEN
82 arp_util.debug('arp_cache_util.Refresh_Cache()-');
83 END IF;
84
85 END refresh_cache;
86
87 END arp_cache_util;