[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.4 2009/03/27 09:43:29 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 FA_SRVR_MSG.Init_Server_Message;
39 FA_DEBUG_PKG.initialize;
40 -- FA_DEBUG_PKG.Set_Debug_Flag;
41
42 fa_mc_upg1_pkg.validate_setup(
43 p_book_type_code,
44 p_reporting_book,
45 l_fcurrency,
46 l_tcurrency,
47 l_rsob_id,
48 l_psob_id);
49
50 fa_mc_upg1_pkg.get_conversion_info(
51 p_book_type_code,
52 l_psob_id,
53 l_rsob_id,
54 X_start_pc,
55 X_end_pc,
56 X_conv_date,
57 X_conv_type,
58 X_accounting_date);
59
60 fa_mc_upg1_pkg.get_rate_info(
61 l_fcurrency,
62 l_tcurrency,
63 X_conv_date,
64 X_conv_type,
65 l_denominator,
66 l_numerator,
67 l_rate,
68 l_relation,
69 l_fixed_rate);
70
71 fa_mc_upg1_pkg.set_conversion_status(
72 p_book_type_code,
73 l_rsob_id,
74 X_start_pc,
75 X_end_pc,
76 NULL,
77 'S');
78
79 fa_mc_upg1_pkg.get_candidate_assets(
80 p_book_type_code,
81 l_rsob_id,
82 X_start_pc,
83 X_end_pc,
84 l_rate,
85 l_fixed_rate,
86 X_total_assets);
87
88 fa_srvr_msg.add_message(
89 calling_fn => 'fa_mc_upg_select_pkg.main_select',
90 name => 'FA_SHARED_NUMBER_PROCESSED',
91 token1 => 'NUMBER',
92 value1 => to_char(X_total_assets));
93
94 fa_srvr_msg.add_message(
95 calling_fn => 'fa_mc_upg_select_pkg.main_select',
96 name => 'FA_SHARED_END_SUCCESS',
97 token1 => 'PROGRAM',
98 value1 => 'FAMRCUPG1');
99
100 -- Dump debug messages when run in debug mode
101 IF (g_print_debug) THEN
102 fa_mc_upg1_pkg.Write_DebugMsg_Log(
103 p_msg_count);
104 END IF;
105
106
107 -- write messages on message stack to log file
108 FND_MSG_PUB.Count_And_Get(
109 p_count => p_msg_count,
110 p_data => p_msg_data);
111
112 fa_mc_upg1_pkg.Write_ErrMsg_Log(p_msg_count);
113
114 -- pass success to concurrent manager
115 retcode := 0;
116
117 EXCEPTION
118 WHEN OTHERS THEN
119
120 fa_srvr_msg.add_message(
121 calling_fn => 'fa_mc_upg_select_pkg.main_select',
122 name => 'FA_SHARED_END_WITH_ERROR',
123 token1 => 'PROGRAM',
124 value1 => 'FAMRCUPG1');
125
126 IF (g_print_debug) THEN
127 fa_mc_upg1_pkg.Write_DebugMsg_Log(
128 p_msg_count);
129 END IF;
130
131 FND_MSG_PUB.Count_And_Get(
132 p_count => p_msg_count,
133 p_data => p_msg_data);
134
135 fa_mc_upg1_pkg.Write_ErrMsg_Log(
136 p_msg_count);
137
138 -- pass error to concurrent manager
139 retcode := 2;
140
141 END main_select;
142
143 END FA_MC_UPG_SELECT_PKG;