[Home] [Help]
PACKAGE BODY: APPS.PA_COSTING
Source
4 -- ========================================================================
1 PACKAGE BODY PA_COSTING AS
2 /* $Header: PAXCOSTB.pls 120.13.12020000.3 2013/05/06 07:31:45 arbandyo ship $ */
3
5 -- PROCEDURE ReverseCdl
6 -- ========================================================================
7
8 PROCEDURE ReverseCdl( X_expenditure_item_id IN NUMBER
9 , X_billable_flag IN VARCHAR2
10 , X_amount IN NUMBER DEFAULT NULL
11 , X_quantity IN NUMBER DEFAULT NULL
12 , X_burdened_cost IN NUMBER DEFAULT NULL
13 , X_dr_ccid IN NUMBER DEFAULT NULL
14 , X_cr_ccid IN NUMBER DEFAULT NULL
15 , X_tr_source_accounted IN VARCHAR2 DEFAULT NULL
16 , X_line_type IN VARCHAR2
17 , X_user IN NUMBER
18 , X_denom_currency_code IN VARCHAR2
19 , X_denom_raw_cost IN NUMBER
20 , X_denom_burden_cost IN NUMBER
21 , X_acct_currency_code IN VARCHAR2
22 , X_acct_rate_date IN DATE
23 , X_acct_rate_type IN VARCHAR2
24 , X_acct_exchange_rate IN NUMBER
25 , X_acct_raw_cost IN NUMBER
26 , X_acct_burdened_cost IN NUMBER
27 , X_project_currency_code IN VARCHAR2
28 , X_project_rate_date IN DATE
29 , X_project_rate_type IN VARCHAR2
30 , X_project_exchange_rate IN NUMBER
31 , P_Projfunc_currency_code IN VARCHAR2 default null
32 , P_Projfunc_cost_rate_date IN DATE default null
33 , P_Projfunc_cost_rate_type IN VARCHAR2 default null
34 , P_Projfunc_cost_exchange_rate IN NUMBER default null
35 , P_project_raw_cost IN NUMBER default null
36 , P_project_burdened_cost IN NUMBER default null
37 , P_Work_Type_Id IN NUMBER default null
38 , X_err_code IN OUT NOCOPY NUMBER
39 , X_err_stage IN OUT NOCOPY VARCHAR2
40 , X_err_stack IN OUT NOCOPY VARCHAR2
41 , p_mode IN VARCHAR2 default 'COSTING'
42 , X_line_num IN NUMBER DEFAULT NULL ) -- Bug 4374769 : A new parameter X_line_num is added.
43 -- , P_agreement_id IN NUMBER Default NULL) --FSIO Changes
44 IS
45
46 -- This procedure can have X_amount, X_quantity, X_burdened_cost, X_dr_ccid, X_cr_ccid parameters
47 -- NULL. If it is NULL then the original values will be used while creating the new CDL.
48 -- X_billable_flag will be used when called from adjustments. X_tr_source_accounted says if it
49 -- is an accounted for transaction
50
51 trx_source VARCHAR2(30);
52 gl_acct_flag VARCHAR2(1) ;
53 cdl_line_num NUMBER ;
54 max_cdl_line_num NUMBER ;
55 p_expenditure_item_id NUMBER ;
56 p_line_num NUMBER ;
57 p_transfer_status_code VARCHAR2(30) ;
58 p_amount NUMBER;
59 p_quantity NUMBER;
60 p_billable_flag VARCHAR2(1);
61 p_request_id NUMBER ;
62 p_program_application_id NUMBER ;
63 p_program_id NUMBER ;
64 p_program_update_date DATE ;
65 p_expenditure_item_date DATE ;
66 p_pa_date DATE ;
67 p_recvr_pa_date DATE ; /**CBGA**/
68 p_dr_ccid NUMBER ;
69 p_gl_date DATE ;
70 p_transferred_date DATE ;
71 p_transfer_rejection_reason VARCHAR2(250);
72 p_batch_name VARCHAR2(30) ;
73 p_accumulated_flag VARCHAR2(1) ;
74 p_resource_accumulated_flag VARCHAR2(1) ;
75 p_reversed_flag VARCHAR2(1) ;
76 p_line_num_reversed NUMBER ;
77 p_sys_reference1 VARCHAR2(30) ;
78 p_sys_reference2 VARCHAR2(30) ;
79 p_sys_reference3 VARCHAR2(30) ;
80 p_cr_ccid NUMBER;
81 p_ind_compiled_set_id NUMBER;
82 p_line_type VARCHAR2(1) ;
83 p_burdened_cost NUMBER ;
84 p_denom_currency_code VARCHAR2(15);
85 p_denom_raw_cost NUMBER;
86 p_denom_burden_cost NUMBER;
87 p_acct_currency_code VARCHAR2(15);
88 p_acct_rate_date DATE;
89 p_acct_rate_type VARCHAR2(30);
90 p_acct_exchange_rate NUMBER;
91 p_acct_raw_cost NUMBER;
92 p_acct_burdened_cost NUMBER;
93 p_project_currency_code VARCHAR2(15);
94 p_project_rate_date DATE;
95 p_project_rate_type VARCHAR2(30);
96 p_project_exchange_rate NUMBER;
97 p_project_id NUMBER;
98 p_task_id NUMBER;
99 old_stack VARCHAR2(2000);
100
101 -- Start EPP Changes
102 p_pa_period_name VARCHAR2(15);
103 p_gl_period_name VARCHAR2(15);
104 p_recvr_gl_date DATE;
105 p_recvr_gl_period_name VARCHAR2(15);
106 p_recvr_pa_period_name VARCHAR2(15);
107 -- End EPP Changes
108
109 --Start PA-I Changes
110 l_Projfunc_currency_code VARCHAR2(15);
111 l_Projfunc_cost_rate_date DATE;
112 l_Projfunc_cost_rate_type VARCHAR2(30);
113 l_Projfunc_cost_exchange_rate NUMBER;
114 l_project_raw_cost NUMBER;
115 l_project_burdened_cost NUMBER;
116 l_Work_Type_Id NUMBER;
117 -- End PA-I Changes
118
119 -- AP Discounts
120 p_sys_reference4 VARCHAR2(30) ;
121 p_sys_reference5 NUMBER ;
122
123 /* Bug 4374769 : The l_transfer_status_code and l_line_type variables are used to set the transfer_status_code to 'G' and line_type to 'I'
124 for the reversing and new cdls created because of PJI Summarization. These variables have their default values as NULL.*/
125
126 l_transfer_status_code VARCHAR2(30) DEFAULT NULL ;
130 l_agreement_id varchar2(1) default NULL ; --FSIO Changes
127 l_line_type VARCHAR2(1) DEFAULT NULL ;
128 l_si_assets_addition_flag varchar2(1) default NULL ;
129 l_rec_found VARCHAR2(1) := 'Y'; /* 10004773 */
131 l_cbs_element_id NUMBER ; -- Added for CBS Enhancement Bug 16220146
132 BEGIN
133 /* Selects the row for which a negative CDL is to be created
134 Project Summarization changes : Pick up project_id, task_id and pass them to the createnewcdl procedure */
135
136 x_err_stage := 'Get the max CDL for the exp item id' ;
137
138 /* Bug 4374769 : The where condition in the following select statement that selects the row for which a negative CDL is to be created is modified
139 such that when the p_mode is 'INTERFACE' it selects the line_number, that is passed to the ReverseCdl procedure through
140 the parameter X_line_num, for reversing. */
141
142 BEGIN /* 10004773 */
143 SELECT max(cdl.line_num),
144 cdl.transfer_status_code,
145 cdl.amount,
146 cdl.quantity,
147 cdl.request_id,
148 cdl.billable_flag,
149 cdl.program_application_id,
150 cdl.program_id,
151 cdl.program_update_date,
152 cdl.pa_date,
153 cdl.recvr_pa_date, /**CBGA**/
154 cdl.dr_code_combination_id,
155 cdl.gl_date,
156 cdl.transferred_date,
157 cdl.transfer_rejection_reason,
158 cdl.accumulated_flag,
159 cdl.resource_accumulated_flag,
160 cdl.cr_code_combination_id,
161 cdl.ind_compiled_set_id,
162 cdl.line_type,
163 NVL(cdl.burdened_cost,0) + nvl(cdl.projfunc_burdened_change,0) burdened_cost,
164 cdl.system_reference1,
165 cdl.system_reference2,
166 cdl.system_reference3,
167 cdl.denom_currency_code,
168 cdl.denom_raw_cost,
169 nvl(cdl.denom_burdened_cost,0) + nvl(cdl.denom_burdened_change,0) denom_burdened_cost,
170 cdl.acct_currency_code,
171 cdl.acct_rate_date,
172 cdl.acct_rate_type,
173 cdl.acct_exchange_rate,
174 cdl.acct_raw_cost,
175 nvl(cdl.acct_burdened_cost,0) + Nvl(cdl.acct_burdened_change,0) acct_burdened_cost,
176 cdl.project_currency_code,
177 cdl.project_rate_date,
178 cdl.project_rate_type,
179 cdl.project_exchange_rate,
180 cdl.project_id,
181 cdl.task_id,
182 cdl.pa_period_name,
183 cdl.gl_period_name,
184 cdl.recvr_pa_period_name,
185 cdl.recvr_gl_period_name,
186 cdl.recvr_gl_date,
187 cdl.projfunc_currency_code,
188 cdl.projfunc_cost_rate_type,
189 cdl.projfunc_cost_rate_date,
190 cdl.projfunc_cost_exchange_rate,
191 cdl.project_raw_cost,
192 nvl(cdl.project_burdened_cost,0) + nvl(cdl.project_burdened_change,0) project_burdened_cost,
193 cdl.work_type_id,
194 cdl.system_reference4,
195 cdl.system_reference5,
196 decode(cdl.si_assets_addition_flag, 'Y','T', 'O','T', 'R', 'T',cdl.si_assets_addition_flag)
197 --,agreement_id --FSIO Changes
198 ,cdl.cbs_element_id -- Added for CBS Enhancement Bug 16220146
199 INTO
200 max_cdl_line_num ,
201 p_transfer_status_code ,
202 p_amount ,
203 p_quantity ,
204 p_request_id ,
205 p_billable_flag ,
206 p_program_application_id ,
207 p_program_id ,
208 p_program_update_date ,
209 p_pa_date ,
210 p_recvr_pa_date , /**CBGA**/
211 p_dr_ccid ,
212 p_gl_date ,
213 p_transferred_date ,
214 p_transfer_rejection_reason ,
215 p_accumulated_flag ,
216 p_resource_accumulated_flag ,
217 p_cr_ccid ,
218 p_ind_compiled_set_id ,
219 p_line_type ,
220 p_burdened_cost ,
221 p_sys_reference1 ,
222 p_sys_reference2 ,
223 p_sys_reference3 ,
224 p_denom_currency_code ,
225 p_denom_raw_cost ,
226 p_denom_burden_cost ,
227 p_acct_currency_code ,
228 p_acct_rate_date ,
229 p_acct_rate_type ,
230 p_acct_exchange_rate ,
231 p_acct_raw_cost ,
232 p_acct_burdened_cost ,
233 p_project_currency_code ,
234 p_project_rate_date ,
235 p_project_rate_type ,
239 , p_pa_period_name
236 p_project_exchange_rate ,
237 p_project_id ,
238 p_task_id
240 , p_gl_period_name
241 , p_recvr_pa_period_name
242 , p_recvr_gl_period_name
243 , p_recvr_gl_date
244 , l_projfunc_currency_code
245 , l_projfunc_cost_rate_type
246 , l_projfunc_cost_rate_date
247 , l_projfunc_cost_exchange_rate
248 , l_project_raw_cost
249 , l_project_burdened_cost
250 , l_work_type_id
251 , p_sys_reference4
252 , p_sys_reference5
253 , l_si_assets_addition_flag
254 --, l_agreement_id --FSIO Changes
255 , l_cbs_element_id -- Added for CBS Enhancement Bug 16220146
256 FROM
257 -- pa_cost_distribution_lines cdl -- 12i MOAC changes
258 pa_cost_distribution_lines_All cdl
259 WHERE cdl.expenditure_item_id = X_expenditure_item_id
260 AND DECODE(p_mode,'INTERFACE',NULL,cdl.line_num_reversed) IS NULL -- Bug 4374769
261 AND DECODE(p_mode,'INTERFACE',NULL,cdl.reversed_flag) IS NULL -- Bug 4374769
262 AND cdl.line_type = X_line_type
263 AND cdl.line_num = DECODE ( p_mode, 'INTERFACE', X_line_num, cdl.line_num) -- Bug 4374769
264 /* Added this Not exists Clause for the bug 5509019 */
265 AND NOT EXISTS (select 1 from pa_cost_distribution_lines_all cdl1
269 and cdl1.line_type = 'I'
266 where cdl1.expenditure_item_id = cdl.expenditure_item_id
267 and cdl1.line_num_reversed = cdl.line_num
268 and cdl1.transfer_status_code = 'G'
270 and cdl1.pji_summarized_flag = 'N'
271 and p_mode = 'INTERFACE')
272 GROUP BY cdl.transfer_status_code,
273 cdl.amount,
274 cdl.quantity,
275 cdl.request_id,
276 cdl.billable_flag,
277 cdl.program_application_id,
278 cdl.program_id,
279 cdl.program_update_date,
280 cdl.pa_date,
281 cdl.recvr_pa_date, /**CBGA**/
282 cdl.dr_code_combination_id,
283 cdl.gl_date,
284 cdl.transferred_date,
285 cdl.transfer_rejection_reason,
286 cdl.accumulated_flag,
287 cdl.resource_accumulated_flag,
288 cdl.cr_code_combination_id,
289 cdl.ind_compiled_set_id,
290 cdl.line_type,
291 nvl(cdl.burdened_cost,0) + nvl(cdl.projfunc_burdened_change,0),
292 cdl.system_reference1,
293 cdl.system_reference2,
294 cdl.system_reference3,
295 cdl.denom_currency_code,
296 cdl.denom_raw_cost,
297 NVL(cdl.denom_burdened_cost,0) + nvl(cdl.denom_burdened_change,0),
298 cdl.acct_currency_code,
299 cdl.acct_rate_date,
300 cdl.acct_rate_type,
301 cdl.acct_exchange_rate,
302 cdl.acct_raw_cost,
303 NVL(cdl.acct_burdened_cost,0) + nvl(cdl.acct_burdened_change,0),
304 cdl.project_currency_code,
305 cdl.project_rate_date,
306 cdl.project_rate_type,
307 cdl.project_exchange_rate,
308 cdl.project_id,
309 cdl.task_id,
310 cdl.pa_period_name,
311 cdl.gl_period_name,
312 cdl.recvr_pa_period_name,
313 cdl.recvr_gl_period_name,
314 cdl.recvr_gl_date,
315 cdl.projfunc_currency_code,
316 cdl.projfunc_cost_rate_type,
317 cdl.projfunc_cost_rate_date,
318 cdl.projfunc_cost_exchange_rate,
319 cdl.project_raw_cost,
320 NVL(cdl.project_burdened_cost,0) + nvl(cdl.project_burdened_change,0),
321 cdl.work_type_id ,
322 cdl.system_reference4,
323 cdl.system_reference5,
324 decode(cdl.si_assets_addition_flag, 'Y','T', 'O','T', 'R', 'T',cdl.si_assets_addition_flag),
325 cdl.cbs_element_id; /* Added for Bug 16754674 */
326 --,agreement_id;
327
328 EXCEPTION /* 10004773 */
329 WHEN NO_DATA_FOUND THEN
330 l_rec_found := 'N';
331 END; /* 10004773 */
332 /* Update the reverse flag of the CDL */
333
334 x_err_stage := 'Updating the reverse flag' ;
335 x_err_stack := x_err_stack||'-> Update the reverse flag';
336
337 /* Bug 4374769 : If p_mode is 'INTERFACE' i.e if the reversing and new cdls are created because of PJI summarization then the reversed_flag is
338 kept as NULL on the original cdl. */
339
343 WHERE expenditure_item_id = X_expenditure_item_id
340 If p_mode <> 'INTERFACE' Then
341 UPDATE pa_cost_distribution_lines_all
342 SET reversed_flag = 'Y'
344 AND line_num = max_cdl_line_num ;
345 end if;
346
347 /* Create the new reversing CDL */
348
349 /* bug 2891527 */
350 If p_mode = 'VIADJUST' Then
351 p_transfer_status_code := 'G';
352 end if;
353 /* bug 2891527 */
354
355 /* Bug 5561542 - Start */
356 If p_mode = 'WORK_TYP_ADJ' Then
357 p_transfer_status_code := 'P';
358 end if;
359 /* Bug 5561542 - End */
360 IF l_rec_found = 'Y' THEN /* 10004773 */
361 x_err_stage := 'Create reverse CDL' ;
362 x_err_stack := x_err_stack||'-> Create reverse CDL';
363
364 /* Bug 4374769 : If p_mode is 'INTERFACE' i.e if the reversing and new cdls are created because of PJI summarization , then the
365 transfer_status_code is set to 'G' and line_type to 'I' for the reversing and new cdls. */
366
367 If P_mode = 'INTERFACE' Then
368 l_transfer_status_code := 'G';
369 l_line_type := 'I';
370 End If;
371
372 Pa_Costing.CreateNewCdl(
373 X_expenditure_item_id => X_expenditure_item_id
374 , X_amount => -p_amount
375 , X_dr_ccid => p_dr_ccid
376 , X_cr_ccid => p_cr_ccid
377 , X_transfer_status_code => NVL(l_transfer_status_code, p_transfer_status_code) -- Bug 4374769
378 , X_quantity => -p_quantity
379 , X_billable_flag => p_billable_flag
380 , X_request_id => p_request_id
381 , X_program_application_id => p_program_application_id
382 , x_program_id => p_program_id
383 , x_program_update_date => p_program_update_date
384 , X_pa_date => p_pa_date
385 , X_recvr_pa_date => p_recvr_pa_date /**CBGA**/
386 , X_gl_date => p_gl_date
387 , X_transferred_date => p_transferred_date
388 , X_transfer_rejection_reason => p_transfer_rejection_reason
389 , X_line_type => NVL(l_line_type,p_line_type) -- Bug 4374769
390 , X_ind_compiled_set_id => p_ind_compiled_set_id
391 , X_burdened_cost => -p_burdened_cost
392 , X_line_num_reversed => max_cdl_line_num
393 , X_reverse_flag => NULL /* Bug 3668005 :Modified from 'Y' to NULL */
394 , X_user => X_user
395 , X_err_code => X_err_code
396 , X_err_stage => X_err_stage
397 , X_err_stack => X_err_stack
398 , X_project_id => p_project_id
399 , X_task_id => p_task_id
400 , X_cdlsr1 => p_sys_reference1
401 , X_cdlsr2 => p_sys_reference2
402 , X_cdlsr3 => p_sys_reference3
403 , X_denom_currency_code => p_denom_currency_code
404 , X_denom_raw_cost => -p_denom_raw_cost
405 , X_denom_burden_cost => -p_denom_burden_cost
406 , X_acct_currency_code => p_acct_currency_code
407 , X_acct_rate_date => p_acct_rate_date
408 , X_acct_rate_type => p_acct_rate_type
409 , X_acct_exchange_rate => p_acct_exchange_rate
410 , X_acct_raw_cost => -p_acct_raw_cost
411 , X_acct_burdened_cost => -p_acct_burdened_cost
412 , X_project_currency_code => p_project_currency_code
413 , X_project_rate_date => p_project_rate_date
414 , X_project_rate_type => p_project_rate_type
415 , X_project_exchange_rate => p_project_exchange_rate
416 , P_PaPeriodName => P_Pa_Period_Name
417 , P_RecvrPaPeriodName => P_Recvr_Pa_Period_Name
418 , P_GlPeriodName => P_Gl_Period_Name
419 , P_RecvrGlDate => P_Recvr_Gl_Date
420 , P_RecvrGlPeriodName => P_Recvr_Gl_Period_Name
421 , P_Projfunc_currency_code => l_Projfunc_currency_code
422 , P_Projfunc_cost_rate_date => l_Projfunc_cost_rate_date
423 , P_Projfunc_cost_rate_type => l_Projfunc_cost_rate_type
424 , P_Projfunc_cost_exchange_rate => l_Projfunc_cost_exchange_rate
425 , P_Project_Raw_Cost => -l_Project_Raw_Cost
426 , P_Project_Burdened_Cost => -l_Project_Burdened_Cost
427 , P_Work_Type_Id => l_Work_Type_Id
428 , p_mode => p_mode
429 , p_cdlsr4 => p_sys_reference4
430 , p_si_assets_addition_flag => l_si_assets_addition_flag
431 , p_cdlsr5 => p_sys_reference5
432 , p_cbs_element_id => l_cbs_element_id -- Added for CBS Enhancement Bug 16220146
433 );
434 --, p_agreement_id => l_agreement_id); --FSIO Changes
435
436 /* Assign the new values */
437
438 if x_amount is not null then
439 p_amount := x_amount ;
440 end if;
441
442 if x_dr_ccid is not null then
443 p_dr_ccid := x_dr_ccid ;
444 end if;
445
446 if x_cr_ccid is not null then
447 p_cr_ccid := x_cr_ccid ;
448 end if;
449
450 if nvl(x_tr_source_accounted, 'N') = 'N' then
451 p_transfer_status_code := 'P' ;
452 end if ;
453
454 if x_quantity is not null then
455 p_quantity := x_quantity ;
456 end if;
457
458 if x_burdened_cost is not null then
459 p_burdened_cost := x_burdened_cost ;
460 end if;
461
462 if x_denom_raw_cost is not null then
463 p_denom_raw_cost := x_denom_raw_cost;
464 end if;
465
466 if x_denom_burden_cost is not null then
467 p_denom_burden_cost := x_denom_burden_cost;
468 end if;
469
470 if x_acct_raw_cost is not null then
471 p_acct_raw_cost := x_acct_raw_cost;
472 end if;
473
474 if x_acct_burdened_cost is not null then
475 p_acct_burdened_cost := x_acct_burdened_cost;
476 end if;
477
478 if p_project_raw_cost is not null then
479 l_project_raw_cost := p_project_raw_cost;
480 end if;
481
482 if p_project_burdened_cost is not null then
483 l_project_burdened_cost := p_project_burdened_cost;
484 end if;
485
486 if p_work_type_id is not null then
487 l_work_type_id := p_work_type_id;
488 end if;
489
490 /** added this condition as the transaction adjustment api passes null for
491 * for this column for the work type adjustments
492 **/
493 If X_billable_flag is NOT NULL then
494 p_billable_flag := X_billable_flag;
495 End if;
496
497 /* bug 2891527 */
498 If p_mode = 'VIADJUST' Then
499 select cost_ind_compiled_set_id
500 into p_ind_compiled_set_id
501 from pa_expenditure_items_all
502 where expenditure_item_id = X_expenditure_item_id;
503 end if;
504 /* bug 2891527 */
505
506 /* Create a new CDL */
507 x_err_stage := 'Creating a new CDL';
508 x_err_stack := x_err_stack||'-> Create new CDL';
509
510 IF l_si_assets_addition_flag = 'N' THEN
511 l_si_assets_addition_flag := 'T' ;
512 END IF ;
513
514 --if p_agreement_id is not null then --FSIO Change
515 -- l_agreement_id := p_agreement_id;
516 -- end if;
517
518 Pa_Costing.CreateNewCdl(
519 X_expenditure_item_id => X_expenditure_item_id
520 , X_amount => p_amount
521 , X_dr_ccid => p_dr_ccid
522 , X_cr_ccid => p_cr_ccid
523 , X_transfer_status_code => NVL(l_transfer_status_code,p_transfer_status_code) -- Bug 4374769
524 , X_quantity => p_quantity
525 , X_billable_flag => p_billable_flag /** changed x_bill to p_bil **/
526 , X_request_id => p_request_id
527 , X_program_application_id => p_program_application_id
528 , x_program_id => p_program_id
529 , x_program_update_date => p_program_update_date
530 , X_pa_date => p_pa_date
531 , X_recvr_pa_date => p_recvr_pa_date /**CBGA**/
532 , X_gl_date => p_gl_date
533 , X_transferred_date => p_transferred_date
534 , X_transfer_rejection_reason => p_transfer_rejection_reason
535 , X_line_type => NVL(l_line_type,p_line_type) -- Bug 4374769
536 , X_ind_compiled_set_id => p_ind_compiled_set_id
537 , X_burdened_cost => p_burdened_cost
538 , X_line_num_reversed => NULL
539 , X_reverse_flag => NULL
540 , X_user => X_user
541 , X_err_code => X_err_code
542 , X_err_stage => X_err_stage
543 , X_err_stack => X_err_stack
544 , X_project_id => p_project_id
545 , X_task_id => p_task_id
546 , X_cdlsr1 => p_sys_reference1
547 , X_cdlsr2 => p_sys_reference2
548 , X_cdlsr3 => p_sys_reference3
549 , X_denom_currency_code => p_denom_currency_code
550 , X_denom_raw_cost => p_denom_raw_cost
551 , X_denom_burden_cost => p_denom_burden_cost
552 , X_acct_currency_code => p_acct_currency_code
553 , X_acct_rate_date => p_acct_rate_date
554 , X_acct_rate_type => p_acct_rate_type
555 , X_acct_exchange_rate => p_acct_exchange_rate
556 , X_acct_raw_cost => p_acct_raw_cost
557 , X_acct_burdened_cost => p_acct_burdened_cost
558 , X_project_currency_code => p_project_currency_code
559 , X_project_rate_date => p_project_rate_date
560 , X_project_rate_type => p_project_rate_type
561 , X_project_exchange_rate => p_project_exchange_rate
562 , P_PaPeriodName => P_Pa_Period_Name
563 , P_RecvrPaPeriodName => P_Recvr_Pa_Period_Name
564 , P_GlPeriodName => P_Gl_Period_Name
565 , P_RecvrGlDate => P_Recvr_Gl_Date
566 , P_RecvrGlPeriodName => P_Recvr_Gl_Period_Name
567 , P_Projfunc_currency_code => l_Projfunc_currency_code
568 , P_Projfunc_cost_rate_date => l_Projfunc_cost_rate_date
569 , P_Projfunc_cost_rate_type => l_Projfunc_cost_rate_type
570 , P_Projfunc_cost_exchange_rate => l_Projfunc_cost_exchange_rate
571 , P_Project_Raw_Cost => l_Project_Raw_Cost
572 , P_Project_Burdened_Cost => l_Project_Burdened_Cost
573 , P_Work_Type_Id => l_Work_Type_Id
574 , p_mode => p_mode
575 , p_cdlsr4 => p_sys_reference4
576 , p_si_assets_addition_flag => l_si_assets_addition_flag
577 , p_cdlsr5 => p_sys_reference5 -- Bug 5561542
578 --, p_agreement_id => l_agreement_id --FSIO Changes
579 , p_cbs_element_id => l_cbs_element_id -- Added for CBS Enhancement Bug 16220146
580 );
581 END IF; /* for bug 10004773 */
582 x_err_stack := old_stack ;
583
584 EXCEPTION
585 WHEN OTHERS THEN
586 X_err_code := SQLCODE;
587 RAISE;
588
589 END ReverseCdl;
590
591
592 -- ========================================================================
593 -- PROCEDURE CreateNewCdl due to bug 666884. this procedure handle 3 system refs.
594 -- ========================================================================
595
596 PROCEDURE CreateNewCdl( X_expenditure_item_id IN NUMBER
597 , X_amount IN NUMBER
598 , X_dr_ccid IN NUMBER
599 , X_cr_ccid IN NUMBER
600 , X_transfer_status_code IN VARCHAR2
601 , X_quantity IN NUMBER
602 , X_billable_flag IN VARCHAR2
603 , X_request_id IN NUMBER
604 , X_program_application_id IN NUMBER
605 , x_program_id IN NUMBER
606 , x_program_update_date IN DATE
607 , X_pa_date IN DATE
608 , X_recvr_pa_date IN DATE /**CBGA**/
609 , X_gl_date IN DATE
610 , X_transferred_date IN DATE
611 , X_transfer_rejection_reason IN VARCHAR2
612 , X_line_type IN VARCHAR2
613 , X_ind_compiled_set_id IN NUMBER
614 , X_burdened_cost IN NUMBER
615 , X_line_num_reversed IN NUMBER
616 , X_reverse_flag IN VARCHAR2
617 , X_user IN NUMBER
618 , X_err_code IN OUT NOCOPY NUMBER
619 , X_err_stage IN OUT NOCOPY VARCHAR2
620 , X_err_stack IN OUT NOCOPY VARCHAR2
621 , X_project_id IN NUMBER
622 , X_task_id IN NUMBER
623 , X_cdlsr1 IN VARCHAR2 default null
624 , X_cdlsr2 IN VARCHAR2 default null
625 , X_cdlsr3 IN VARCHAR2 default null
626 , X_denom_currency_code IN VARCHAR2 default null
627 , X_denom_raw_cost IN NUMBER default null
628 , X_denom_burden_cost IN NUMBER default null
629 , X_acct_currency_code IN VARCHAR2 default null
630 , X_acct_rate_date IN DATE default null
631 , X_acct_rate_type IN VARCHAR2 default null
632 , X_acct_exchange_rate IN NUMBER default null
633 , X_acct_raw_cost IN NUMBER default null
634 , X_acct_burdened_cost IN NUMBER default null
635 , X_project_currency_code IN VARCHAR2 default null
636 , X_project_rate_date IN DATE default null
637 , X_project_rate_type IN VARCHAR2 default null
638 , X_project_exchange_rate IN NUMBER default null
639 , P_PaPeriodName IN Varchar2 default null
640 , P_RecvrPaPeriodName IN Varchar2 default null
641 , P_GlPeriodName IN Varchar2 default null
642 , P_RecvrGlDate IN DATE default null
643 , P_RecvrGlPeriodName IN Varchar2 default null
644 , P_Projfunc_currency_code IN VARCHAR2 default null
645 , P_Projfunc_cost_rate_date IN DATE default null
646 , P_Projfunc_cost_rate_type IN VARCHAR2 default null
647 , P_Projfunc_cost_exchange_rate IN NUMBER default null
648 , P_project_raw_cost IN NUMBER default null
649 , P_project_burdened_cost IN NUMBER default null
650 , P_Work_Type_Id IN NUMBER default null
651 , p_mode IN VARCHAR2 default 'COSTING'
652 , p_cdlsr4 IN VARCHAR2 default null
653 , p_si_assets_addition_flag IN VARCHAR2 default NULL
654 , p_cdlsr5 IN NUMBER default NULL
655 , P_Parent_Line_Num IN NUMBER DEFAULT NULL
656 /* 12.2 payroll intg .. start */
657 , p_rate_source_code IN VARCHAR2 default null
658 , p_costing_method IN VARCHAR2 default null
659 /* 12.2 payroll intg .. end */
660 --, p_agreement_id IN NUMBER default null) --FSIO Changes
661 , p_cbs_element_id IN NUMBER default null -- Added for CBS Enhancement Bug 16220146
662 )
663 IS
664
665 new_cdl_line_num NUMBER ;
666 old_stack VARCHAR2(2000);
667
668 /* bug 3149022 */
669 l_ei_date DATE := NULL;
670 l_exp_id NUMBER := NULL;
671 l_sys_link_function VARCHAR2(3) := NULL;
672 l_org_id pa_expenditure_items.org_id%type := NULL;
673 l_recvr_org_id pa_expenditure_items.org_id%type := NULL;
674 l_sob_id NUMBER := NULL;
675 l_recvr_sob_id NUMBER := NULL;
676 l_pa_date DATE := NULL;
677 l_pa_period_name VARCHAR2(15) := NULL;
678 l_gl_date DATE := NULL;
679 l_gl_period_name VARCHAR2(15) := NULL;
680 l_recvr_pa_date DATE := NULL;
681 l_recvr_pa_period_name VARCHAR2(15) := NULL;
682 l_recvr_gl_date DATE := NULL;
683 l_recvr_gl_period_name VARCHAR2(15) := NULL;
684 /* l_err_code NUMBER; bug fix: 3258043 */
685 l_err_code VARCHAR2(100) := NULL;
686 l_err_stage NUMBER := NULL;
687 l_status NUMBER := NULL;
688 /* bug 3149022 */
689
690 BEGIN
691 -- Initialize the error stack
692 pa_cc_utils.set_curr_function('PA_COSTING.CreateNewCdl');
693 /* Bug 3149022 */
694
695 SELECT ITEMS.expenditure_item_date
696 ,ITEMS.org_id
697 ,NVL(ITEMS.recvr_org_id , ITEMS.ORG_ID)
698 ,ITEMS.system_linkage_function
699 ,ITEMS.expenditure_id
700 INTO l_ei_date
701 ,l_org_id
702 ,l_recvr_org_id
703 ,l_sys_link_function
704 ,l_exp_id
705 -- FROM pa_expenditure_items ITEMS -- 12i MOAC changes
706 FROM pa_expenditure_items_All ITEMS
707 WHERE ITEMS.expenditure_item_id = X_expenditure_item_id;
708
709 SELECT imp1.set_of_books_id, imp2.set_of_books_id
710 INTO l_sob_id, l_recvr_sob_id
711 FROM pa_implementations_all imp1, pa_implementations_all imp2
712 -- start 12i MOAC changes
713 -- WHERE nvl(imp1.org_id,-99) = nvl(l_org_id,-99)
714 -- AND nvl(imp2.org_id,-99) = nvl(l_recvr_org_id,-99);
715 WHERE imp1.org_id = l_org_id
716 AND imp2.org_id = l_recvr_org_id;
717 -- end 12i MOAC changes
718
719
720 -- call get_period_information only for the following cases, bug 3357936
721 IF (p_mode = 'RECLASS' OR p_mode = 'WORK_TYP_ADJ' OR p_mode = 'TRXADJUST')
722 THEN
723 PA_UTILS2.get_period_information(
724 p_expenditure_item_date => l_ei_date
725 ,p_expenditure_id => l_exp_id
726 ,p_system_linkage_function => l_sys_link_function
727 ,p_line_type => x_line_type
728 ,p_prvdr_raw_pa_date => X_pa_date
729 ,p_recvr_raw_pa_date => X_recvr_pa_date
730 ,p_prvdr_raw_gl_date => X_gl_date
731 ,p_recvr_raw_gl_date => P_RecvrGlDate
732 ,p_prvdr_org_id => l_org_id
733 ,p_recvr_org_id => l_recvr_org_id
734 ,p_prvdr_sob_id => l_sob_id
735 ,p_recvr_sob_id => l_recvr_sob_id
736 ,p_calling_module => 'CDL'
737 ,x_prvdr_pa_date => l_pa_date
738 ,x_prvdr_pa_period_name => l_pa_period_name
739 ,x_prvdr_gl_date => l_gl_date
740 ,x_prvdr_gl_period_name => l_gl_period_name
741 ,x_recvr_pa_date => l_recvr_pa_date
742 ,x_recvr_pa_period_name => l_recvr_pa_period_name
743 ,x_recvr_gl_date => l_recvr_gl_date
744 ,x_recvr_gl_period_name => l_recvr_gl_period_name
745 ,x_error_code => l_err_code
746 ,x_return_status => l_status
747 ,x_error_stage => l_err_stage );
748
749 /****** Bug 3668005 : Will be executed only during interface for NEW CDLs. ******/
750 ElsIf (p_mode='INTERFACE' and X_line_num_reversed IS NULL and X_reverse_flag is NULL) Then
751 Select
752 pa_utils2.get_prvdr_gl_date(
753 X_gl_date
754 ,decode(EI.system_linkage_function
755 , 'VI', 200
756 , 101) -- GL Application ID = 101 and AP Application Id = 200 .
757 ,l_sob_id) gl_date,
761 ,decode(EI.system_linkage_function
758 pa_utils2.get_gl_period_name (
759 pa_utils2.get_prvdr_gl_date(
760 X_gl_date
762 , 'VI', 200
763 , 101)
764 ,l_sob_id)
765 ,EI.org_id) gl_period_name,
766 pa_utils2.get_recvr_gl_date(
767 P_RecvrGlDate
768 ,decode(EI.system_linkage_function
769 , 'VI', 200
770 , 101)
771 ,l_recvr_sob_id) recvr_gl_date,
772 pa_utils2.get_gl_period_name (
773 pa_utils2.get_recvr_gl_date(
774 P_RecvrGlDate
775 ,decode(EI.system_linkage_function
776 , 'VI', 200
777 , 101)
778 ,l_recvr_sob_id)
779 ,nvl(EI.recvr_org_id,EI.org_id)) recvr_gl_period_name
780 Into l_gl_date,
781 l_gl_period_name,
782 l_recvr_gl_date,
783 l_recvr_gl_period_name
784 -- From PA_Expenditure_items EI, -- 12i MOAC changes
785 From PA_Expenditure_items_All EI /* Bug 5353670 / PQE Bug 5248665
786 PA_Implementations_All IMP */
787 Where EI.expenditure_item_id = X_expenditure_item_id;
788 /* AND NVL(EI.recvr_org_id,EI.ORG_ID) = IMP.org_id; Bug 5353670 / PQE Bug 5248665 */
789
790 END IF;
791
792 /****** Bug 3668005 Ends ******/
793
794 /* Bug 3149022 */
795
796 old_stack := X_err_stack ;
797 /* Get the maximum line number for the CDL */
798
799 X_err_stack := X_err_stack ||'->Max_line_num' ;
800 X_err_stage := '-> Get new CDL line num';
801
802 SELECT max(cdl.line_num)
803 INTO new_cdl_line_num
804 FROM pa_cost_distribution_lines cdl
805 WHERE cdl.expenditure_item_id = X_expenditure_item_id ;
806
807 /* Create the new reversing CDL */
808
809 X_err_stack := X_err_stack ||'->Max_line_num' ;
810 X_err_stage := '-> Insert row in CDL table';
811 pa_cc_utils.log_message('Gl Accounted Flag['||PA_TRANSACTIONS.GL_ACCOUNTED_FLAG||
812 ']l_gl_date['||l_gl_date||']x_gl_date['||x_gl_date||']');
813
814 -- Insert into pa_cost_distribution_lines
815 Insert into pa_cost_distribution_lines_All
816 ( line_num
817 , parent_line_num
818 , expenditure_item_id
819 , amount
820 , dr_code_combination_id
821 , cr_code_combination_id
822 , line_type
823 , ind_compiled_set_id
824 , burdened_cost
825 , transfer_status_code
826 , quantity
827 , billable_flag
828 , creation_date
829 , created_by
830 , request_id
831 , program_application_id
832 , program_id
833 , program_update_date
834 , pa_date
835 , recvr_pa_date /**CBGA**/
836 , gl_date
837 , transferred_date
838 , transfer_rejection_reason
839 , accumulated_flag
840 , resource_accumulated_flag
841 , reversed_flag
842 , line_num_reversed
843 , burden_sum_source_run_id
844 , system_reference1
845 , system_reference2
846 , system_reference3
847 , denom_currency_code
848 , denom_raw_cost
849 , denom_burdened_cost
850 , acct_currency_code
851 , acct_rate_date
852 , acct_rate_type
853 , acct_exchange_rate
854 , acct_raw_cost
855 , acct_burdened_cost
856 , project_currency_code
857 , project_rate_date
858 , project_rate_type
859 , project_exchange_rate
860 , project_id
861 , task_id
862 , Pa_Period_Name
863 , Recvr_Pa_Period_Name
864 , Gl_Period_Name
865 , Recvr_Gl_Date
866 , Recvr_Gl_Period_Name
867 , Projfunc_currency_code
868 , Projfunc_cost_rate_date
869 , Projfunc_cost_rate_type
870 , Projfunc_cost_exchange_rate
871 , Project_raw_cost
872 , Project_burdened_cost
873 , Work_type_id
874 , util_summarized_flag
875 , system_reference4
876 , system_reference5
877 , pji_summarized_flag /* Bug 3668005 :Added */
878 , org_id -- 12i MOAC changes
879 , si_assets_addition_flag
880 /* 12.2 payroll intg .. start */
881 , rate_source_code
882 , costing_method
883 /* 12.2 payroll intg .. end */
884 --, agreement_id --FSIO Changes
885 , cbs_element_id -- Added for CBS Enhancement Bug 16220146
886 )
887 Values
888 ( nvl(new_cdl_line_num, 0) + 1
889 , P_Parent_Line_Num
890 , X_expenditure_item_id
891 , x_amount
892 , x_dr_ccid
893 , x_cr_ccid
894 , x_line_type
895 , x_ind_compiled_set_id
896 , x_burdened_cost
897 , decode(p_mode,'TRXADJUST','G',x_transfer_status_code)
898 , x_quantity
899 , x_billable_flag
900 , sysdate
901 , X_user
902 , x_request_id
903 , x_program_application_id
904 , x_program_id
905 , x_program_update_date
906 , NVL(l_pa_date, X_pa_date) /* X_pa_date ** bug 3357936 */
907 , NVL(l_recvr_pa_date, X_recvr_pa_date) /* X_recvr_pa_date ** bug 3357936 */ /**CBGA**/
908 , NVL(l_gl_date, X_gl_date) /* X_gl_date ** bug 3357936 */
909 , X_transferred_date
910 , x_transfer_rejection_reason
911 , decode(p_mode,'TRXADJUST','Y','N') -- Accumalated flag
912 , decode(p_mode,'TRXADJUST','Y','N') -- Resource accumalated flag
913 , x_reverse_flag
914 , X_line_num_reversed
915 , -9999
916 , X_cdlsr1
917 , X_cdlsr2
918 , X_cdlsr3
919 , X_denom_currency_code
920 , X_denom_raw_cost
921 , X_denom_burden_cost
922 , X_acct_currency_code
923 , X_acct_rate_date
924 , X_acct_rate_type
925 , X_acct_exchange_rate
926 , X_acct_raw_cost
927 , X_acct_burdened_cost
928 , X_project_currency_code
929 , X_project_rate_date
930 , X_project_rate_type
931 , X_project_exchange_rate
932 , X_project_id
933 , X_task_id
934 , NVL(l_pa_period_name, P_PaPeriodName) /* P_PaPeriodName ** bug 3357936 */
935 , NVL(l_recvr_pa_period_name, P_RecvrPaPeriodName) /* P_RecvrPaPeriodName ** bug 3357936 */
936 /* Bug fix: 3258043 added decode to populate original GL info for accounted imported trans */
937 , NVL(l_gl_period_name, P_GlPeriodName)
938 /* P_GlPeriodName ** bug 3357936 */
939 , NVL(l_recvr_gl_date, P_RecvrGlDate)
940 /* P_RecvrGlDate ** bug 3357936 */
941 , NVL(l_recvr_gl_period_name, P_RecvrGlPeriodName)
942 /* P_RecvrGlPeriodName ** bug 3357936 */
943 , P_Projfunc_currency_code
944 , P_Projfunc_cost_rate_date
945 , P_Projfunc_cost_rate_type
946 , P_Projfunc_cost_exchange_rate
947 , P_Project_raw_cost
948 , P_Project_burdened_cost
949 , P_Work_type_id
950 , decode(p_mode,'TRXADJUST','N','N')
951 , p_cdlsr4
952 , p_cdlsr5
953 , 'N' /* Bug 3668005 :Added */
954 , l_org_id -- 12i MOAC changes
955 , p_si_assets_addition_flag
956 --, p_agreement_id --FSIO Changes
957 /* 12.2 payroll intg .. start */
958 , p_rate_source_code
959 , p_costing_method
960 /* 12.2 payroll intg .. end */
961 , p_cbs_element_id -- Added for CBS Enhancement Bug 16220146
962 ) ;
963
964 X_err_stack := old_stack ;
965
966 pa_cc_utils.reset_curr_function;
967
968 EXCEPTION
969 WHEN OTHERS THEN
970 X_err_code := SQLCODE;
971 RAISE;
972 END CreateNewCdl ;
973
974 -- ========================================================================
975 -- PROCEDURE CreateExternalCdl
976 -- ========================================================================
977
978 PROCEDURE CreateExternalCdl( X_expenditure_item_id IN NUMBER
979 , X_ei_date IN DATE
980 , X_amount IN NUMBER
981 , X_dr_ccid IN NUMBER
982 , X_cr_ccid IN NUMBER
983 , X_transfer_status_code IN VARCHAR2
984 , X_quantity IN NUMBER
985 , X_billable_flag IN VARCHAR2
986 , X_request_id IN NUMBER
987 , X_program_application_id IN NUMBER
988 , x_program_id IN NUMBER
989 , x_program_update_date IN DATE
990 , X_pa_date IN DATE
991 , X_recvr_pa_date IN DATE /**CBGA**/
992 , X_gl_date IN DATE
993 , X_transferred_date IN DATE
994 , X_transfer_rejection_reason IN VARCHAR2
995 , X_line_type IN VARCHAR2
996 , X_ind_compiled_set_id IN NUMBER
997 , X_burdened_cost IN NUMBER
998 , X_user IN NUMBER
999 , X_project_id IN NUMBER
1000 , X_task_id IN NUMBER
1001 , X_cdlsr1 IN VARCHAR2 default null
1002 , X_cdlsr2 IN VARCHAR2 default null
1003 , X_cdlsr3 IN VARCHAR2 default null
1004 , X_denom_currency_code IN VARCHAR2 default null
1005 , X_denom_raw_cost IN NUMBER default null
1006 , X_denom_burden_cost IN NUMBER default null
1007 , X_acct_currency_code IN VARCHAR2 default null
1008 , X_acct_rate_date IN DATE default null
1009 , X_acct_rate_type IN VARCHAR2 default null
1010 , X_acct_exchange_rate IN NUMBER default null
1011 , X_acct_raw_cost IN NUMBER default null
1012 , X_acct_burdened_cost IN NUMBER default null
1013 , X_project_currency_code IN VARCHAR2 default null
1014 , X_project_rate_date IN DATE default null
1015 , X_project_rate_type IN VARCHAR2 default null
1016 , X_project_exchange_rate IN NUMBER default null
1017 , P_PaPeriodName IN Varchar2 default null
1018 , P_RecvrPaPeriodName IN Varchar2 default null
1019 , P_GlPeriodName IN Varchar2 default null
1020 , P_RecvrGlDate IN DATE default null
1021 , P_RecvrGlPeriodName IN Varchar2 default null
1022 , P_Projfunc_currency_code IN VARCHAR2 default null
1023 , P_Projfunc_cost_rate_date IN DATE default null
1024 , P_Projfunc_cost_rate_type IN VARCHAR2 default null
1025 , P_Projfunc_cost_exchange_rate IN NUMBER default null
1026 , P_project_raw_cost IN NUMBER default null
1027 , P_project_burdened_cost IN NUMBER default null
1028 , P_Work_Type_Id IN NUMBER default null
1029 , p_cdlsr4 IN VARCHAR2 default null
1030 , p_si_assets_addition_flag in VARCHAR2 default null
1031 , p_cdlsr5 IN NUMBER default null
1032 , p_cbs_element_id IN NUMBER default null -- Added for CBS Enhancement Bug 16220146
1033 , X_err_code IN OUT NOCOPY NUMBER
1034 , X_err_stage IN OUT NOCOPY VARCHAR2
1035 , X_err_stack IN OUT NOCOPY VARCHAR2 )
1036 --, p_agreement_id IN NUMBER default null) --FSIO Changes
1037 IS
1038 BEGIN
1039
1040 /** CBGA **/
1041 if (x_pa_date IS NULL) then
1042 x_err_code := -20009 ;
1043 raise_application_error( -20009, 'INVALID_PA_DATE') ;
1044 end if;
1045
1046 if (x_recvr_pa_date IS NULL) then
1047 x_err_code := -20010 ;
1048 raise_application_error( -20010, 'INVALID_RECVR_PA_DATE') ;
1049 end if;
1050 -- Insert into PA_Cost_Distribution_lines
1051
1052 x_err_stage := 'Insert into PA_Cost_Disctribution_Lines';
1053 Pa_Costing.CreateNewCdl (
1054 X_expenditure_item_id => x_expenditure_item_id
1055 , X_amount => x_amount
1056 , X_dr_ccid => x_dr_ccid
1057 , X_cr_ccid => x_cr_ccid
1058 , X_transfer_status_code => x_transfer_status_code
1059 , X_quantity => x_quantity
1060 , X_billable_flag => x_billable_flag
1061 , X_request_id => x_request_id
1062 , X_program_application_id => x_program_application_id
1063 , x_program_id => x_program_id
1064 , x_program_update_date => x_program_update_date
1065 , X_pa_date => x_pa_date
1066 , X_recvr_pa_date => x_recvr_pa_date /**CBGA**/
1067 , X_gl_date => x_gl_date
1068 , X_transferred_date => x_transferred_date
1069 , X_transfer_rejection_reason => x_transfer_rejection_reason
1070 , X_line_type => x_line_type
1071 , X_ind_compiled_set_id => x_ind_compiled_set_id
1072 , X_burdened_cost => x_burdened_cost
1073 , X_line_num_reversed => NULL
1074 , X_reverse_flag => NULL
1075 , X_user => x_user
1076 , X_err_code => x_err_code
1077 , X_err_stage => x_err_stage
1078 , X_err_stack => x_err_stack
1079 , X_project_id => x_project_id
1080 , X_task_id => x_task_id
1081 , X_cdlsr1 => X_cdlsr1
1082 , X_cdlsr2 => X_cdlsr2
1083 , X_cdlsr3 => X_cdlsr3
1084 , X_denom_currency_code => X_denom_currency_code
1085 , X_denom_raw_cost => X_denom_raw_cost
1086 , X_denom_burden_cost => X_denom_burden_cost
1087 , X_acct_currency_code => X_acct_currency_code
1088 , X_acct_rate_date => X_acct_rate_date
1089 , X_acct_rate_type => X_acct_rate_type
1090 , X_acct_exchange_rate => X_acct_exchange_rate
1091 , X_acct_raw_cost => X_acct_raw_cost
1092 , X_acct_burdened_cost => X_acct_burdened_cost
1093 , X_project_currency_code => X_project_currency_code
1094 , X_project_rate_date => X_project_rate_date
1095 , X_project_rate_type => X_project_rate_type
1096 , X_project_exchange_rate => X_project_exchange_rate
1097 , P_PaPeriodName => P_PaPeriodName
1098 , P_RecvrPaPeriodName => P_RecvrPaPeriodName
1099 , P_GlPeriodName => P_GlPeriodName
1100 , P_RecvrGlDate => P_RecvrGlDate
1101 , P_RecvrGlPeriodName => P_RecvrGlPeriodName
1102 , P_Projfunc_currency_code => P_Projfunc_currency_code
1103 , P_Projfunc_cost_rate_date => P_Projfunc_cost_rate_date
1104 , P_Projfunc_cost_rate_type => P_Projfunc_cost_rate_type
1105 , P_Projfunc_cost_exchange_rate => P_Projfunc_cost_exchange_rate
1106 , P_Project_Raw_Cost => P_Project_Raw_Cost
1107 , P_Project_Burdened_Cost => P_Project_Burdened_Cost
1108 , P_Work_Type_Id => P_Work_Type_Id
1109 , p_cdlsr4 => p_cdlsr4
1110 , p_si_assets_addition_flag => p_si_assets_addition_flag
1111 , p_cdlsr5 => p_cdlsr5
1112 , p_cbs_element_id => p_cbs_element_id -- Added for CBS Enhancement Bug 16220146
1113 );
1114 --, p_agreement_id => p_agreement_id) ; --FSIO Changes
1115
1116 if (x_err_code <> 0) then
1117 return;
1118 end if;
1119
1120 EXCEPTION
1121 When OTHERS then
1122 RAISE ;
1123 END CreateExternalCdl ;
1124
1125 FUNCTION Is_Accounted(X_Transaction_Source IN VARCHAR2)
1126 RETURN VARCHAR2
1127 IS
1128 accounted_flag PA_TRANSACTION_SOURCES.Gl_Accounted_Flag%TYPE;
1129 BEGIN
1130 IF X_Transaction_Source IS NOT NULL THEN
1131 SELECT TS.Gl_Accounted_Flag
1132 INTO accounted_flag
1133 FROM PA_TRANSACTION_SOURCES TS
1134 WHERE TS.Transaction_Source = X_Transaction_source;
1135 ELSE
1136 accounted_flag := 'N';
1137 END IF;
1138 RETURN(accounted_flag);
1139 END Is_Accounted;
1140
1141 /*
1142 New Procedure added under Project Summarization changes.
1146 x_backout_id : id of the reverse transaction generated
1143 This procedure is used to create a reverse cdl for a reverse ei generated during the
1144 adjustment of an accounted and imported transaction.
1145 x_exp_item_id : id of the original transaction
1147 */
1148
1149 PROCEDURE CreateReverseCdl ( X_exp_item_id IN NUMBER,
1150 X_backout_id IN NUMBER,
1151 X_user IN NUMBER,
1152 X_status OUT NOCOPY NUMBER)
1153 IS
1154 p_amount pa_cost_distribution_lines.amount%TYPE;
1155 p_dr_ccid pa_cost_distribution_lines.dr_code_combination_id%TYPE;
1156 p_cr_ccid pa_cost_distribution_lines.cr_code_combination_id%TYPE;
1157 p_transfer_status_code pa_cost_distribution_lines.transfer_status_code%TYPE;
1158 p_quantity pa_cost_distribution_lines.quantity%TYPE;
1159 p_billable_flag pa_cost_distribution_lines.billable_flag%TYPE;
1160 p_request_id pa_cost_distribution_lines.request_id%TYPE;
1161 p_program_application_id pa_cost_distribution_lines.program_application_id%TYPE;
1162 p_program_id pa_cost_distribution_lines.program_id%TYPE;
1163 p_program_update_date pa_cost_distribution_lines.program_update_date%TYPE;
1164 p_pa_date pa_cost_distribution_lines.pa_date%TYPE;
1165 p_recvr_pa_date pa_cost_distribution_lines.pa_date%TYPE; /**CBGA**/
1166 p_gl_date pa_cost_distribution_lines.gl_date%TYPE;
1167 p_transferred_date pa_cost_distribution_lines.transferred_date%TYPE;
1168 p_transfer_rejection_reason pa_cost_distribution_lines.transfer_rejection_reason%TYPE;
1169 p_line_type pa_cost_distribution_lines.line_type%TYPE;
1170 p_ind_complied_set_id pa_cost_distribution_lines.ind_compiled_set_id%TYPE;
1171 p_burdened_cost pa_cost_distribution_lines.burdened_cost%TYPE;
1172 p_line_num_reversed pa_cost_distribution_lines.line_num_reversed%TYPE;
1173 p_reversed_flag pa_cost_distribution_lines.reversed_flag%TYPE;
1174 p_cdlsr1 pa_cost_distribution_lines.system_reference1%TYPE;
1175 p_cdlsr2 pa_cost_distribution_lines.system_reference2%TYPE;
1176 p_cdlsr3 pa_cost_distribution_lines.system_reference3%TYPE;
1177 p_denom_currency_code pa_cost_distribution_lines.denom_currency_code%TYPE;
1181 p_acct_rate_date pa_cost_distribution_lines.acct_rate_date%TYPE;
1178 p_denom_raw_cost pa_cost_distribution_lines.denom_raw_cost%TYPE;
1179 p_denom_burdened_cost pa_cost_distribution_lines.denom_burdened_cost%TYPE;
1180 p_acct_currency_code pa_cost_distribution_lines.acct_currency_code%TYPE;
1182 p_acct_rate_type pa_cost_distribution_lines.acct_rate_type%TYPE;
1183 p_acct_exchange_rate pa_cost_distribution_lines.acct_exchange_rate%TYPE;
1184 p_acct_raw_cost pa_cost_distribution_lines.acct_raw_cost%TYPE;
1185 p_acct_burdened_cost pa_cost_distribution_lines.acct_burdened_cost%TYPE;
1186 p_project_currency_code pa_cost_distribution_lines.project_currency_code%TYPE;
1187 p_project_rate_date pa_cost_distribution_lines.project_rate_date%TYPE;
1188 p_project_rate_type pa_cost_distribution_lines.project_rate_type%TYPE;
1189 p_project_exchange_rate pa_cost_distribution_lines.project_exchange_rate%TYPE;
1190 p_project_id pa_cost_distribution_lines.project_id%TYPE;
1191 p_task_id pa_cost_distribution_lines.task_id%TYPE;
1192 p_parent_adjusted_id pa_expenditure_items.adjusted_expenditure_item_id%TYPE;
1193 p_parent_transferred_id pa_expenditure_items.transferred_from_exp_item_id%TYPE;
1194 p_gl_accounted_flag pa_transaction_sources.gl_accounted_flag%TYPE;
1195 p_transaction_source pa_transaction_sources.transaction_source%TYPE;
1196
1197 l_si_assets_addition_flag pa_cost_distribution_lines.si_assets_addition_flag%TYPE ;
1198 p_err_code NUMBER;
1199 p_err_stage VARCHAR2(1000);
1200 p_err_stack VARCHAR2(1000);
1201 e_cdl_error EXCEPTION;
1202
1203 -- Start EPP Changes
1204 p_pa_period_name VARCHAR2(15);
1205 p_gl_period_name VARCHAR2(15);
1206 p_recvr_gl_date DATE;
1207 p_recvr_gl_period_name VARCHAR2(15);
1208 p_recvr_pa_period_name VARCHAR2(15);
1209 -- End EPP Changes
1210
1211 -- Start Project Currency/ EI Attribute Changes
1212 p_projfunc_currency_code VARCHAR2(15);
1213 p_projfunc_cost_rate_type VARCHAR2(30);
1214 p_projfunc_cost_rate_date date;
1215 p_projfunc_cost_exchange_rate NUMBER;
1216 p_work_type_id NUMBER;
1217 p_project_raw_cost NUMBER;
1218 p_project_burdened_cost NUMBER;
1219 -- End Project Currency/ EI Attribute Changes
1220
1221 -- AP Discounts
1222 p_cdlsr4 pa_cost_distribution_lines.system_reference4%TYPE;
1223 p_cdlsr5 pa_cost_distribution_lines.system_reference5%TYPE;
1224 /* bug#2361495 */
1225 l_pa_date DATE ;
1226 l_recvr_pa_date DATE ;
1227 l_ei_date DATE ;
1228 l_org_id pa_expenditure_items.org_id%type;
1229 /* bug#2361495 */
1230 /* bug2378505 */
1231 actual_cdl_line_num pa_cost_distribution_lines.line_num%TYPE;
1232 /* bug2378505 */
1233 /* bug 2661921*/
1234 l_recvr_org_id pa_expenditure_items.org_id%type;
1235 l_gl_date DATE;
1236 l_recvr_gl_date DATE;
1237 l_exp_id NUMBER;
1238 l_sob_id NUMBER;
1239 l_recvr_sob_id NUMBER;
1240 l_sys_link_function VARCHAR2(3);
1241 l_err_stage NUMBER;
1242 l_status NUMBER;
1243 l_err_code VARCHAR2(100);
1244 /* bug 2661921*/
1245 /* 12.2 payroll intg .. start */
1246 l_rate_source_code varchar2(30);
1247 l_costing_method varchar2(150);
1248 /* 12.2 payroll intg .. end */
1249 l_cbs_element_id NUMBER; -- Added for CBS Enhancement Bug 16220146
1250
1251 BEGIN
1252
1253 SELECT ITEMS.adjusted_expenditure_item_id,
1254 ITEMS.transferred_from_exp_item_id,
1255 TRN.gl_accounted_flag,
1256 TRN.transaction_source
1257 ,ITEMS.expenditure_item_date
1258 ,ITEMS.org_id
1259 /* bug 2661921*/
1260 ,NVL(ITEMS.recvr_org_id,ITEMS.ORG_ID)
1261 ,ITEMS.system_linkage_function
1262 ,ITEMS.expenditure_id
1263 /* bug 2661921*/
1264
1265 INTO p_parent_adjusted_id,
1266 p_parent_transferred_id,
1267 p_gl_accounted_flag,
1268 p_transaction_source
1269 ,l_ei_date
1270 ,l_org_id
1271 /* bug 2661921*/
1272 ,l_recvr_org_id
1273 ,l_sys_link_function
1274 ,l_exp_id
1275 /* bug 2661921*/
1276 -- FROM pa_expenditure_items ITEMS, -- 12i MOAC changes
1277 FROM pa_expenditure_items_All ITEMS,
1278 pa_transaction_sources TRN
1279 WHERE ITEMS.transaction_source = TRN.transaction_source
1280 AND ITEMS.expenditure_item_id = X_exp_item_id;
1281
1282 /* selecting set of books id for bug 2661921*/
1283 SELECT imp1.set_of_books_id, imp2.set_of_books_id
1284 INTO l_sob_id, l_recvr_sob_id
1285 FROM pa_implementations_all imp1, pa_implementations_all imp2
1286 -- start 12i MOAC changes
1287 -- WHERE nvl(imp1.org_id,-99) = nvl(l_org_id,-99)
1288 -- AND nvl(imp2.org_id,-99) = nvl(l_recvr_org_id,-99);
1289 WHERE imp1.org_id = l_org_id
1290 AND imp2.org_id = l_recvr_org_id;
1291 -- end 12i MOAC changes
1292 /* selected set of books id bug 2661921*/
1293
1294
1295 IF p_parent_adjusted_id IS NULL AND
1296 p_parent_transferred_id IS NULL AND
1297 p_gl_accounted_flag = 'Y' AND
1298 /* Bug 4610677 - reversing line should not be created for all gl accounted VI and ER sources */
1299 l_sys_link_function not in ('VI','ER')
1300 /* Commenting the following for Bug 4610677
1301 p_transaction_source NOT IN ( 'AP EXPENSE','AP INVOICE',
1302 'INTERCOMPANY_AP_INVOICES',
1303 'INTERPROJECT_AP_INVOICES',
1304 /* Bug 4684328 - Added rest of the Purchasing and Payables transaction sources */
1305 /* Commenting the following for Bug 4610677
1306 'AP VARIANCE', 'AP NRTAX', 'AP DISCOUNTS',
1307 'PO RECEIPT', 'PO RECEIPT NRTAX',
1308 'PO RECEIPT NRTAX PRICE ADJ', 'PO RECEIPT PRICE ADJ')*/
1309 THEN
1310 /* Added for Bug 2378505 The reversing line should take the details from the latest CDL
1311 and not from line_num = 1 as there may be some attributes which could differ which in
1312 this case is the billable_flag */
1313
1314 SELECT max(cdl.line_num)
1318
1315 INTO actual_cdl_line_num
1316 FROM pa_cost_distribution_lines cdl
1317 WHERE cdl.expenditure_item_id = X_exp_item_id and cdl.line_type = 'R';
1319 /* Addition for bug 2378505 ends */
1320
1321 SELECT amount
1322 , dr_code_combination_id
1323 , cr_code_combination_id
1324 , transfer_status_code
1325 , quantity
1326 , billable_flag
1327 , request_id
1328 , program_application_id
1329 , program_id
1330 , program_update_date
1331 , pa_date
1332 , gl_date
1333 , transferred_date
1334 , transfer_rejection_reason
1335 , line_type
1336 , ind_compiled_set_id
1337 , nvl(burdened_cost,0) + nvl(projfunc_burdened_change,0)
1338 , line_num_reversed
1339 , reversed_flag
1340 , system_reference1
1341 , system_reference2
1342 , system_reference3
1343 , denom_currency_code
1344 , denom_raw_cost
1345 , NVL(denom_burdened_cost,0) + nvl(denom_burdened_change,0)
1346 , acct_currency_code
1347 , acct_rate_date
1348 , acct_rate_type
1349 , acct_exchange_rate
1350 , acct_raw_cost
1351 , NVL(acct_burdened_cost,0) + nvl(acct_burdened_change,0)
1352 , project_currency_code
1353 , project_rate_date
1354 , project_rate_type
1355 , project_exchange_rate
1356 , project_id
1357 , task_id,
1358 /* commenting out these columns as this information is obtained
1359 from pa_utils2.get_period_information for fix 2661921
1360 pa_period_name,
1361 gl_period_name,
1362 recvr_pa_period_name,
1363 recvr_gl_period_name, */
1364 recvr_gl_date
1365 , Projfunc_currency_code
1366 , Projfunc_cost_rate_date
1367 , Projfunc_cost_rate_type
1368 , Projfunc_cost_exchange_rate
1369 , Project_raw_cost
1370 , NVL(Project_burdened_cost,0) + nvl(project_burdened_change,0)
1371 , Work_type_id
1372 , system_reference4
1373 , system_reference5
1374 , decode(si_assets_addition_flag, 'R','T', 'O', 'T', 'Y', 'T', 'N', 'T',si_assets_addition_flag )
1375 /* 12.2 payroll intg .. start */
1376 , rate_source_code
1377 , costing_method
1378 /* 12.2 payroll intg .. end */
1379 , cbs_element_id -- Added for CBS Enhancement Bug 16220146
1380 INTO p_amount,
1381 p_dr_ccid,
1382 p_cr_ccid,
1383 p_transfer_status_code,
1384 p_quantity,
1385 p_billable_flag,
1386 p_request_id,
1387 p_program_application_id,
1388 p_program_id,
1389 p_program_update_date,
1390 p_pa_date,
1391 p_gl_date,
1392 p_transferred_date,
1393 p_transfer_rejection_reason,
1394 p_line_type,
1395 p_ind_complied_set_id,
1396 p_burdened_cost,
1397 p_line_num_reversed,
1398 p_reversed_flag,
1399 p_cdlsr1,
1400 p_cdlsr2,
1401 p_cdlsr3,
1402 p_denom_currency_code,
1403 p_denom_raw_cost,
1404 p_denom_burdened_cost,
1405 p_acct_currency_code,
1406 p_acct_rate_date,
1407 p_acct_rate_type,
1408 p_acct_exchange_rate,
1409 p_acct_raw_cost,
1410 p_acct_burdened_cost,
1411 p_project_currency_code,
1412 p_project_rate_date,
1413 p_project_rate_type,
1414 p_project_exchange_rate,
1415 p_project_id,
1416 p_task_id
1417 /* Commenting out the folliwng columns for 2661921
1418 , p_pa_period_name
1419 , p_gl_period_name
1420 , p_recvr_pa_period_name
1421 , p_recvr_gl_period_name */
1422 , p_recvr_gl_date
1423 , p_Projfunc_currency_code
1424 , p_Projfunc_cost_rate_date
1425 , p_Projfunc_cost_rate_type
1426 , p_Projfunc_cost_exchange_rate
1427 , p_Project_raw_cost
1428 , p_Project_burdened_cost
1429 , p_Work_type_id
1430 , p_cdlsr4
1431 , p_cdlsr5
1432 , l_si_assets_addition_flag
1433 /* 12.2 payroll intg .. start */
1434 , l_rate_source_code
1435 , l_costing_method
1436 /* 12.2 payroll intg .. end */
1437 , l_cbs_element_id -- Added for CBS Enhancement Bug 16220146
1438 -- FROM pa_cost_distribution_lines -- 12i MOAC changes
1439 FROM pa_cost_distribution_lines_All -- 12i MOAC changes
1440 WHERE expenditure_item_id = X_exp_item_id
1441 -- AND line_num = 1; -- commented for bug2378505
1442 AND line_num = actual_cdl_line_num; -- bug2378505
1443
1444 /* bug#2361495 */
1445 /* Commenting out the call to get_pa_date and get_recvr_pa_date
1446 for 2661921 as pa_date and recvr_pa_date will be obtained
1447 from PA_UTILS2.get_period_information
1451 ,p_org_id => l_org_id );
1448
1449 l_pa_date := PA_UTILS2.get_pa_date(p_ei_date => l_ei_date
1450 ,p_gl_date => NULL
1452
1453 l_recvr_pa_date := PA_UTILS2.get_recvr_pa_date(p_ei_date => l_ei_date
1454 ,p_gl_date => NULL
1455 ,p_org_id => l_org_id ); */
1456 /* bug#2361495 */
1457
1458 /* Getting pa and gl period information for 2661921 */
1459 PA_UTILS2.get_period_information(
1460 p_expenditure_item_date => l_ei_date
1461 ,p_expenditure_id => l_exp_id
1462 ,p_system_linkage_function => l_sys_link_function
1463 ,p_line_type => p_line_type
1464 ,p_prvdr_raw_pa_date => p_pa_date
1465 ,p_recvr_raw_pa_date => p_recvr_pa_date
1466 ,p_prvdr_raw_gl_date => p_gl_date
1467 ,p_recvr_raw_gl_date => p_recvr_gl_date
1468 ,p_prvdr_org_id => l_org_id
1469 ,p_recvr_org_id => l_recvr_org_id
1470 ,p_prvdr_sob_id => l_sob_id
1471 ,p_recvr_sob_id => l_recvr_sob_id
1472 ,p_calling_module => 'CDL'
1473 ,x_prvdr_pa_date => l_pa_date
1474 ,x_prvdr_pa_period_name => p_pa_period_name
1475 ,x_prvdr_gl_date => l_gl_date
1476 ,x_prvdr_gl_period_name => p_gl_period_name
1477 ,x_recvr_pa_date => l_recvr_pa_date
1478 ,x_recvr_pa_period_name => p_recvr_pa_period_name
1479 ,x_recvr_gl_date => l_recvr_gl_date
1480 ,x_recvr_gl_period_name => p_recvr_gl_period_name
1481 ,x_error_code => l_err_code
1482 ,x_return_status => l_status
1483 ,x_error_stage => l_err_stage );
1484 /* pa and gl period information fetched for 2661921*/
1485
1486 /* 2661921 */
1487 IF p_err_code IS NOT NULL THEN
1488 raise e_cdl_error;
1489 END IF;
1490 /* 2661921 */
1491
1492 PA_COSTING.CREATENEWCDL(
1493 X_expenditure_item_id => X_backout_id
1494 , X_amount => -p_amount
1495 , X_dr_ccid => p_dr_ccid
1496 , X_cr_ccid => p_cr_ccid
1497 , X_transfer_status_code => 'P' /* bug 2361495 p_transfer_status_code */
1498 , X_quantity => -p_quantity
1499 , X_billable_flag => p_billable_flag
1500 , X_request_id => p_request_id
1501 , X_program_application_id => p_program_application_id
1502 , x_program_id => p_program_id
1503 , x_program_update_date => p_program_update_date
1504 , X_pa_date => l_pa_date /* bug 2361495 p_pa_date */
1505 , X_recvr_pa_date => l_recvr_pa_date /** bug 2361495 p_recvr_pa_date CBGA **/
1506 , X_gl_date => l_gl_date /* bug 2661921 p_gl_date */
1507 , X_transferred_date => NULL /* bug 2361495 p_transferred_date */
1508 , X_transfer_rejection_reason => NULL /* bug 2361495 p_transfer_rejection_reason */
1509 , X_line_type => p_line_type
1510 , X_ind_compiled_set_id => p_ind_complied_set_id
1511 , X_burdened_cost => -p_burdened_cost
1512 , X_line_num_reversed => p_line_num_reversed
1513 , X_reverse_flag => p_reversed_flag
1514 , X_user => X_user
1515 , X_err_code => p_err_code
1516 , X_err_stage => p_err_stage
1517 , X_err_stack => p_err_stack
1518 , X_project_id => p_project_id
1519 , X_task_id => p_task_id
1520 , X_cdlsr1 => p_cdlsr1
1521 , X_cdlsr2 => p_cdlsr2
1522 , X_cdlsr3 => p_cdlsr3
1523 , X_denom_currency_code => p_denom_currency_code
1524 , X_denom_raw_cost => -p_denom_raw_cost
1525 , X_denom_burden_cost => -p_denom_burdened_cost
1526 , X_acct_currency_code => p_acct_currency_code
1527 , X_acct_rate_date => p_acct_rate_date
1528 , X_acct_rate_type => p_acct_rate_type
1529 , X_acct_exchange_rate => p_acct_exchange_rate
1530 , X_acct_raw_cost => -p_acct_raw_cost
1531 , X_acct_burdened_cost => -p_acct_burdened_cost
1532 , X_project_currency_code => p_project_currency_code
1533 , X_project_rate_date => p_project_rate_date
1534 , X_project_rate_type => p_project_rate_type
1535 , X_project_exchange_rate => p_project_exchange_rate
1536 , P_PaPeriodName => P_Pa_Period_Name
1537 , P_RecvrPaPeriodName => P_Recvr_Pa_Period_Name
1538 , P_GlPeriodName => P_Gl_Period_Name
1539 , P_RecvrGlDate => l_recvr_gl_date /* bug 2661921 P_Recvr_Gl_Date */
1540 , P_RecvrGlPeriodName => P_Recvr_Gl_Period_Name
1541 , P_Projfunc_currency_code => P_Projfunc_currency_code
1542 , P_Projfunc_cost_rate_date => P_Projfunc_cost_rate_date
1543 , P_Projfunc_cost_rate_type => P_Projfunc_cost_rate_type
1544 , P_Projfunc_cost_exchange_rate => P_Projfunc_cost_exchange_rate
1545 , P_Project_Raw_Cost => -P_Project_Raw_Cost --Bug 3315099
1546 , P_Project_Burdened_Cost => -P_Project_Burdened_Cost --Bug 3315099
1547 , P_Work_Type_Id => P_Work_Type_Id
1548 , p_cdlsr4 => p_cdlsr4
1549 , p_si_assets_addition_flag => l_si_assets_addition_flag
1550 , p_cdlsr5 => p_cdlsr5
1551 , P_Parent_Line_Num => actual_cdl_line_num
1552 /* 12.2 payroll intg .. start */
1553 , p_rate_source_code => l_rate_source_code
1554 , p_costing_method => l_costing_method
1555 /* 12.2 payroll intg .. end */
1556 , p_cbs_element_id => l_cbs_element_id -- Added for CBS Enhancement Bug 16220146
1557 );
1558
1559 IF p_err_code IS NOT NULL THEN
1560 raise e_cdl_error;
1561 END IF;
1562
1563 UPDATE pa_expenditure_items
1564 SET cost_distributed_flag = 'Y'
1565 WHERE expenditure_item_id = X_backout_id;
1566
1567 END IF;
1568
1569 X_status := 0;
1570
1571 EXCEPTION
1572 WHEN NO_DATA_FOUND THEN
1573 NULL;
1574 WHEN e_cdl_error THEN
1575 X_status := p_err_code;
1576 WHEN OTHERS THEN
1577 X_status := SQLCODE;
1578 RAISE;
1579 END CreateReverseCdl;
1580
1581 END PA_COSTING ;