DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_MC_UPG_SELECT_PKG

Source


1 PACKAGE BODY FA_MC_UPG_SELECT_PKG AS
2 /* $Header: faxmcusb.pls 120.3 2005/10/07 14:04:13 bridgway ship $  */
3 
4 g_print_debug boolean := fa_cache_pkg.fa_print_debug;
5 
6 PROCEDURE main_select(
7                         errbuf                  OUT NOCOPY     VARCHAR2,
8                         retcode                 OUT NOCOPY     NUMBER,
9 			p_book_type_code 	IN	VARCHAR2,
10 			p_reporting_book	IN	VARCHAR2) IS
11 
12 	X_start_pc		NUMBER;
13 	X_end_pc		NUMBER;
14 	X_conv_date		DATE;
15 	X_conv_type		VARCHAR2(30);
16 	X_accounting_date	DATE;
17 	l_rbook			VARCHAR2(30);
18 	l_fcurrency		VARCHAR2(15);
19 	l_tcurrency     	VARCHAR2(15);
20 	l_rsob_id		NUMBER;
21 	l_psob_id		NUMBER;
22 	l_denominator		NUMBER;
23 	l_numerator		NUMBER;
24 	l_rate			NUMBER;
25 	l_relation		VARCHAR2(30);
26 	l_fixed_rate		VARCHAR2(1);
27 	X_total_assets		NUMBER;
28 	p_msg_count		NUMBER := 0;
29 	p_msg_data		VARCHAR2(512);
30 
31 
32 BEGIN
33 	fa_rx_conc_mesg_pkg.log('Selecting Assets For Conversion from ');
34 	fa_rx_conc_mesg_pkg.log('Primary Book: ' || p_book_type_code || ' TO');
35 	fa_rx_conc_mesg_pkg.log('Reporting Book: ' || p_reporting_book);
36 	fa_rx_conc_mesg_pkg.log('-------------------------------------------');
37 
38 
39 	FA_SRVR_MSG.Init_Server_Message;
40 	FA_DEBUG_PKG.initialize;
41 	-- FA_DEBUG_PKG.Set_Debug_Flag;
42 
43   	fa_mc_upg1_pkg.validate_setup(
44 				p_book_type_code,
45 				p_reporting_book,
46 				l_fcurrency,
47 				l_tcurrency,
48 				l_rsob_id,
49 				l_psob_id);
50 
51 	fa_mc_upg1_pkg.get_conversion_info(
52 				p_book_type_code,
53 				l_psob_id,
54 				l_rsob_id,
55 				X_start_pc,
56 				X_end_pc,
57 				X_conv_date,
58 				X_conv_type,
59 				X_accounting_date);
60 
61 	fa_mc_upg1_pkg.get_rate_info(
62                         	l_fcurrency,
63                         	l_tcurrency,
64                         	X_conv_date,
65                         	X_conv_type,
66                         	l_denominator,
67                         	l_numerator,
68                         	l_rate,
69                         	l_relation,
70 				l_fixed_rate);
71 
72         fa_mc_upg1_pkg.set_conversion_status(
73 				p_book_type_code,
74                                 l_rsob_id,
75 				X_start_pc,
76                                 X_end_pc,
77 				NULL,
78 				'S');
79 
80 	fa_mc_upg1_pkg.get_candidate_assets(
81 				p_book_type_code,
82 				l_rsob_id,
83 				X_start_pc,
84 				X_end_pc,
85 				l_rate,
86 				l_fixed_rate,
87 				X_total_assets);
88 
89         fa_srvr_msg.add_message(
90                 calling_fn => 'fa_mc_upg_select_pkg.main_select',
91                 name       => 'FA_SHARED_NUMBER_PROCESSED',
92                 token1     => 'NUMBER',
93                 value1     => to_char(X_total_assets));
94 
95         fa_srvr_msg.add_message(
96 		calling_fn => 'fa_mc_upg_select_pkg.main_select',
97                 name       => 'FA_SHARED_END_SUCCESS',
98                 token1     => 'PROGRAM',
99                 value1     => 'FAMRCUPG1');
100 
101         -- Dump debug messages when run in debug mode
102         IF (g_print_debug) THEN
103             fa_mc_upg1_pkg.Write_DebugMsg_Log(
104                                         p_msg_count);
105         END IF;
106 
107 
108 	-- write messages on message stack to log file
109         FND_MSG_PUB.Count_And_Get(
110                 p_count                => p_msg_count,
111                 p_data                 => p_msg_data);
112 
113         fa_mc_upg1_pkg.Write_ErrMsg_Log(p_msg_count);
114 
115 	-- pass success to concurrent manager
116 	retcode := 0;
117 
118 EXCEPTION
119 	WHEN OTHERS THEN
120 
121 		fa_srvr_msg.add_message(
122 			calling_fn => 'fa_mc_upg_select_pkg.main_select',
123 			name 	   => 'FA_SHARED_END_WITH_ERROR',
124 			token1	   => 'PROGRAM',
125 			value1     => 'FAMRCUPG1');
126 
127                 IF (g_print_debug) THEN
128                    fa_mc_upg1_pkg.Write_DebugMsg_Log(
129                                         p_msg_count);
130                 END IF;
131 
132       		FND_MSG_PUB.Count_And_Get(
133          		p_count                => p_msg_count,
134          		p_data                 => p_msg_data);
135 
136 		fa_mc_upg1_pkg.Write_ErrMsg_Log(
137 					p_msg_count);
138 
139 		-- pass error to concurrent manager
140 		retcode := 2;
141 
142 END main_select;
143 
144 END FA_MC_UPG_SELECT_PKG;