27:
28: -- Log file Generation
29: lv_log_file_name VARCHAR2(50) := 'ja_in_ap_aida_after_trg.log';
30: lv_utl_location VARCHAR2(512);
31: lv_myfilehandle UTL_FILE.FILE_TYPE;
32: lv_debug VARCHAR2(1) := 'N'; -- Harshita for Bug 5219176
33:
34: /* Variables related to CP */
35:
109: Select DECODE(SUBSTR (value,1,INSTR(value,',') -1),NULL,
110: Value,SUBSTR (value,1,INSTR(value,',') -1))
111: INTO lv_utl_location
112: from v$parameter
113: where name = 'utl_file_dir';
114:
115: lv_myfilehandle := UTL_FILE.FOPEN(lv_utl_location, lv_log_file_name ,'A');
116: UTL_FILE.PUT_LINE(lv_myfilehandle, '********* Start ja_in_ap_aida_after_trg('||TO_CHAR(SYSDATE,'DD/MM/RRRR HH24:MI:SS') ||') *********');
117:
111: INTO lv_utl_location
112: from v$parameter
113: where name = 'utl_file_dir';
114:
115: lv_myfilehandle := UTL_FILE.FOPEN(lv_utl_location, lv_log_file_name ,'A');
116: UTL_FILE.PUT_LINE(lv_myfilehandle, '********* Start ja_in_ap_aida_after_trg('||TO_CHAR(SYSDATE,'DD/MM/RRRR HH24:MI:SS') ||') *********');
117:
118: EXCEPTION
119: WHEN OTHERS THEN
112: from v$parameter
113: where name = 'utl_file_dir';
114:
115: lv_myfilehandle := UTL_FILE.FOPEN(lv_utl_location, lv_log_file_name ,'A');
116: UTL_FILE.PUT_LINE(lv_myfilehandle, '********* Start ja_in_ap_aida_after_trg('||TO_CHAR(SYSDATE,'DD/MM/RRRR HH24:MI:SS') ||') *********');
117:
118: EXCEPTION
119: WHEN OTHERS THEN
120: lv_debug := 'N';
121: END;
122: End if; /* lv_debug ='Y' */
123:
124: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
125: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
126: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
127: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
122: End if; /* lv_debug ='Y' */
123:
124: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
125: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
126: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
127: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
123:
124: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
125: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
126: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
127: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
124: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
125: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
126: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
127: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
125: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside update ');
126: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
127: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
133: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
126: UTL_FILE.PUT_LINE(lv_myfilehandle, ' line type lookup code '|| pr_new.line_type_lookup_code);
127: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
133: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
134: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
127: UTL_FILE.PUT_LINE(lv_myfilehandle, ' reversal flag '|| pr_new.reversal_flag);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
133: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
134: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
135: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
128: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old match status flag '|| pr_old.match_status_flag);
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
133: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
134: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
135: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
136: end if ;
129: UTL_FILE.PUT_LINE(lv_myfilehandle, ' match status flag '|| pr_new.match_status_flag);
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
133: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
134: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
135: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
136: end if ;
137:
130: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old price variance '|| pr_old.invoice_price_variance);
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
133: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
134: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
135: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
136: end if ;
137:
138: If updating Then
131: UTL_FILE.PUT_LINE(lv_myfilehandle, ' new price variance '|| pr_new.invoice_price_variance);
132: UTL_FILE.PUT_LINE(lv_myfilehandle, ' old exc. vari '|| pr_old.exchange_rate_variance);
133: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exc. vari '|| pr_new.exchange_rate_variance);
134: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice id '|| pr_new.invoice_id);
135: UTL_FILE.PUT_LINE(lv_myfilehandle, ' invoice dist id '|| pr_new.invoice_distribution_id);
136: end if ;
137:
138: If updating Then
139:
146: ) Then
147:
148: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
149:
150: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside all condition chec k ');
151:
152: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside match status flag ');
153:
154: End If ;
148: If lv_debug = 'Y' Then -- added, Harshita for Bug 5219176
149:
150: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside all condition chec k ');
151:
152: UTL_FILE.PUT_LINE(lv_myfilehandle, ' inside match status flag ');
153:
154: End If ;
155:
156: /* Check whether MISC (Tax lines) exists for this invoice
165: /* Proceed only when the variances are calculated and old variance
166: is not equal to the new variances */
167:
168: IF lv_debug = 'Y' THEN
169: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exists flag ');
170: UTL_FILE.PUT_LINE(lv_myfilehandle,
171: 'invoice_id => '|| pr_new.invoice_id
172: || ', po_distribution_id => ' ||pr_new.po_distribution_id
173: || ', line_type_lookup_code => ' ||pr_new.line_type_lookup_code
166: is not equal to the new variances */
167:
168: IF lv_debug = 'Y' THEN
169: UTL_FILE.PUT_LINE(lv_myfilehandle, ' exists flag ');
170: UTL_FILE.PUT_LINE(lv_myfilehandle,
171: 'invoice_id => '|| pr_new.invoice_id
172: || ', po_distribution_id => ' ||pr_new.po_distribution_id
173: || ', line_type_lookup_code => ' ||pr_new.line_type_lookup_code
174: || ', amount => ' ||pr_new.amount
173: || ', line_type_lookup_code => ' ||pr_new.line_type_lookup_code
174: || ', amount => ' ||pr_new.amount
175: || ', Dist Line number => ' || pr_new.distribution_line_number
176: );
177: UTL_FILE.PUT_LINE(lv_myfilehandle,
178: ', amount => ' ||pr_new.amount
179: || ', base_amount => ' ||pr_new.base_amount
180: || ', Old Price Variance => ' || pr_old.invoice_price_variance
181: || ', New Price Variance => ' || pr_new.invoice_price_variance
207: pr_new.Exchange_rate_variance,
208: pr_new.rate_var_code_combination_id
209: );
210: IF lv_debug = 'Y' THEN
211: UTL_FILE.fclose(lv_myfilehandle);
212: END IF;
213:
214: End if; /* lv_exists ='Y' */
215:
217:
218: End if; /* updating */
219:
220: IF lv_debug = 'Y' THEN
221: UTL_FILE.fclose(lv_myfilehandle);
222: END IF;
223:
224: /* Added an exception block by Ramananda for bug#4570303 */
225: EXCEPTION
224: /* Added an exception block by Ramananda for bug#4570303 */
225: EXCEPTION
226: WHEN OTHERS THEN
227: IF lv_debug ='Y' Then
228: UTL_FILE.PUT_LINE(lv_myfilehandle, 'Error in trigger , errm -> '||SQLERRM);
229: UTL_FILE.fclose(lv_myfilehandle);
230: End if;
231: RAISE;
232: END ARUID_T1 ;
225: EXCEPTION
226: WHEN OTHERS THEN
227: IF lv_debug ='Y' Then
228: UTL_FILE.PUT_LINE(lv_myfilehandle, 'Error in trigger , errm -> '||SQLERRM);
229: UTL_FILE.fclose(lv_myfilehandle);
230: End if;
231: RAISE;
232: END ARUID_T1 ;
233: /*