6: l_debug NUMBER := fnd_profile.value('CSD_DEBUG_LEVEL');
7: --hello
8: -- Global variable for storing the debug level
9:
10: G_debug_level number := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
11:
12: /*----------------------------------------------------------------*/
13:
14: /* procedure name: Convert_CurrencyAmount */
69: l_numerator NUMBER := NULL;
70: l_rate NUMBER := NULL;
71: l_user_rate NUMBER := NULL;
72:
73: -- Variable used in FND log
74:
75: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
76: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
77: l_event_level number := FND_LOG.LEVEL_EVENT;
71: l_user_rate NUMBER := NULL;
72:
73: -- Variable used in FND log
74:
75: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
76: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
77: l_event_level number := FND_LOG.LEVEL_EVENT;
78: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
79: l_error_level number := FND_LOG.LEVEL_ERROR;
72:
73: -- Variable used in FND log
74:
75: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
76: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
77: l_event_level number := FND_LOG.LEVEL_EVENT;
78: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
79: l_error_level number := FND_LOG.LEVEL_ERROR;
80: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
73: -- Variable used in FND log
74:
75: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
76: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
77: l_event_level number := FND_LOG.LEVEL_EVENT;
78: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
79: l_error_level number := FND_LOG.LEVEL_ERROR;
80: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
81: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount';
74:
75: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
76: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
77: l_event_level number := FND_LOG.LEVEL_EVENT;
78: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
79: l_error_level number := FND_LOG.LEVEL_ERROR;
80: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
81: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount';
82:
75: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
76: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
77: l_event_level number := FND_LOG.LEVEL_EVENT;
78: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
79: l_error_level number := FND_LOG.LEVEL_ERROR;
80: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
81: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount';
82:
83: BEGIN
76: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
77: l_event_level number := FND_LOG.LEVEL_EVENT;
78: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
79: l_error_level number := FND_LOG.LEVEL_ERROR;
80: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
81: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount';
82:
83: BEGIN
84:
112: --
113:
114: -- Debug messages
115:
116: IF (Fnd_Log.Level_Procedure >= Fnd_Log.G_Current_Runtime_Level)
117: THEN
118: FND_LOG.STRING(Fnd_Log.Level_Procedure,
119: 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount.BEGIN',
120: 'Entered Convert_CurrencyAmount');
114: -- Debug messages
115:
116: IF (Fnd_Log.Level_Procedure >= Fnd_Log.G_Current_Runtime_Level)
117: THEN
118: FND_LOG.STRING(Fnd_Log.Level_Procedure,
119: 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount.BEGIN',
120: 'Entered Convert_CurrencyAmount');
121: END IF;
122:
125: l_conversion_type := FND_PROFILE.value('CSD_CURRENCY_CONVERSION_TYPE');
126: IF (l_conversion_type IS NULL)
127: THEN
128: FND_MESSAGE.SET_NAME('CSD', 'CSD_CST_CURR_CONV_TYPE_NOT_SET');
129: IF (Fnd_Log.Level_Error >= Fnd_Log.G_Current_Runtime_Level)
130: THEN
131: FND_LOG.MESSAGE(Fnd_Log.Level_Error, l_mod_name, FALSE);
132: END IF;
133: -- ELSE
127: THEN
128: FND_MESSAGE.SET_NAME('CSD', 'CSD_CST_CURR_CONV_TYPE_NOT_SET');
129: IF (Fnd_Log.Level_Error >= Fnd_Log.G_Current_Runtime_Level)
130: THEN
131: FND_LOG.MESSAGE(Fnd_Log.Level_Error, l_mod_name, FALSE);
132: END IF;
133: -- ELSE
134: FND_MSG_PUB.ADD;
135: --END IF;
164: END IF;
165:
166: -- Debug messages
167:
168: IF (FND_LOG.LEVEL_PROCEDURE >= Fnd_Log.G_Current_Runtime_Level)
169: THEN
170: FND_LOG.STRING(Fnd_Log.Level_Procedure,
171: 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount.END',
172: 'LeavingConvert_CurrencyAmount');
166: -- Debug messages
167:
168: IF (FND_LOG.LEVEL_PROCEDURE >= Fnd_Log.G_Current_Runtime_Level)
169: THEN
170: FND_LOG.STRING(Fnd_Log.Level_Procedure,
171: 'csd.plsql.csd_cost_analysis_util.Convert_CurrencyAmount.END',
172: 'LeavingConvert_CurrencyAmount');
173: END IF;
174:
195: x_conv_amount := NULL;
196: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
197: p_data => x_msg_data,
198: p_encoded => 'F');
199: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
200: THEN
201:
202: FND_LOG.STRING(Fnd_Log.Level_Exception,
203: 'csd.plsql.csd_cost_analysis_pvt.Convert_CurrencyAmount',
198: p_encoded => 'F');
199: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
200: THEN
201:
202: FND_LOG.STRING(Fnd_Log.Level_Exception,
203: 'csd.plsql.csd_cost_analysis_pvt.Convert_CurrencyAmount',
204: 'EXC_ERROR['
205: || x_msg_data
206: || ']');
213: x_conv_amount := NULL;
214: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
215: p_data => x_msg_data,
216: p_encoded => 'F');
217: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
218: THEN
219: FND_LOG.STRING(Fnd_Log.Level_Exception,
220: 'csd.plsql.csd_cost_analysis_pvt.Convert_CurrencyAmount',
221: 'EXC_ERROR['
215: p_data => x_msg_data,
216: p_encoded => 'F');
217: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
218: THEN
219: FND_LOG.STRING(Fnd_Log.Level_Exception,
220: 'csd.plsql.csd_cost_analysis_pvt.Convert_CurrencyAmount',
221: 'EXC_ERROR['
222: || x_msg_data
223: || ']');
234: END IF;
235: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
236: p_data => x_msg_data,
237: p_encoded => 'F');
238: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
239: THEN
240: FND_LOG.STRING(Fnd_Log.Level_Exception,
241: 'csd.plsql.csd_cost_analysis_pvt.Convert_CurrencyAmount',
242: 'SQL Message['
236: p_data => x_msg_data,
237: p_encoded => 'F');
238: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
239: THEN
240: FND_LOG.STRING(Fnd_Log.Level_Exception,
241: 'csd.plsql.csd_cost_analysis_pvt.Convert_CurrencyAmount',
242: 'SQL Message['
243: || sqlerrm
244: || ']');
304: l_api_name CONSTANT VARCHAR2(30) := 'Compare_MLETotals';
305: l_api_version CONSTANT NUMBER := 1.0;
306: l_mle_totals_basis MLE_TOTALS_REC_TYPE := p_mle_totals_basis;
307:
308: -- Variable used in FND log
309:
310: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
311: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
312: l_event_level number := FND_LOG.LEVEL_EVENT;
306: l_mle_totals_basis MLE_TOTALS_REC_TYPE := p_mle_totals_basis;
307:
308: -- Variable used in FND log
309:
310: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
311: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
312: l_event_level number := FND_LOG.LEVEL_EVENT;
313: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
314: l_error_level number := FND_LOG.LEVEL_ERROR;
307:
308: -- Variable used in FND log
309:
310: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
311: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
312: l_event_level number := FND_LOG.LEVEL_EVENT;
313: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
314: l_error_level number := FND_LOG.LEVEL_ERROR;
315: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
308: -- Variable used in FND log
309:
310: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
311: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
312: l_event_level number := FND_LOG.LEVEL_EVENT;
313: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
314: l_error_level number := FND_LOG.LEVEL_ERROR;
315: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
316: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals';
309:
310: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
311: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
312: l_event_level number := FND_LOG.LEVEL_EVENT;
313: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
314: l_error_level number := FND_LOG.LEVEL_ERROR;
315: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
316: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals';
317:
310: l_stat_level number := FND_LOG.LEVEL_STATEMENT;
311: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
312: l_event_level number := FND_LOG.LEVEL_EVENT;
313: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
314: l_error_level number := FND_LOG.LEVEL_ERROR;
315: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
316: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals';
317:
318: BEGIN
311: l_proc_level number := FND_LOG.LEVEL_PROCEDURE;
312: l_event_level number := FND_LOG.LEVEL_EVENT;
313: l_excep_level number := FND_LOG.LEVEL_EXCEPTION;
314: l_error_level number := FND_LOG.LEVEL_ERROR;
315: l_unexp_level number := FND_LOG.LEVEL_UNEXPECTED;
316: l_mod_name varchar2(2000) := 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals';
317:
318: BEGIN
319:
346: -- Begin API Body
347: --
348: -- Debug messages
349:
350: IF (Fnd_Log.Level_Procedure >= Fnd_Log.G_Current_Runtime_Level)
351: THEN
352: FND_LOG.STRING(Fnd_Log.Level_Procedure,
353: 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals.BEGIN',
354: 'Entered Convert_CurrencyAmount');
348: -- Debug messages
349:
350: IF (Fnd_Log.Level_Procedure >= Fnd_Log.G_Current_Runtime_Level)
351: THEN
352: FND_LOG.STRING(Fnd_Log.Level_Procedure,
353: 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals.BEGIN',
354: 'Entered Convert_CurrencyAmount');
355: END IF;
356:
362:
363: -- Throw error
364:
365: FND_MESSAGE.SET_NAME('CSD', 'CSD_CST_CURR_CODE_DIFF');
366: IF (Fnd_Log.Level_Error >= Fnd_Log.G_Current_Runtime_Level)
367: THEN
368: FND_LOG.MESSAGE(Fnd_Log.Level_Error, l_mod_name, FALSE);
369: END IF;
370: -- ELSE
364:
365: FND_MESSAGE.SET_NAME('CSD', 'CSD_CST_CURR_CODE_DIFF');
366: IF (Fnd_Log.Level_Error >= Fnd_Log.G_Current_Runtime_Level)
367: THEN
368: FND_LOG.MESSAGE(Fnd_Log.Level_Error, l_mod_name, FALSE);
369: END IF;
370: -- ELSE
371: FND_MSG_PUB.ADD;
372: --END IF;
421: --3795221 sangigup x_pct_diff.mle_total := round(x_diff.mle_total * 100 / p_mle_totals_basis.mle_total, 2);
422: x_pct_diff.mle_total := round(x_diff.mle_total * 100 / p_mle_totals_compare.mle_total, 2);
423: END IF;
424: x_pct_diff.currency_code := NULL;
425: IF (Fnd_Log.Level_Procedure >= Fnd_Log.G_Current_Runtime_Level)
426: THEN
427: FND_LOG.STRING(Fnd_Log.Level_Procedure,
428: 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals.END',
429: 'LEaving Convert_CurrencyAmount');
423: END IF;
424: x_pct_diff.currency_code := NULL;
425: IF (Fnd_Log.Level_Procedure >= Fnd_Log.G_Current_Runtime_Level)
426: THEN
427: FND_LOG.STRING(Fnd_Log.Level_Procedure,
428: 'csd.plsql.csd_cost_analysis_util.Compare_MLETotals.END',
429: 'LEaving Convert_CurrencyAmount');
430: END IF;
431:
447: ROLLBACK TO Compare_MLETotals_Utl;
448: x_return_status := FND_API.G_RET_STS_ERROR;
449: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
450: p_data => x_msg_data);
451: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
452: THEN
453: FND_LOG.STRING(Fnd_Log.Level_Exception,
454: 'csd.plsql.csd_cost_analysis_pvt.Compare_MLETotals',
455: 'EXC_ERROR['
449: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
450: p_data => x_msg_data);
451: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
452: THEN
453: FND_LOG.STRING(Fnd_Log.Level_Exception,
454: 'csd.plsql.csd_cost_analysis_pvt.Compare_MLETotals',
455: 'EXC_ERROR['
456: || x_msg_data
457: || ']');
460: ROLLBACK TO Compare_MLETotals_Utl;
461: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
462: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
463: p_data => x_msg_data);
464: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
465: THEN
466: FND_LOG.STRING(Fnd_Log.Level_Exception,
467: 'csd.plsql.csd_cost_analysis_pvt.Compare_MLETotals',
468: 'EXC_ERROR['
462: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
463: p_data => x_msg_data);
464: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
465: THEN
466: FND_LOG.STRING(Fnd_Log.Level_Exception,
467: 'csd.plsql.csd_cost_analysis_pvt.Compare_MLETotals',
468: 'EXC_ERROR['
469: || x_msg_data
470: || ']');
477: FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
478: END IF;
479: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
480: p_data => x_msg_data);
481: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
482: THEN
483: FND_LOG.STRING(Fnd_Log.Level_Exception,
484: 'csd.plsql.csd_cost_analysis_pvt.Compare_MLETotals',
485: 'SQL Message['
479: FND_MSG_PUB.Count_And_Get(p_count => x_msg_count,
480: p_data => x_msg_data);
481: IF (Fnd_Log.Level_Exception >= Fnd_Log.G_Current_Runtime_Level)
482: THEN
483: FND_LOG.STRING(Fnd_Log.Level_Exception,
484: 'csd.plsql.csd_cost_analysis_pvt.Compare_MLETotals',
485: 'SQL Message['
486: || sqlerrm
487: || ']');