76: * This procedure calls the org_rollup_pagl_period_type procedure for
77: * period types 'PA' and 'GL' and org_rollup_ge_period_type for period
78: * type 'GE'.
79: */
80: P_DEBUG_MODE varchar2(1) := NVL(FND_PROFILE.value('PA_DEBUG_MODE'), 'N'); /* Added Debug Profile Option variable initialization for bug#2674619 */
81:
82: PROCEDURE refresh_org_hierarchy_rollup( p_balance_type_code IN VARCHAR2)
83: IS
84: l_pa_period_flag pa_utilization_options.pa_period_flag%TYPE := pa_rep_util_glob.G_util_option_details.G_pa_period_flag;
103: l_eff_start_gl_period_num PLS_INTEGER;
104: l_start_date DATE;
105: l_end_date DATE;
106: BEGIN
107: PA_DEBUG.set_curr_function('refresh_org_hierarchy_rollup');
108: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
109: PA_DEBUG.g_err_stage := '50:Inside refresh_org_hierarchy_rollup';
110: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
111: END IF;
105: l_end_date DATE;
106: BEGIN
107: PA_DEBUG.set_curr_function('refresh_org_hierarchy_rollup');
108: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
109: PA_DEBUG.g_err_stage := '50:Inside refresh_org_hierarchy_rollup';
110: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
111: END IF;
112: l_balance_type_code := p_balance_type_code;
113:
106: BEGIN
107: PA_DEBUG.set_curr_function('refresh_org_hierarchy_rollup');
108: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
109: PA_DEBUG.g_err_stage := '50:Inside refresh_org_hierarchy_rollup';
110: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
111: END IF;
112: l_balance_type_code := p_balance_type_code;
113:
114: IF (l_balance_type_code = 'ACTUALS') THEN
123: l_eff_start_gl_period_num := pa_rep_util_glob.G_eff_fc_start_gl_period_num;
124: END IF;
125:
126: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
127: PA_DEBUG.g_err_stage := '100:Balance Type is [' || l_balance_type_code || ']';
128: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
129: PA_DEBUG.g_err_stage := '100:Start Date is [' || TO_CHAR(l_start_date) || ']';
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
124: END IF;
125:
126: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
127: PA_DEBUG.g_err_stage := '100:Balance Type is [' || l_balance_type_code || ']';
128: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
129: PA_DEBUG.g_err_stage := '100:Start Date is [' || TO_CHAR(l_start_date) || ']';
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
125:
126: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
127: PA_DEBUG.g_err_stage := '100:Balance Type is [' || l_balance_type_code || ']';
128: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
129: PA_DEBUG.g_err_stage := '100:Start Date is [' || TO_CHAR(l_start_date) || ']';
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
126: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
127: PA_DEBUG.g_err_stage := '100:Balance Type is [' || l_balance_type_code || ']';
128: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
129: PA_DEBUG.g_err_stage := '100:Start Date is [' || TO_CHAR(l_start_date) || ']';
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
134: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
127: PA_DEBUG.g_err_stage := '100:Balance Type is [' || l_balance_type_code || ']';
128: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
129: PA_DEBUG.g_err_stage := '100:Start Date is [' || TO_CHAR(l_start_date) || ']';
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
134: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
135: PA_DEBUG.g_err_stage := '100:Effective GL start period num is [' || TO_CHAR(l_eff_start_gl_period_num) || ']';
128: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
129: PA_DEBUG.g_err_stage := '100:Start Date is [' || TO_CHAR(l_start_date) || ']';
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
134: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
135: PA_DEBUG.g_err_stage := '100:Effective GL start period num is [' || TO_CHAR(l_eff_start_gl_period_num) || ']';
136: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
129: PA_DEBUG.g_err_stage := '100:Start Date is [' || TO_CHAR(l_start_date) || ']';
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
134: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
135: PA_DEBUG.g_err_stage := '100:Effective GL start period num is [' || TO_CHAR(l_eff_start_gl_period_num) || ']';
136: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
137: END IF;
130: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
134: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
135: PA_DEBUG.g_err_stage := '100:Effective GL start period num is [' || TO_CHAR(l_eff_start_gl_period_num) || ']';
136: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
137: END IF;
138:
131: PA_DEBUG.g_err_stage := '100:End Date is [' || TO_CHAR(l_end_date) || ']';
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
134: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
135: PA_DEBUG.g_err_stage := '100:Effective GL start period num is [' || TO_CHAR(l_eff_start_gl_period_num) || ']';
136: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
137: END IF;
138:
139: /*
132: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
133: PA_DEBUG.g_err_stage := '100:Effective PA start period num is [' || TO_CHAR(l_eff_start_pa_period_num) || ']';
134: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
135: PA_DEBUG.g_err_stage := '100:Effective GL start period num is [' || TO_CHAR(l_eff_start_gl_period_num) || ']';
136: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
137: END IF;
138:
139: /*
140: * Determining the maximum level in the hierarchy for rollup.
147: AND ORG_HIERARCHY_VERSION_ID = l_org_structure_version_id
148: AND NVL(org_id, -99) = l_org_id
149: AND ROWNUM = 1;
150: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
151: PA_DEBUG.g_err_stage := '150:Maximum Level is [' || TO_CHAR(l_maximum_level) || ']';
152: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
153: END IF;
154:
155: /*
148: AND NVL(org_id, -99) = l_org_id
149: AND ROWNUM = 1;
150: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
151: PA_DEBUG.g_err_stage := '150:Maximum Level is [' || TO_CHAR(l_maximum_level) || ']';
152: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
153: END IF;
154:
155: /*
156: * Create Missing objects pa_objects for organizations.
155: /*
156: * Create Missing objects pa_objects for organizations.
157: */
158: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
159: PA_DEBUG.g_err_stage := '150:Before Calling create_missing_parent_objects';
160: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
161: END IF;
162:
163: create_missing_parent_objects(p_balance_type_code => l_balance_type_code);
156: * Create Missing objects pa_objects for organizations.
157: */
158: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
159: PA_DEBUG.g_err_stage := '150:Before Calling create_missing_parent_objects';
160: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
161: END IF;
162:
163: create_missing_parent_objects(p_balance_type_code => l_balance_type_code);
164: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
161: END IF;
162:
163: create_missing_parent_objects(p_balance_type_code => l_balance_type_code);
164: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
165: PA_DEBUG.g_err_stage := '175:After Calling create_missing_parent_objects';
166:
167: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
168: END IF;
169:
163: create_missing_parent_objects(p_balance_type_code => l_balance_type_code);
164: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
165: PA_DEBUG.g_err_stage := '175:After Calling create_missing_parent_objects';
166:
167: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
168: END IF;
169:
170: IF (l_pa_period_flag = 'Y') THEN
171:
172: /*
173: * Call the org_rollup_pagl_period_type procedure with parameters.
174: */
175: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
176: PA_DEBUG.g_err_stage := '200:Before calling org_rollup_pagl_period_type for [' || l_period_type_pa || ']';
177: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
178: END IF;
179: org_rollup_pagl_period_type( p_balance_type_code => l_balance_type_code
180: ,p_period_type => l_period_type_pa
173: * Call the org_rollup_pagl_period_type procedure with parameters.
174: */
175: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
176: PA_DEBUG.g_err_stage := '200:Before calling org_rollup_pagl_period_type for [' || l_period_type_pa || ']';
177: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
178: END IF;
179: org_rollup_pagl_period_type( p_balance_type_code => l_balance_type_code
180: ,p_period_type => l_period_type_pa
181: ,p_effective_start_period_num => l_eff_start_pa_period_num
180: ,p_period_type => l_period_type_pa
181: ,p_effective_start_period_num => l_eff_start_pa_period_num
182: );
183: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
184: PA_DEBUG.g_err_stage := '250:After calling org_rollup_pagl_period_type for [' || l_period_type_pa || ']';
185: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
186: END IF;
187:
188: END IF; -- Check for PA flag
181: ,p_effective_start_period_num => l_eff_start_pa_period_num
182: );
183: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
184: PA_DEBUG.g_err_stage := '250:After calling org_rollup_pagl_period_type for [' || l_period_type_pa || ']';
185: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
186: END IF;
187:
188: END IF; -- Check for PA flag
189:
194: * Call the org rollup procedure with parameters.
195: */
196:
197: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
198: PA_DEBUG.g_err_stage := '300:Before calling org_rollup_pagl_period_type for [' || l_period_type_gl || ']';
199: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
200: END IF;
201: org_rollup_pagl_period_type( p_balance_type_code => l_balance_type_code
202: ,p_period_type => l_period_type_gl
195: */
196:
197: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
198: PA_DEBUG.g_err_stage := '300:Before calling org_rollup_pagl_period_type for [' || l_period_type_gl || ']';
199: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
200: END IF;
201: org_rollup_pagl_period_type( p_balance_type_code => l_balance_type_code
202: ,p_period_type => l_period_type_gl
203: ,p_effective_start_period_num => l_eff_start_gl_period_num
202: ,p_period_type => l_period_type_gl
203: ,p_effective_start_period_num => l_eff_start_gl_period_num
204: );
205: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
206: PA_DEBUG.g_err_stage := '350:After calling org_rollup_pagl_period_type for [' || l_period_type_gl || ']';
207: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
208: END IF;
209:
210: END IF; -- Check for GL flag.
203: ,p_effective_start_period_num => l_eff_start_gl_period_num
204: );
205: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
206: PA_DEBUG.g_err_stage := '350:After calling org_rollup_pagl_period_type for [' || l_period_type_gl || ']';
207: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
208: END IF;
209:
210: END IF; -- Check for GL flag.
211:
213: /*
214: * Call the org rollup procedure with parameters.
215: */
216: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
217: PA_DEBUG.g_err_stage := '400:Before calling org_rollup_ge_period_type for [' || l_period_type_ge || ']';
218: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
219: END IF;
220: org_rollup_ge_period_type( p_balance_type_code => l_balance_type_code
221: ,p_period_type => l_period_type_ge
214: * Call the org rollup procedure with parameters.
215: */
216: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
217: PA_DEBUG.g_err_stage := '400:Before calling org_rollup_ge_period_type for [' || l_period_type_ge || ']';
218: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
219: END IF;
220: org_rollup_ge_period_type( p_balance_type_code => l_balance_type_code
221: ,p_period_type => l_period_type_ge
222: ,p_start_date => l_start_date
222: ,p_start_date => l_start_date
223: ,p_end_date => l_end_date
224: );
225: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
226: PA_DEBUG.g_err_stage := '450:After calling org_rollup_ge_period_type for [' || l_period_type_ge || ']';
227: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
228: END IF;
229: END IF; -- Check for GE flag.
230:
223: ,p_end_date => l_end_date
224: );
225: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
226: PA_DEBUG.g_err_stage := '450:After calling org_rollup_ge_period_type for [' || l_period_type_ge || ']';
227: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
228: END IF;
229: END IF; -- Check for GE flag.
230:
231: EXCEPTION
231: EXCEPTION
232: WHEN OTHERS THEN
233: RAISE;
234: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
235: PA_DEBUG.g_err_stage := '500:Leaving refresh_org_hierarchy_rollup';
236: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
237: END IF;
238: PA_DEBUG.reset_curr_function;
239: END refresh_org_hierarchy_rollup;
232: WHEN OTHERS THEN
233: RAISE;
234: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
235: PA_DEBUG.g_err_stage := '500:Leaving refresh_org_hierarchy_rollup';
236: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
237: END IF;
238: PA_DEBUG.reset_curr_function;
239: END refresh_org_hierarchy_rollup;
240: ----------------------------------------------------------------
234: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
235: PA_DEBUG.g_err_stage := '500:Leaving refresh_org_hierarchy_rollup';
236: PA_DEBUG.log_message('refresh_org_hierarchy_rollup: ' || PA_DEBUG.g_err_stage);
237: END IF;
238: PA_DEBUG.reset_curr_function;
239: END refresh_org_hierarchy_rollup;
240: ----------------------------------------------------------------
241: /*
242: * If the Generate Utilization process is run in the 'Refresh' mode
303: ,hier.parent_organization_id
304: ;
305:
306: BEGIN
307: pa_debug.set_curr_function('create_missing_parent_objects');
308: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
309: pa_debug.g_err_stage := '50:Inside create_missing_parent_objects';
310: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
305:
306: BEGIN
307: pa_debug.set_curr_function('create_missing_parent_objects');
308: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
309: pa_debug.g_err_stage := '50:Inside create_missing_parent_objects';
310: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
306: BEGIN
307: pa_debug.set_curr_function('create_missing_parent_objects');
308: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
309: pa_debug.g_err_stage := '50:Inside create_missing_parent_objects';
310: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
307: pa_debug.set_curr_function('create_missing_parent_objects');
308: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
309: pa_debug.g_err_stage := '50:Inside create_missing_parent_objects';
310: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
308: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
309: pa_debug.g_err_stage := '50:Inside create_missing_parent_objects';
310: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
309: pa_debug.g_err_stage := '50:Inside create_missing_parent_objects';
310: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
310: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
311: pa_debug.g_err_stage := '50:l_start_org_id = [' || to_char(l_start_org_id) || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
312: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
313: pa_debug.g_err_stage := '50:l_org_id = [' || to_char(l_org_id) || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
314: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
322: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
315: pa_debug.g_err_stage := '50:max_level = [' || to_char(l_maximum_level) || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
322: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
323: pa_debug.g_err_stage := '50:org = [' || l_obj_type_org || ']';
316: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
322: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
323: pa_debug.g_err_stage := '50:org = [' || l_obj_type_org || ']';
324: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
317: pa_debug.g_err_stage := '50:bal_type_code = [' || p_balance_type_code || ']';
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
322: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
323: pa_debug.g_err_stage := '50:org = [' || l_obj_type_org || ']';
324: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
325: END IF;
318: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
322: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
323: pa_debug.g_err_stage := '50:org = [' || l_obj_type_org || ']';
324: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
325: END IF;
326:
319: pa_debug.g_err_stage := '50:orgwt = [' || l_obj_type_orgwt || ']';
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
322: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
323: pa_debug.g_err_stage := '50:org = [' || l_obj_type_org || ']';
324: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
325: END IF;
326:
327: FOR l_level IN 2 .. l_maximum_level
320: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
321: pa_debug.g_err_stage := '50:orguc = [' || l_obj_type_orguc || ']';
322: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
323: pa_debug.g_err_stage := '50:org = [' || l_obj_type_org || ']';
324: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
325: END IF;
326:
327: FOR l_level IN 2 .. l_maximum_level
328: LOOP
329: /*
330: * Loop for each level.
331: */
332: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
333: pa_debug.g_err_stage := '100:Opening cursor for level [' || to_char(l_level) || ']';
334: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
335: END IF;
336:
337: OPEN cur_unique_objects_per_parent( l_level
330: * Loop for each level.
331: */
332: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
333: pa_debug.g_err_stage := '100:Opening cursor for level [' || to_char(l_level) || ']';
334: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
335: END IF;
336:
337: OPEN cur_unique_objects_per_parent( l_level
338: ,p_balance_type_code
440: END LOOP; -- Loop for records in this level.
441: CLOSE cur_unique_objects_per_parent; -- Closing cursor for this level.
442: END LOOP; -- Loop for level in hierarchy.
443: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
444: pa_debug.g_err_stage := '150:Leaving create_missing_parent_objects';
445: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
446: END IF;
447:
448: pa_debug.reset_curr_function;
441: CLOSE cur_unique_objects_per_parent; -- Closing cursor for this level.
442: END LOOP; -- Loop for level in hierarchy.
443: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
444: pa_debug.g_err_stage := '150:Leaving create_missing_parent_objects';
445: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
446: END IF;
447:
448: pa_debug.reset_curr_function;
449: END create_missing_parent_objects;
444: pa_debug.g_err_stage := '150:Leaving create_missing_parent_objects';
445: pa_debug.log_message('create_missing_parent_objects: ' || pa_debug.g_err_stage);
446: END IF;
447:
448: pa_debug.reset_curr_function;
449: END create_missing_parent_objects;
450: ----------------------------------------------------------------
451: /*
452: * The following procedure does the organization rollup for a
609: l_rowcount number :=0;
610:
611: BEGIN
612:
613: PA_DEBUG.set_curr_function('org_rollup_pagl_period_type');
614: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
615: PA_DEBUG.g_err_stage := '50:Inside org_rollup_pagl_period_type';
616: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
617: END IF;
611: BEGIN
612:
613: PA_DEBUG.set_curr_function('org_rollup_pagl_period_type');
614: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
615: PA_DEBUG.g_err_stage := '50:Inside org_rollup_pagl_period_type';
616: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
617: END IF;
618:
619: /*
612:
613: PA_DEBUG.set_curr_function('org_rollup_pagl_period_type');
614: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
615: PA_DEBUG.g_err_stage := '50:Inside org_rollup_pagl_period_type';
616: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
617: END IF;
618:
619: /*
620: * Delete all total and sub-org numbers from pa_summ_balances.
619: /*
620: * Delete all total and sub-org numbers from pa_summ_balances.
621: */
622: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
623: PA_DEBUG.g_err_stage := '100:Deleting Total and Sub-org Records';
624: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
625: END IF;
626: LOOP
627: DELETE
620: * Delete all total and sub-org numbers from pa_summ_balances.
621: */
622: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
623: PA_DEBUG.g_err_stage := '100:Deleting Total and Sub-org Records';
624: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
625: END IF;
626: LOOP
627: DELETE
628: FROM pa_summ_balances bal
657: l_rowcount:=sql%rowcount;
658: /*Code Changes for Bug No.2984871 end */
659:
660: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
661: PA_DEBUG.g_err_stage := '150:Deleted [' || TO_CHAR(l_rowcount) || '] records';
662: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
663: END IF;
664:
665: /*
658: /*Code Changes for Bug No.2984871 end */
659:
660: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
661: PA_DEBUG.g_err_stage := '150:Deleted [' || TO_CHAR(l_rowcount) || '] records';
662: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
663: END IF;
664:
665: /*
666: * Exit when no more records left to delete.
666: * Exit when no more records left to delete.
667: */
668: IF (l_rowcount = 0 OR l_rowcount < l_fetch_size) THEN
669: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
670: PA_DEBUG.g_err_stage := '200:All Total and Sub-org records deleted.';
671: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
672: END IF;
673: EXIT;
674: END IF;
667: */
668: IF (l_rowcount = 0 OR l_rowcount < l_fetch_size) THEN
669: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
670: PA_DEBUG.g_err_stage := '200:All Total and Sub-org records deleted.';
671: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
672: END IF;
673: EXIT;
674: END IF;
675: COMMIT;
686: * Since, we have already deleted all the total records,
687: * 'upsert' is NOT needed. ONLY insert.
688: */
689: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
690: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
691: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
692: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
687: * 'upsert' is NOT needed. ONLY insert.
688: */
689: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
690: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
691: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
692: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
688: */
689: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
690: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
691: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
692: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
689: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
690: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
691: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
692: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
697: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
690: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
691: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
692: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
697: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
698: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
691: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
692: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
697: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
698: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
699: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
692: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
697: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
698: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
699: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
700: END IF;
693: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
697: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
698: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
699: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
700: END IF;
701:
694: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
697: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
698: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
699: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
700: END IF;
701:
702: OPEN cur_org_dir_balances_pagl( l_start_org_id
695: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
696: PA_DEBUG.g_err_stage := '250:Effective Start Period Number is [' || p_effective_start_period_num || ']';
697: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
698: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
699: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
700: END IF;
701:
702: OPEN cur_org_dir_balances_pagl( l_start_org_id
703: ,p_balance_type_code
712: l_this_fetch := 0;
713: l_this_commit_cycle := 0;
714: l_totally_fetched := 0;
715: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
716: PA_DEBUG.g_err_stage := '300:Fetching Direct-number Cursor.';
717: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
718: END IF;
719:
720: LOOP
713: l_this_commit_cycle := 0;
714: l_totally_fetched := 0;
715: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
716: PA_DEBUG.g_err_stage := '300:Fetching Direct-number Cursor.';
717: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
718: END IF;
719:
720: LOOP
721: FETCH cur_org_dir_balances_pagl
733: l_this_fetch := cur_org_dir_balances_pagl%ROWCOUNT - l_totally_fetched;
734: l_this_commit_cycle := l_this_commit_cycle + l_this_fetch;
735: l_totally_fetched := cur_org_dir_balances_pagl%ROWCOUNT;
736: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
737: PA_DEBUG.g_err_stage := '350:Fetched [' || l_this_fetch || '] Direct-number records';
738: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
739: END IF;
740:
741: IF (l_this_fetch = 0) THEN
734: l_this_commit_cycle := l_this_commit_cycle + l_this_fetch;
735: l_totally_fetched := cur_org_dir_balances_pagl%ROWCOUNT;
736: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
737: PA_DEBUG.g_err_stage := '350:Fetched [' || l_this_fetch || '] Direct-number records';
738: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
739: END IF;
740:
741: IF (l_this_fetch = 0) THEN
742: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
739: END IF;
740:
741: IF (l_this_fetch = 0) THEN
742: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
743: PA_DEBUG.g_err_stage := '400:No more Direct-number records to fetch. Exiting';
744: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
745: END IF;
746: EXIT;
747: END IF;
740:
741: IF (l_this_fetch = 0) THEN
742: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
743: PA_DEBUG.g_err_stage := '400:No more Direct-number records to fetch. Exiting';
744: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
745: END IF;
746: EXIT;
747: END IF;
748:
790: ,NULL
791: ,NULL
792: );
793: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
794: PA_DEBUG.g_err_stage := '450:Inserted [' || SQL%ROWCOUNT || '] Total-number records';
795: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
796: END IF;
797:
798: /*
791: ,NULL
792: );
793: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
794: PA_DEBUG.g_err_stage := '450:Inserted [' || SQL%ROWCOUNT || '] Total-number records';
795: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
796: END IF;
797:
798: /*
799: * Commit if no. of records inserted is more than or
812: EXIT;
813: END IF;
814: END LOOP; -- End of loop to insert total number records.
815: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
816: PA_DEBUG.g_err_stage := '500:Closing Direct-number Cursor.';
817: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
818: END IF;
819:
820: CLOSE cur_org_dir_balances_pagl;
813: END IF;
814: END LOOP; -- End of loop to insert total number records.
815: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
816: PA_DEBUG.g_err_stage := '500:Closing Direct-number Cursor.';
817: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
818: END IF;
819:
820: CLOSE cur_org_dir_balances_pagl;
821:
824: */
825: FOR l_level IN 2 .. l_maximum_level
826: LOOP
827: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
828: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
829: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
830: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
825: FOR l_level IN 2 .. l_maximum_level
826: LOOP
827: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
828: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
829: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
830: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
833: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
826: LOOP
827: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
828: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
829: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
830: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
833: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
834: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
827: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
828: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
829: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
830: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
833: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
834: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
835: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
828: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
829: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
830: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
833: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
834: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
835: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
836: END IF;
829: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
830: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
833: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
834: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
835: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
836: END IF;
837:
830: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
833: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
834: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
835: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
836: END IF;
837:
838: OPEN cur_org_sub_balances_pagl( l_level
831: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
832: PA_DEBUG.g_err_stage := '550:Effective Start Period num is [' || p_effective_start_period_num || ']';
833: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
834: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
835: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
836: END IF;
837:
838: OPEN cur_org_sub_balances_pagl( l_level
839: ,p_balance_type_code
864: l_this_fetch := cur_org_sub_balances_pagl%ROWCOUNT - l_totally_fetched;
865: l_this_commit_cycle := l_this_commit_cycle + l_this_fetch;
866: l_totally_fetched := cur_org_sub_balances_pagl%ROWCOUNT;
867: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
868: PA_DEBUG.g_err_stage := '600:Fetched [' || l_this_fetch || '] Sub-org records';
869: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
870: END IF;
871: IF (l_this_fetch = 0) THEN
872: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
865: l_this_commit_cycle := l_this_commit_cycle + l_this_fetch;
866: l_totally_fetched := cur_org_sub_balances_pagl%ROWCOUNT;
867: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
868: PA_DEBUG.g_err_stage := '600:Fetched [' || l_this_fetch || '] Sub-org records';
869: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
870: END IF;
871: IF (l_this_fetch = 0) THEN
872: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
873: PA_DEBUG.g_err_stage := '650:No more Sub-org records left for level [' || l_level || '] Exiting';
869: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
870: END IF;
871: IF (l_this_fetch = 0) THEN
872: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
873: PA_DEBUG.g_err_stage := '650:No more Sub-org records left for level [' || l_level || '] Exiting';
874: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
875: END IF;
876: EXIT;
877: END IF;
870: END IF;
871: IF (l_this_fetch = 0) THEN
872: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
873: PA_DEBUG.g_err_stage := '650:No more Sub-org records left for level [' || l_level || '] Exiting';
874: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
875: END IF;
876: EXIT;
877: END IF;
878:
919: ,NULL
920: ,NULL
921: );
922: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
923: PA_DEBUG.g_err_stage := '700:Inserted [' || SQL%ROWCOUNT || '] Sub-org records';
924: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
925: END IF;
926: /*
927: * Update the tot_num records with tot_num = tot_num + sub_org
920: ,NULL
921: );
922: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
923: PA_DEBUG.g_err_stage := '700:Inserted [' || SQL%ROWCOUNT || '] Sub-org records';
924: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
925: END IF;
926: /*
927: * Update the tot_num records with tot_num = tot_num + sub_org
928: */
946: AND bal.pvdr_currency_code IS NULL
947: AND bal.pvdr_period_balance IS NULL;
948:
949: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
950: PA_DEBUG.g_err_stage := '750:Updated [' || SQL%ROWCOUNT || '] Total Records with T=T+S';
951: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
952: END IF;
953:
954: /*
947: AND bal.pvdr_period_balance IS NULL;
948:
949: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
950: PA_DEBUG.g_err_stage := '750:Updated [' || SQL%ROWCOUNT || '] Total Records with T=T+S';
951: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
952: END IF;
953:
954: /*
955: * If UPDATE didnt' go thro for a particular combination, that means
998: );
999: END IF;
1000: END LOOP; -- Loop to check whether the record was updated.
1001: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1002: PA_DEBUG.g_err_stage := '800:After Inserting Total Records.';
1003: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1004: END IF;
1005:
1006: /*
999: END IF;
1000: END LOOP; -- Loop to check whether the record was updated.
1001: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1002: PA_DEBUG.g_err_stage := '800:After Inserting Total Records.';
1003: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1004: END IF;
1005:
1006: /*
1007: * Commit if no. of records inserted is more than or
1018: END IF;
1019: END LOOP; -- loop for each of the levels.
1020: CLOSE cur_org_sub_balances_pagl;
1021: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1022: PA_DEBUG.g_err_stage := '850:After Closing Sub-org Cursor.';
1023: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1024: END IF;
1025:
1026: END LOOP; -- End of loop to insert sub-org number records.
1019: END LOOP; -- loop for each of the levels.
1020: CLOSE cur_org_sub_balances_pagl;
1021: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1022: PA_DEBUG.g_err_stage := '850:After Closing Sub-org Cursor.';
1023: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1024: END IF;
1025:
1026: END LOOP; -- End of loop to insert sub-org number records.
1027: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1024: END IF;
1025:
1026: END LOOP; -- End of loop to insert sub-org number records.
1027: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1028: PA_DEBUG.g_err_stage := '900:Finished creating Sub-org and total Records for all Levels.';
1029: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1030: END IF;
1031:
1032: EXCEPTION
1025:
1026: END LOOP; -- End of loop to insert sub-org number records.
1027: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1028: PA_DEBUG.g_err_stage := '900:Finished creating Sub-org and total Records for all Levels.';
1029: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1030: END IF;
1031:
1032: EXCEPTION
1033: WHEN OTHERS THEN
1032: EXCEPTION
1033: WHEN OTHERS THEN
1034: RAISE;
1035: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1036: PA_DEBUG.g_err_stage := '950:Leaving org_rollup_pagl_period_type';
1037: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1038: END IF;
1039: PA_DEBUG.reset_curr_function;
1040:
1033: WHEN OTHERS THEN
1034: RAISE;
1035: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1036: PA_DEBUG.g_err_stage := '950:Leaving org_rollup_pagl_period_type';
1037: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1038: END IF;
1039: PA_DEBUG.reset_curr_function;
1040:
1041: END org_rollup_pagl_period_type;
1035: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1036: PA_DEBUG.g_err_stage := '950:Leaving org_rollup_pagl_period_type';
1037: PA_DEBUG.log_message('org_rollup_pagl_period_type: ' || PA_DEBUG.g_err_stage);
1038: END IF;
1039: PA_DEBUG.reset_curr_function;
1040:
1041: END org_rollup_pagl_period_type;
1042:
1043: ------------------------------------------------------------------
1200: l_rowcount number :=0;
1201: /*Code Changes for Bug No.2984871 end */
1202:
1203: BEGIN
1204: PA_DEBUG.set_curr_function('org_rollup_ge_period_type');
1205: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1206: PA_DEBUG.g_err_stage := '50:Inside org_rollup_ge_period_type';
1207: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1208: PA_DEBUG.g_err_stage := '100:Deleting Total and Sub-org Records';
1202:
1203: BEGIN
1204: PA_DEBUG.set_curr_function('org_rollup_ge_period_type');
1205: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1206: PA_DEBUG.g_err_stage := '50:Inside org_rollup_ge_period_type';
1207: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1208: PA_DEBUG.g_err_stage := '100:Deleting Total and Sub-org Records';
1209: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1210: END IF;
1203: BEGIN
1204: PA_DEBUG.set_curr_function('org_rollup_ge_period_type');
1205: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1206: PA_DEBUG.g_err_stage := '50:Inside org_rollup_ge_period_type';
1207: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1208: PA_DEBUG.g_err_stage := '100:Deleting Total and Sub-org Records';
1209: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1210: END IF;
1211: /*
1204: PA_DEBUG.set_curr_function('org_rollup_ge_period_type');
1205: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1206: PA_DEBUG.g_err_stage := '50:Inside org_rollup_ge_period_type';
1207: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1208: PA_DEBUG.g_err_stage := '100:Deleting Total and Sub-org Records';
1209: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1210: END IF;
1211: /*
1212: * Delete all total and sub-org numbers from pa_summ_balances.
1205: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1206: PA_DEBUG.g_err_stage := '50:Inside org_rollup_ge_period_type';
1207: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1208: PA_DEBUG.g_err_stage := '100:Deleting Total and Sub-org Records';
1209: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1210: END IF;
1211: /*
1212: * Delete all total and sub-org numbers from pa_summ_balances.
1213: */
1248: * Exit when no more records left to delete.
1249: */
1250: IF (l_rowcount = 0) THEN
1251: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1252: PA_DEBUG.g_err_stage := '200:All Total and Sub-org records deleted.';
1253: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1254: END IF;
1255: COMMIT;
1256: EXIT;
1249: */
1250: IF (l_rowcount = 0) THEN
1251: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1252: PA_DEBUG.g_err_stage := '200:All Total and Sub-org records deleted.';
1253: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1254: END IF;
1255: COMMIT;
1256: EXIT;
1257: END IF;
1255: COMMIT;
1256: EXIT;
1257: END IF;
1258: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1259: PA_DEBUG.g_err_stage := '150:Deleted [' || TO_CHAR(l_rowcount) || '] records';
1260: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1261: END IF;
1262: COMMIT;
1263: END LOOP;
1256: EXIT;
1257: END IF;
1258: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1259: PA_DEBUG.g_err_stage := '150:Deleted [' || TO_CHAR(l_rowcount) || '] records';
1260: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1261: END IF;
1262: COMMIT;
1263: END LOOP;
1264:
1272: * Since, we have already deleted all the total records,
1273: * 'upsert' is NOT needed. ONLY insert.
1274: */
1275: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1276: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
1277: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1278: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1273: * 'upsert' is NOT needed. ONLY insert.
1274: */
1275: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1276: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
1277: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1278: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1274: */
1275: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1276: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
1277: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1278: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1275: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1276: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
1277: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1278: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1276: PA_DEBUG.g_err_stage := '250:Opening Direct-number Cursor.';
1277: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1278: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1277: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1278: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1285: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1278: PA_DEBUG.g_err_stage := '250:Start Org id is [' || l_start_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1285: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1286: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
1279: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1285: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1286: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
1287: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1280: PA_DEBUG.g_err_stage := '250:Balance Type is [' || p_balance_type_code || ']';
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1285: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1286: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
1287: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1288: END IF;
1281: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1285: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1286: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
1287: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1288: END IF;
1289:
1282: PA_DEBUG.g_err_stage := '250:Start Date is [' || p_start_date || ']';
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1285: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1286: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
1287: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1288: END IF;
1289:
1290: OPEN cur_org_dir_balances_ge( l_start_org_id
1283: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1284: PA_DEBUG.g_err_stage := '250:End Date is [' || p_end_date || ']';
1285: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1286: PA_DEBUG.g_err_stage := '250:Org Id is [' || l_org_id || ']';
1287: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1288: END IF;
1289:
1290: OPEN cur_org_dir_balances_ge( l_start_org_id
1291: ,p_balance_type_code
1301: l_this_fetch := 0;
1302: l_this_commit_cycle := 0;
1303: l_totally_fetched := 0;
1304: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1305: PA_DEBUG.g_err_stage := '300:Fetching Direct-number Cursor.';
1306: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1307: END IF;
1308:
1309: LOOP
1302: l_this_commit_cycle := 0;
1303: l_totally_fetched := 0;
1304: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1305: PA_DEBUG.g_err_stage := '300:Fetching Direct-number Cursor.';
1306: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1307: END IF;
1308:
1309: LOOP
1310: FETCH cur_org_dir_balances_ge
1323: l_this_commit_cycle := l_this_commit_cycle + l_this_fetch;
1324: l_totally_fetched := cur_org_dir_balances_ge%ROWCOUNT;
1325:
1326: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1327: PA_DEBUG.g_err_stage := '350:Fetched [' || l_this_fetch || '] Direct-number records';
1328: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1329: END IF;
1330:
1331: IF (l_this_fetch = 0) THEN
1324: l_totally_fetched := cur_org_dir_balances_ge%ROWCOUNT;
1325:
1326: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1327: PA_DEBUG.g_err_stage := '350:Fetched [' || l_this_fetch || '] Direct-number records';
1328: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1329: END IF;
1330:
1331: IF (l_this_fetch = 0) THEN
1332: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1329: END IF;
1330:
1331: IF (l_this_fetch = 0) THEN
1332: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1333: PA_DEBUG.g_err_stage := '400:No more Direct-number records to fetch. Exiting';
1334: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1335: END IF;
1336: EXIT;
1337: END IF;
1330:
1331: IF (l_this_fetch = 0) THEN
1332: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1333: PA_DEBUG.g_err_stage := '400:No more Direct-number records to fetch. Exiting';
1334: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1335: END IF;
1336: EXIT;
1337: END IF;
1338:
1381: ,NULL
1382: );
1383:
1384: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1385: PA_DEBUG.g_err_stage := '450:Inserted [' || SQL%ROWCOUNT || '] Total-number records';
1386: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1387: END IF;
1388:
1389: /*
1382: );
1383:
1384: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1385: PA_DEBUG.g_err_stage := '450:Inserted [' || SQL%ROWCOUNT || '] Total-number records';
1386: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1387: END IF;
1388:
1389: /*
1390: * Commit if no. of records inserted is more than or
1403: EXIT;
1404: END IF;
1405: END LOOP; -- End of loop to insert total number records.
1406: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1407: PA_DEBUG.g_err_stage := '500:Closing Direct-number Cursor.';
1408: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1409: END IF;
1410:
1411: CLOSE cur_org_dir_balances_ge;
1404: END IF;
1405: END LOOP; -- End of loop to insert total number records.
1406: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1407: PA_DEBUG.g_err_stage := '500:Closing Direct-number Cursor.';
1408: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1409: END IF;
1410:
1411: CLOSE cur_org_dir_balances_ge;
1412:
1415: */
1416: FOR l_level IN 2 .. l_maximum_level
1417: LOOP
1418: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1419: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
1420: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1421: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1416: FOR l_level IN 2 .. l_maximum_level
1417: LOOP
1418: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1419: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
1420: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1421: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1417: LOOP
1418: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1419: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
1420: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1421: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1418: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1419: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
1420: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1421: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1426: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1419: PA_DEBUG.g_err_stage := '550:Opening Sub-org Cursor for Level [' || l_level || ']';
1420: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1421: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1426: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1427: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
1420: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1421: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1426: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1427: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
1428: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1421: PA_DEBUG.g_err_stage := '550:Balance Type is [' || p_balance_type_code || ']';
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1426: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1427: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
1428: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1429: END IF;
1422: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1426: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1427: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
1428: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1429: END IF;
1430:
1423: PA_DEBUG.g_err_stage := '550:Start Date is [' || p_start_date || ']';
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1426: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1427: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
1428: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1429: END IF;
1430:
1431: OPEN cur_org_sub_balances_ge( l_level
1424: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1425: PA_DEBUG.g_err_stage := '550:End Date is [' || p_end_date || ']';
1426: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1427: PA_DEBUG.g_err_stage := '550:Org Id is [' || l_org_id || ']';
1428: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1429: END IF;
1430:
1431: OPEN cur_org_sub_balances_ge( l_level
1432: ,p_balance_type_code
1460: l_totally_fetched := cur_org_sub_balances_ge%ROWCOUNT;
1461:
1462: IF (l_this_fetch = 0) THEN
1463: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1464: PA_DEBUG.g_err_stage := '650:No more Sub-org records left for level [' || l_level || '] Exiting';
1465: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1466: END IF;
1467: EXIT;
1468: END IF;
1461:
1462: IF (l_this_fetch = 0) THEN
1463: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1464: PA_DEBUG.g_err_stage := '650:No more Sub-org records left for level [' || l_level || '] Exiting';
1465: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1466: END IF;
1467: EXIT;
1468: END IF;
1469: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1466: END IF;
1467: EXIT;
1468: END IF;
1469: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1470: PA_DEBUG.g_err_stage := '600:Fetched [' || l_this_fetch || '] Sub-org records';
1471: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1472: END IF;
1473:
1474: FORALL i IN l_object_id_tab.FIRST .. l_object_id_tab.LAST
1467: EXIT;
1468: END IF;
1469: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1470: PA_DEBUG.g_err_stage := '600:Fetched [' || l_this_fetch || '] Sub-org records';
1471: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1472: END IF;
1473:
1474: FORALL i IN l_object_id_tab.FIRST .. l_object_id_tab.LAST
1475: INSERT
1513: ,NULL
1514: ,NULL
1515: );
1516: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1517: PA_DEBUG.g_err_stage := '700:Inserted [' || SQL%ROWCOUNT || '] Sub-org records';
1518: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1519: END IF;
1520:
1521: /*
1514: ,NULL
1515: );
1516: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1517: PA_DEBUG.g_err_stage := '700:Inserted [' || SQL%ROWCOUNT || '] Sub-org records';
1518: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1519: END IF;
1520:
1521: /*
1522: * Update the tot_num records with tot_num = tot_num + sub_org
1539: AND bal.unit_of_measure = l_unit_of_measure
1540: AND bal.pvdr_currency_code IS NULL
1541: AND bal.pvdr_period_balance IS NULL;
1542: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1543: PA_DEBUG.g_err_stage := '750:Updated [' || SQL%ROWCOUNT || '] Total Records with T=T+S';
1544: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1545: END IF;
1546:
1547: /*
1540: AND bal.pvdr_currency_code IS NULL
1541: AND bal.pvdr_period_balance IS NULL;
1542: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1543: PA_DEBUG.g_err_stage := '750:Updated [' || SQL%ROWCOUNT || '] Total Records with T=T+S';
1544: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1545: END IF;
1546:
1547: /*
1548: * If UPDATE didnt' go thro for a particular combination, that means
1590: );
1591: END IF;
1592: END LOOP; -- Loop to chek whether the record was updated.
1593: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1594: PA_DEBUG.g_err_stage := '800:After Inserting Total Records.';
1595: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1596: END IF;
1597:
1598: /*
1591: END IF;
1592: END LOOP; -- Loop to chek whether the record was updated.
1593: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1594: PA_DEBUG.g_err_stage := '800:After Inserting Total Records.';
1595: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1596: END IF;
1597:
1598: /*
1599: * Commit if no. of records inserted is more than or
1610: END IF;
1611: END LOOP; -- loop for each of the levels.
1612: CLOSE cur_org_sub_balances_ge;
1613: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1614: PA_DEBUG.g_err_stage := '850:After Closing Sub-org Cursor.';
1615: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1616: END IF;
1617:
1618: END LOOP; -- End of loop to insert sub-org number records.
1611: END LOOP; -- loop for each of the levels.
1612: CLOSE cur_org_sub_balances_ge;
1613: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1614: PA_DEBUG.g_err_stage := '850:After Closing Sub-org Cursor.';
1615: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1616: END IF;
1617:
1618: END LOOP; -- End of loop to insert sub-org number records.
1619: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1616: END IF;
1617:
1618: END LOOP; -- End of loop to insert sub-org number records.
1619: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1620: PA_DEBUG.g_err_stage := '900:Finished creating Sub-org and total Records for all Levels.';
1621: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1622: END IF;
1623:
1624: EXCEPTION
1617:
1618: END LOOP; -- End of loop to insert sub-org number records.
1619: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1620: PA_DEBUG.g_err_stage := '900:Finished creating Sub-org and total Records for all Levels.';
1621: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1622: END IF;
1623:
1624: EXCEPTION
1625: WHEN OTHERS THEN
1624: EXCEPTION
1625: WHEN OTHERS THEN
1626: RAISE;
1627: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1628: PA_DEBUG.g_err_stage := '950:Leaving org_rollup_ge_period_type';
1629: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1630: END IF;
1631: PA_DEBUG.reset_curr_function;
1632:
1625: WHEN OTHERS THEN
1626: RAISE;
1627: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1628: PA_DEBUG.g_err_stage := '950:Leaving org_rollup_ge_period_type';
1629: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1630: END IF;
1631: PA_DEBUG.reset_curr_function;
1632:
1633: END org_rollup_ge_period_type;
1627: IF P_DEBUG_MODE = 'Y' THEN /* Added Debug Profile Option Check for bug#2674619 */
1628: PA_DEBUG.g_err_stage := '950:Leaving org_rollup_ge_period_type';
1629: PA_DEBUG.log_message('org_rollup_ge_period_type: ' || PA_DEBUG.g_err_stage);
1630: END IF;
1631: PA_DEBUG.reset_curr_function;
1632:
1633: END org_rollup_ge_period_type;
1634: ------------------------------------------------------------------
1635: