1 PACKAGE CST_eamCost_PUB AUTHID CURRENT_USER AS
2 /* $Header: CSTPEACS.pls 120.9.12020000.1 2012/06/26 07:07:44 appldev ship $ */
3
4 /*=========================================================================== */
5 -- PROCEDURE
6 -- Process_MatCost
7 --
8 -- DESCRIPTION
9 -- This API retrieves the charges of the costed MTL_MATERIAL_TRANSACTIONS
10 -- row, then called Update_eamCost to populate the eAM tables.
11 -- This API should be called for a specific MMT transaction which has been
12 -- costed successfully.
13 --
14 -- PURPOSE
15 -- To support eAM job costing for Rel 11i.6
16 --
17 -------------------------------------------------------------------------------
18
19 PROCEDURE Process_MatCost(
20 p_api_version IN NUMBER,
21 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
22 p_commit IN VARCHAR2 := FND_API.G_FALSE,
23 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
24 x_return_status OUT NOCOPY VARCHAR2,
25 x_msg_count OUT NOCOPY NUMBER,
26 x_msg_data OUT NOCOPY VARCHAR2,
27 p_txn_id IN NUMBER,
28 p_user_id IN NUMBER,
29 p_request_id IN NUMBER,
30 p_prog_id IN NUMBER,
31 p_prog_app_id IN NUMBER,
32 p_login_id IN NUMBER
33 );
34
35 /*=========================================================================== */
36 -- PROCEDURE
37 -- Process_ResCost
38 --
39 -- DESCRIPTION
40 -- This API processes all resources transactions in WIP_TRANSACTIONS for a
41 -- specified group id. For each transaction, it identifies the correct
42 -- eAM cost element, department type, then populate eAM tables accordingly.
43 -- The calling program should ensure that all transactions for a
44 -- specific group id are costed successfully before calling this API.
45 --
46 -- PURPOSE
47 -- To support eAM job costing for Rel 11i.6
48 --
49 -------------------------------------------------------------------------------
50
51 PROCEDURE Process_ResCost(
52 p_api_version IN NUMBER,
53 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
54 p_commit IN VARCHAR2 := FND_API.G_FALSE,
55 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
56 x_return_status OUT NOCOPY VARCHAR2,
57 x_msg_count OUT NOCOPY NUMBER,
58 x_msg_data OUT NOCOPY VARCHAR2,
59 p_group_id IN NUMBER,
60 p_user_id IN NUMBER,
61 p_request_id IN NUMBER,
62 p_prog_id IN NUMBER,
63 p_prog_app_id IN NUMBER,
64 p_login_id IN NUMBER
65 );
66
67 /* ========================================================================== */
68 -- PROCEDURE
69 -- Update_eamCost
70 --
71 -- DESCRIPTION
72 -- This API insert or updates WIP_EAM_PERIOD_BALANCES and CST_EAM_ASSET_PER_BALANCES
73 -- with the amount passed by the calling program.
74 --
75 -- PURPOSE:
76 -- Support eAM job costing in Oracle Applications Rel 11i.6
77 --
78 -- PARAMETERS:
79 -- p_txn_mode: indicates if it is a material cost (inventory items or direct
80 -- item) or resource cost. Values:
81 -- 1 = material transaction
82 -- 2 = resource transaction
83 -- p_wip_entity_id: current job for which the charge is incurred
84 -- p_resource_id: if it is a resource transaction (p_txn_mode = 2), a resource id
85 -- must be passed by the calling program.
86 -- Do not pass param for material or dept-based overhead.
87 -- p_res_seq_num: if it is a resource transaction (p_txn_mode = 2),
88 -- the operation resource seq num must be passed.
89 -- Do not pass param for material or dept-based overhead.
90 -- p_value_type: 1 = actual cost
91 -- 2 = estimated cost
92 ---------------------------------------------------------------------------------------
93
94 PROCEDURE Update_eamCost (
95 p_api_version IN NUMBER,
96 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
97 p_commit IN VARCHAR2 := FND_API.G_FALSE,
98 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
99 x_return_status OUT NOCOPY VARCHAR2,
100 x_msg_count OUT NOCOPY NUMBER,
101 x_msg_data OUT NOCOPY VARCHAR2,
102 p_txn_mode IN NUMBER, -- 1=material 2=resource
103 p_period_id IN NUMBER := null, -- period where cost s/b charged
104 p_period_set_name IN VARCHAR2 := null,
105 p_period_name IN VARCHAR2 := null,
106 p_org_id IN NUMBER,
107 p_wip_entity_id IN NUMBER,
108 p_opseq_num IN NUMBER, -- routing operation sequence
109 p_resource_id IN NUMBER := null,
110 p_res_seq_num IN NUMBER := null,
111 p_value_type IN NUMBER, -- 1=actual, 2=estimated
112 p_value IN NUMBER,
113 p_user_id IN NUMBER,
114 p_request_id IN NUMBER,
115 p_prog_id IN NUMBER,
116 p_prog_app_id IN NUMBER,
117 p_login_id IN NUMBER,
118 p_txn_date IN VARCHAR2 DEFAULT to_char(sysdate,'YYYY/MM/DD HH24:MI:SS'),
119 p_txn_id IN NUMBER DEFAULT -1
120 );
121
122 /* ======================================================================== */
123 -- PROCEDURE
124 -- InsertUpdate_eamPerBal
125 --
126 -- DESCRIPTION
127 -- This procedure inserts or updates a row in wip_eam_period_balances table,
128 -- according to the parameters passed by the calling program.
129 -- Subsequently, it also inserts or update the related row in
130 -- cst_eam_asset_per_balances.
131 --
132 -- PURPOSE
133 -- Oracle Application Rel 11i.6
134 -- eAM Job Costing support
135 --
136 -- PARAMETERS
137 -- p_period_id
138 -- p_period_set_name : for an open period, passing period id,
139 -- instead of set name and period name,
140 -- would be sufficient
141 -- p_period_name
142 -- p_org_id
143 -- p_wip_entity_id
144 -- p_dept_id : department assigned to operation
145 -- p_owning_id : department owning resource
146 -- p_dept_type_id : department tyoe of cost incurred
147 -- p_opseq_num : routing op seq
148 -- p_eam_cost_element : eam cost element id
149 -- p_asset_group_id : inventory item id
150 -- p_asset_number : serial number of asset item
151 -- p_value_type : 1= actual cost, 2=system estimated cost
152 -- p_value : cost amount
153 --
154 ------------------------------------------------------------------------------
155
156 PROCEDURE InsertUpdate_eamPerBal (
157 p_api_version IN NUMBER,
158 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
159 p_commit IN VARCHAR2 := FND_API.G_FALSE,
160 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
161 x_return_status OUT NOCOPY VARCHAR2,
162 x_msg_count OUT NOCOPY NUMBER,
163 x_msg_data OUT NOCOPY VARCHAR2,
164 p_period_id IN NUMBER := null,
165 p_period_set_name IN VARCHAR2 := null,
166 p_period_name IN VARCHAR2 := null,
167 p_org_id IN NUMBER,
168 p_wip_entity_id IN NUMBER,
169 p_owning_dept_id IN NUMBER,
170 p_dept_id IN NUMBER,
171 p_maint_cost_cat IN NUMBER,
172 p_opseq_num IN NUMBER,
173 p_eam_cost_element IN NUMBER,
174 p_asset_group_id IN NUMBER,
175 p_asset_number IN VARCHAR2,
176 p_value_type IN NUMBER,
177 p_value IN NUMBER,
178 p_user_id IN NUMBER,
179 p_request_id IN NUMBER,
180 p_prog_id IN NUMBER,
181 p_prog_app_id IN NUMBER,
182 p_login_id IN NUMBER,
183 p_txn_date IN VARCHAR2 DEFAULT to_char(sysdate,'YYYY/MM/DD HH24:MI:SS')
184 ) ;
185
186 /* ========================================================================= */
187 -- PROCEDURE
188 -- InsertUpdate_assetPerBal
189 --
190 -- DESCRIPTION
191 --
192 -- PURPOSE
193 -- Oracle Application Rel 11i.5
194 -- eAM Job Costing support
195 --
196 -- PARAMETERS
197 -- p_period_id
198 -- p_period_set_name : for an open period, passing period id,
199 -- instead of set name and period name,
200 -- would be sufficient
201 -- p_period_name
202 -- p_org_id
203 -- p_maint_cost_dat : department tyoe of cost incurred
204 -- p_eam_cost_element : eam cost element id
205 -- p_asset_group_id : inventory item id
206 -- p_asset_number : serial number of asset item
207 -- p_value_type : 1= actual cost, 2=system estimated cost
208 -- p_value : cost amount
209 -- p_maint_obj_id : CII.instance_id if serialized asset or
210 -- serialized rebuildable item, MSI.inventory_item_id
211 -- if non-serialized rebuildable item.
212 -- p_maint_obj_type : 3 if serialized asset or serialized rebuildable
213 -- item, 2 if non-serialized rebuildable item
214 --
215 -- HISTORY
216 -- 09/18/02 Anitha Initial creation
217 --
218 ------------------------------------------------------------------------------
219
220 PROCEDURE InsertUpdate_assetPerBal (
221 p_api_version IN NUMBER,
222 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
223 p_commit IN VARCHAR2 := FND_API.G_FALSE,
224 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
225 x_return_status OUT NOCOPY VARCHAR2,
226 x_msg_count OUT NOCOPY NUMBER,
227 x_msg_data OUT NOCOPY VARCHAR2,
228 p_period_id IN NUMBER := null,
229 p_period_set_name IN VARCHAR2 := null,
230 p_period_name IN VARCHAR2 := null,
231 p_org_id IN NUMBER,
232 p_maint_cost_cat IN NUMBER,
233 p_asset_group_id IN NUMBER,
234 p_asset_number IN VARCHAR2,
235 p_value IN NUMBER,
236 p_column IN VARCHAR2,
237 p_col_type IN NUMBER,
238 p_period_start_date IN DATE,
239 p_maint_obj_id IN NUMBER,
240 p_maint_obj_type IN NUMBER,
241 p_user_id IN NUMBER,
242 p_request_id IN NUMBER,
243 p_prog_id IN NUMBER,
244 p_prog_app_id IN NUMBER,
245 p_login_id IN NUMBER
246 );
247
248
249 /* ============================================================== */
250 -- FUNCTION
251 -- Get_eamCostElement()
252 --
253 -- DESCRIPTION
254 -- Function to return the correct eAM cost element, based on
255 -- the transaction mode and the resource id of a transaction.
256 --
257 -- PARAMETERS
258 -- p_txn_mode (1=material, 2=resource)
259 -- p_org_id
260 -- p_resource_id (optional; to be passed only for a resource tranx)
261 --
262 /* ================================================================= */
263
264 FUNCTION Get_eamCostElement(
265 p_txn_mode IN NUMBER,
266 p_org_id IN NUMBER,
267 p_resource_id IN NUMBER := null)
268 RETURN number;
269
270 /* ==================================================================== */
271 -- PROCEDURE
272 -- Get_MaintCostCat
273 --
274 -- DESCRIPTION
275 --
276 -- This procedure identifies the using, owning departments and the
277 -- related maint. cost cat for a resource or overhead charge based
278 -- on the transaction mode, wip entity id, routing operation, and
279 -- resource id.
280 /* ==================================================================== */
281
282 PROCEDURE Get_MaintCostCat(
283 p_txn_mode IN NUMBER,
284 p_wip_entity_id IN NUMBER,
285 p_opseq_num IN NUMBER,
286 p_resource_id IN NUMBER := null,
287 p_res_seq_num IN NUMBER := null,
288 x_return_status OUT NOCOPY VARCHAR2,
289 x_operation_dept OUT NOCOPY NUMBER,
290 x_owning_dept OUT NOCOPY NUMBER,
291 x_maint_cost_cat OUT NOCOPY NUMBER
292 );
293
294 /* ===================================================================== */
295 -- PROCEDURE --
296 -- Delete_eamPerBal --
297 -- DESCRIPTION --
298 -- This API removes the cost of a specific type, such as system --
299 -- or manual estimates from wip_eam_per_balances and delete the rows --
300 -- if all the costs are zeros. It also update the corresponding amount --
301 -- It also update the corresponding amount in --
302 -- cst_eam_asset_per_balances. --
303 -- NOTE: This process is at the wip entity level. --
304 -- --
305 -- p_type = 1 (system estimates) --
306 -- 2 (manual estimates) --
307 -- PURPOSE: --
308 -- Oracle Applications Rel 11i.6 --
309 -- HISTORY: --
310 -- 05/02/01 Dieu-thuong Le Initial creation --
311 /* ======================================================================= */
312
313 PROCEDURE Delete_eamPerBal (
314 p_api_version IN NUMBER,
315 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
316 p_commit IN VARCHAR2 := FND_API.G_FALSE,
317 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
318 x_return_status OUT NOCOPY VARCHAR2,
319 x_msg_count OUT NOCOPY NUMBER,
320 x_msg_data OUT NOCOPY VARCHAR2,
321 p_entity_id_tab IN CSTPECEP.wip_entity_id_type,
322 p_org_id IN NUMBER,
323 p_type IN NUMBER :=1
324 );
325
326
327 ----------------------------------------------------------------------------
328 -- PROCEDURE --
329 -- Compute_Job_Estimate --
330 -- --
331 -- --
332 -- DESCRIPTION --
333 -- This API Computes the estimate for a Job --
334 -- --
335 -- PURPOSE: --
336 -- Oracle Applications Rel 11i.6 --
337 -- --
338 -- --
339 -- HISTORY: --
340 -- 04/17/01 Hemant G Created --
341 ----------------------------------------------------------------------------
342
343 PROCEDURE Compute_Job_Estimate (
344 p_api_version IN NUMBER,
345 p_init_msg_list IN VARCHAR2
346 := FND_API.G_FALSE,
347 p_commit IN VARCHAR2
348 := FND_API.G_FALSE,
349 p_validation_level IN NUMBER
350 := FND_API.G_VALID_LEVEL_FULL,
351 p_debug IN VARCHAR2 := 'N',
352 p_wip_entity_id IN NUMBER,
353
354 p_user_id IN NUMBER,
355 p_request_id IN NUMBER,
356 p_prog_id IN NUMBER,
357 p_prog_app_id IN NUMBER,
358 p_login_id IN NUMBER,
359
360 x_return_status OUT NOCOPY VARCHAR2,
361 x_msg_count OUT NOCOPY NUMBER,
362 x_msg_data OUT NOCOPY VARCHAR2 );
363 ----------------------------------------------------------------------------
364 -- PROCEDURE --
365 -- Rollup_Cost --
366 -- --
367 -- --
368 -- DESCRIPTION --
369 -- This API Computes RollUp Cost for an asset Item --
370 -- --
371 -- PURPOSE: --
372 -- Oracle Applications Rel 11i.6 --
373 -- --
374 -- --
375 -- HISTORY: --
376 -- 04/17/01 Terence Chan Genesis --
377 ----------------------------------------------------------------------------
378 PROCEDURE Rollup_Cost (
379 p_api_version IN NUMBER,
380 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
381 p_commit IN VARCHAR2 := FND_API.G_FALSE ,
382 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL ,
383 x_return_status OUT NOCOPY VARCHAR2 ,
384 x_msg_count OUT NOCOPY NUMBER ,
385 x_msg_data OUT NOCOPY VARCHAR2 ,
386
387 p_inventory_item_id IN NUMBER ,
388 p_serial_number IN VARCHAR2 ,
389 P_period_set_name IN VARCHAR2 ,
390 p_beginning_period_name IN VARCHAR2 ,
391 p_ending_period_name IN VARCHAR2 ,
392
393 x_group_id OUT NOCOPY NUMBER );
394
395
396 ----------------------------------------------------------------------------
397 -- PROCEDURE --
398 -- Purge_Rollup_Cost --
399 -- --
400 -- --
401 -- DESCRIPTION --
402 -- This API Purge Computes RollUp Cost for an asset Item --
403 -- --
404 -- PURPOSE: --
405 -- Oracle Applications Rel 11i.6 --
406 -- --
407 -- --
408 -- HISTORY: --
409 -- 04/17/01 Terence Chan Genesis --
410 ----------------------------------------------------------------------------
411 PROCEDURE Purge_Rollup_Cost (
412 p_api_version IN NUMBER,
413 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE ,
414 p_commit IN VARCHAR2 := FND_API.G_FALSE ,
415 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL ,
416 x_return_status OUT NOCOPY VARCHAR2 ,
417 x_msg_count OUT NOCOPY NUMBER ,
418 x_msg_data OUT NOCOPY VARCHAR2 ,
419
420 p_group_id IN NUMBER );
421
422
423 ----------------------------------------------------------------------------
424 -- PROCEDURE --
425 -- check_if_direct_item --
426 -- --
427 -- DESCRIPTION --
428 -- checks if this is a direct item transaction --
429 -- * Organization should be EAM enabled --
430 -- * Destination should be EAM job --
431 -- * Item number is null or the item should not be of type OSP --
432 -- PURPOSE: --
433 -- Called by the function process_OSP_Transaction in the receiving --
434 -- transaction processor --
435 -- --
436 -- HISTORY: --
437 -- 05/01/01 Anitha Dixit Created --
438 ----------------------------------------------------------------------------
439
440 PROCEDURE check_if_direct_item (
441 p_api_version IN NUMBER,
442 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
443 p_commit IN VARCHAR2 := FND_API.G_FALSE,
444 p_validation_level IN VARCHAR2 DEFAULT FND_API.G_VALID_LEVEL_FULL,
445
446 p_interface_txn_id IN NUMBER,
447
448 x_direct_item_flag OUT NOCOPY NUMBER,
449 x_return_status OUT NOCOPY VARCHAR2,
450 x_msg_count OUT NOCOPY NUMBER,
451 x_msg_data OUT NOCOPY VARCHAR2
452 );
453
454
455 ----------------------------------------------------------------------------
456 -- PROCEDURE --
457 -- process_direct_item_txn --
458 -- DESCRIPTION --
459 -- This is the wrapper function to do direct item costing --
460 -- * Inserts transaction into wip_cost_txn_interface --
461 -- PURPOSE: --
462 -- API to process direct item transaction. Called from the function --
463 -- process_OSP_transaction in the receiving transaction processor --
464 -- HISTORY: --
465 -- 05/01/01 Anitha Dixit Created --
466 ----------------------------------------------------------------------------
467
468 PROCEDURE process_direct_item_txn (
469 p_api_version IN NUMBER,
470 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
471 p_commit IN VARCHAR2 := FND_API.G_FALSE,
472 p_validation_level IN VARCHAR2 DEFAULT FND_API.G_VALID_LEVEL_FULL,
473
474 p_directItem_rec IN WIP_Transaction_PUB.Res_Rec_Type,
475
476 x_directItem_rec IN OUT NOCOPY WIP_Transaction_PUB.Res_Rec_Type,
477 x_return_status OUT NOCOPY VARCHAR2,
478 x_msg_count OUT NOCOPY NUMBER,
479 x_msg_data OUT NOCOPY VARCHAR2
480 );
481
482
483 ----------------------------------------------------------------------------
484 -- PROCEDURE --
485 -- cost_direct_item_txn --
486 -- DESCRIPTION --
487 -- cost a transaction record from wip_cost_txn_interface --
488 -- * new transaction type called Direct Shopfloor Delivery --
489 -- * called by cmlctw --
490 -- * inserts debits and credits into wip_transaction_accounts --
491 -- * update eam asset cost and asset period balances --
492 -- PURPOSE: --
493 -- procedure that costs a direct item transaction and does --
494 -- accounting --
495 -- HISTORY: --
496 -- 05/01/01 Anitha Dixit Created --
497 ----------------------------------------------------------------------------
498 PROCEDURE cost_direct_item_txn (
499 p_api_version IN NUMBER,
500 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
501 p_commit IN VARCHAR2 := FND_API.G_FALSE,
502 p_validation_level IN VARCHAR2 DEFAULT FND_API.G_VALID_LEVEL_FULL,
503
504 p_group_id IN NUMBER,
505 p_prg_appl_id IN NUMBER,
506 p_prg_id IN NUMBER,
507 p_request_id IN NUMBER,
508 p_user_id IN NUMBER,
509 p_login_id IN NUMBER,
510
511 x_return_status OUT NOCOPY VARCHAR2,
512 x_msg_count OUT NOCOPY NUMBER,
513 x_msg_data OUT NOCOPY VARCHAR2
514 );
515
516
517 ----------------------------------------------------------------------------
518 -- PROCEDURE --
519 -- insert_direct_item_distr --
520 -- --
521 -- DESCRIPTION --
522 -- insert accounting into wip_transaction_accounts --
523 -- * WIP valuation account used is material account --
524 -- * Offset against Receiving Inspection account --
525 -- * Accounting done at actuals (PO price + non recoverable tax) --
526 -- PURPOSE: --
527 -- insert accounting into wip_transaction_accounts --
528 -- HISTORY: --
529 -- 05/01/01 Anitha Dixit Created --
530 -- Vinit Added p_base_txn_value --
531 -- parameter --
532 ----------------------------------------------------------------------------
533 PROCEDURE insert_direct_item_distr (
534 p_api_version IN NUMBER,
535 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
536 p_commit IN VARCHAR2 := FND_API.G_FALSE,
537 p_validation_level IN VARCHAR2 DEFAULT FND_API.G_VALID_LEVEL_FULL,
538
539 p_txn_id IN NUMBER,
540 p_ref_acct IN NUMBER,
541 p_txn_value IN NUMBER,
542 p_base_txn_value IN NUMBER,
543 p_wip_entity_id IN NUMBER,
544 p_acct_line_type IN NUMBER,
545 p_prg_appl_id IN NUMBER,
546 p_prg_id IN NUMBER,
547 p_request_id IN NUMBER,
548 p_user_id IN NUMBER,
549 p_login_id IN NUMBER,
550
551 x_return_status OUT NOCOPY VARCHAR2,
552 x_msg_count OUT NOCOPY NUMBER,
553 x_msg_data OUT NOCOPY VARCHAR2
554 ,p_enc_insert_flag IN NUMBER DEFAULT 1
555 );
556
557 ----------------------------------------------------------------------------
558 -- PROCEDURE --
559 -- update_wip_period_balances --
560 -- DESCRIPTION --
561 -- This function updates the tl_material_in in wip_period_balances --
562 -- for the Direct Item Shopfloor delivery transaction --
563 -- PURPOSE: --
564 -- Oracle Applications - Enterprise asset management --
565 -- Beta on 11i Patchset G --
566 -- Costing Support for EAM --
567 -- --
568 -- HISTORY: --
569 -- 07/18/01 Anitha Dixit Created --
570 ----------------------------------------------------------------------------
571 PROCEDURE update_wip_period_balances (
572 p_api_version IN NUMBER,
573 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
574 p_commit IN VARCHAR2 := FND_API.G_FALSE,
575 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
576
577 p_wip_entity_id IN NUMBER,
578 p_acct_period_id IN NUMBER,
579 p_txn_id IN NUMBER,
580 p_prg_appl_id IN NUMBER,
581 p_prg_id IN NUMBER,
582 p_request_id IN NUMBER,
583 p_user_id IN NUMBER,
584 p_login_id IN NUMBER,
585
586 x_return_status OUT NOCOPY VARCHAR2,
587 x_msg_count OUT NOCOPY NUMBER,
588 x_msg_data OUT NOCOPY VARCHAR2 );
589
590 ----------------------------------------------------------------------------
591 -- PROCEDURE --
592 -- insert_direct_item_txn --
593 -- DESCRIPTION --
594 -- insert a transaction record into wip_transactions --
595 -- * new transaction type called Direct Shopfloor Delivery --
596 -- * called by cost_direct_item_txn --
597 -- PURPOSE: --
598 -- procedure that inserts a transaction into wip_transactions and --
599 -- deletes the record from wip_cost_txn_interface --
600 -- HISTORY: --
601 -- 05/01/01 Anitha Dixit Created --
602 ----------------------------------------------------------------------------
603 PROCEDURE insert_direct_item_txn (
604 p_api_version IN NUMBER,
605 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
606 p_commit IN VARCHAR2 := FND_API.G_FALSE,
607 p_validation_level IN VARCHAR2 DEFAULT FND_API.G_VALID_LEVEL_FULL,
608
609 p_group_id IN NUMBER,
610 p_prg_appl_id IN NUMBER,
611 p_prg_id IN NUMBER,
612 p_request_id IN NUMBER,
613 p_user_id IN NUMBER,
614 p_login_id IN NUMBER,
615
616 x_return_status OUT NOCOPY VARCHAR2,
617 x_msg_count OUT NOCOPY NUMBER,
618 x_msg_data OUT NOCOPY VARCHAR2
619 );
620
621 ----------------------------------------------------------------------------
622 -- PROCEDURE --
623 -- get_Direct_Item_Charge_Acct --
624 -- --
625 -- DESCRIPTION --
626 -- This API determines returns the material account number
627 -- given a EAM job (entity type = 6,7) --
628 -- If the wip identity doesn't refer to an EAM job type then --
629 -- -1 is returned, -1 is also returned if material account is not --
630 -- defined for that particular wip entity.
631 --
632 -- This API has been moved to CST_Utility_PUB to limit dependencies for --
633 -- PO. Any changes J (11.5.10) and higher made to this API should NOT be--
634 -- made here, but at CST_Utiltiy_PUB.get_Direct_Item_Charge_Acct.
635 --
636 -- PURPOSE: --
637 -- Oracle Applications Rel 11i.6 --
638 -- Costing Support for EAM --
639 -- Called by the PO account generator
640 -- --
641 -- --
642 -- HISTORY: --
643 -- 07/18/01 Vinit Srivastava Created
644 ----------------------------------------------------------------------------
645 PROCEDURE get_Direct_Item_Charge_Acct (
646 p_api_version IN NUMBER,
647 p_init_msg_list IN VARCHAR2
648 := FND_API.G_FALSE,
649 p_commit IN VARCHAR2
650 := FND_API.G_FALSE,
651 p_validation_level IN NUMBER
652 := FND_API.G_VALID_LEVEL_FULL,
653 p_wip_entity_id IN NUMBER DEFAULT NULL,
654 x_material_acct OUT NOCOPY NUMBER,
655 x_return_status OUT NOCOPY VARCHAR2,
656 x_msg_count OUT NOCOPY NUMBER,
657 x_msg_data OUT NOCOPY VARCHAR2 );
658
659 ----------------------------------------------------------------------------
660 -- PROCEDURE --
661 -- validate_for_reestimation --
662 -- --
663 -- DESCRIPTION --
664 -- validates if the re-estimation flag on the work order value summary --
665 -- form, can be updated --
666 -- * Calls validate_est_status_hook. If hook is used, default --
667 -- validation will be overridden --
668 -- * Default Validation : --
669 -- If curr_est_status is Complete, flag can be checked to re-estimate -
670 -- If curr_est_status is Re-estimate, flag can be unchecked to complete
671 -- PURPOSE: --
672 -- called by work order value summary form --
673 -- --
674 -- HISTORY: --
675 -- 08/26/01 Anitha Dixit Created --
676 ----------------------------------------------------------------------------
677 PROCEDURE validate_for_reestimation (
678 p_api_version IN NUMBER,
679 p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
680 p_commit IN VARCHAR2 := fnd_api.g_false,
681 p_validation_level IN VARCHAR2 DEFAULT fnd_api.g_valid_level_full,
682
683 p_wip_entity_id IN NUMBER,
684 p_job_status IN NUMBER,
685 p_curr_est_status IN NUMBER,
686
687 x_validate_flag OUT NOCOPY NUMBER,
688 x_return_status OUT NOCOPY VARCHAR2,
689 x_msg_count OUT NOCOPY NUMBER,
690 x_msg_data OUT NOCOPY VARCHAR2
691 );
692
693 ----------------------------------------------------------------------------
694 -- PROCEDURE --
695 -- Redistribute_WIP_Accounts --
696 -- --
697 -- --
698 -- DESCRIPTION --
699 -- This API redistributes accounts values from the Accounting class --
700 -- of the route job to the accounting class of the memeber assets. --
701 -- It does so for the variance accounts of the corresponding WACs. --
702 -- This API should be called from period close(CSTPWPVR) --
703 -- and job close (cmlwjv) --
704 -- --
705 -- PURPOSE: --
706 -- Oracle Applications Rel 11i.9 --
707 -- --
708 -- --
709 -- HISTORY: --
710 -- 11/26/02 Anitha Modified to support close through SRS --
711 -- merged accounting entry creation into --
712 -- single SQL against the job close txn --
713 -- 09/26/02 Hemant G Created --
714 ----------------------------------------------------------------------------
715 PROCEDURE Redistribute_WIP_Accounts (
716 p_api_version IN NUMBER,
717 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
718 p_commit IN VARCHAR2 := FND_API.G_FALSE,
719 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
720 p_wcti_group_id IN NUMBER,
721
722 p_user_id IN NUMBER,
723 p_request_id IN NUMBER,
724 p_prog_id IN NUMBER,
725 p_prog_app_id IN NUMBER,
726 p_login_id IN NUMBER,
727
728 x_return_status OUT NOCOPY VARCHAR2,
729 x_msg_count OUT NOCOPY NUMBER,
730 x_msg_data OUT NOCOPY VARCHAR2 );
731
732 ----------------------------------------------------------------------------
733 -- PROCEDURE --
734 -- get_charge_asset --
735 -- --
736 -- DESCRIPTION --
737 -- This API will be called instead of obtaining charge asset --
738 -- from wdj.asset_group_id --
739 -- It will provide support for the following --
740 -- * regular asset work orders --
741 -- * rebuild work orders with parent asset --
742 -- * standalone rebuild work orders --
743 -- * installed base items - future --
744 -- PURPOSE: --
745 -- Oracle Applications 11i.9 --
746 -- --
747 -- HISTORY: --
748 -- 11/26/02 Ray Thng Created --
749 ----------------------------------------------------------------------------
750 PROCEDURE get_charge_asset (
751 p_api_version IN NUMBER,
752 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
753 p_wip_entity_id IN NUMBER,
754 x_inventory_item_id OUT NOCOPY csi_item_instances.inventory_item_id%TYPE,
755 x_serial_number OUT NOCOPY csi_item_instances.serial_number%TYPE,
756 x_maintenance_object_id OUT NOCOPY mtl_serial_numbers.gen_object_id%TYPE,
757 x_return_status OUT NOCOPY VARCHAR2,
758 x_msg_count OUT NOCOPY NUMBER,
759 x_msg_data OUT NOCOPY VARCHAR2);
760
761 ----------------------------------------------------------------------------
762 -- PROCEDURE --
763 -- get_CostEle_for_DirectItem --
764 -- --
765 -- DESCRIPTION --
766 -- This API will return which cost element ID is to be charged for the --
767 -- the direct item transactions --
768 -- PURPOSE: --
769 -- Oracle Applications 11i.10 --
770 -- --
771 -- HISTORY: --
772 -- 06/26/03 Linda Soo Created --
773 -- 27/26/05 Siddharth Khanna Added var p_pac_or_perp which is 1 when --
774 -- called from PAC code. eAM support in PAC --
775 ----------------------------------------------------------------------------
776 PROCEDURE get_CostEle_for_DirectItem (
777 p_api_version IN NUMBER,
778 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
779 p_commit IN VARCHAR2 := FND_API.G_FALSE,
780 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
781 p_txn_id IN NUMBER,
782 p_mnt_or_mfg IN NUMBER, -- 1: eam cost element,
783 -- 2: manufacturing cost ele
784 p_pac_or_perp IN NUMBER := 0, -- 1 for PAC, 0 for Perpetual
785 x_cost_element_id OUT NOCOPY NUMBER,
786 x_return_status OUT NOCOPY VARCHAR2,
787 x_msg_count OUT NOCOPY NUMBER,
788 x_msg_data OUT NOCOPY VARCHAR2);
789
790 ----------------------------------------------------------------------------
791 -- PROCEDURE --
792 -- get_ExpType_for_DirectItem --
793 -- --
794 -- DESCRIPTION --
795 -- *
796 -- PURPOSE: --
797 -- Oracle Applications 11i.9 --
798 -- --
799 -- HISTORY: --
800 -- 06/26/03 Linda Soo Created --
801 ----------------------------------------------------------------------------
802 PROCEDURE get_ExpType_for_DirectItem (
803 p_api_version IN NUMBER,
804 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
805 p_commit IN VARCHAR2 := FND_API.G_FALSE,
806 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
807 p_txn_id IN NUMBER,
808 x_expenditure_type OUT NOCOPY VARCHAR2,
809 x_return_status OUT NOCOPY VARCHAR2,
810 x_msg_count OUT NOCOPY NUMBER,
811 x_msg_data OUT NOCOPY VARCHAR2);
812
813 ----------------------------------------------------------------------------
814 -- PROCEDURE --
815 -- Rollup_WorkOrderCost --
816 -- --
817 -- DESCRIPTION --
818 -- This procedure can be called to rollup the cost in a work order --
819 -- hierarchy. The hierarchy must already be inserted in --
820 -- CST_EAM_HIEARCHY_SNAPSHOT. --
821 -- For more information about this procedure, visit: --
822 -- http://www-apps.us.oracle.com:1100/cst/project/rel11i.10proj/WOCR/ --
823 ----------------------------------------------------------------------------
824 PROCEDURE Rollup_WorkOrderCost (
825 p_api_version IN NUMBER,
826 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
827 p_commit IN VARCHAR2 := FND_API.G_FALSE,
828 p_group_id IN NUMBER,
829 p_organization_id IN NUMBER,
830 p_user_id IN NUMBER,
831 p_prog_appl_id IN NUMBER,
832 x_return_status OUT NOCOPY VARCHAR2);
833
834 ----------------------------------------------------------------------------
835 -- PROCEDURE --
836 -- Purge_RollupCost --
837 -- --
838 -- DESCRIPTION --
839 -- This procedure can be called to remove temporary cost rollup --
840 -- information in CST_EAM_HIEARCHY_SNAPSHOT and CST_EAM_ROLLUP_COSTS. --
841 -- For more information about this procedure, visit: --
842 -- http://www-apps.us.oracle.com:1100/cst/project/rel11i.10proj/WOCR/ --
843 ----------------------------------------------------------------------------
844 PROCEDURE Purge_RollupCost (
845 p_api_version IN NUMBER,
846 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
847 p_commit IN VARCHAR2 := FND_API.G_FALSE,
848 p_group_id IN NUMBER := NULL,
849 p_prog_appl_id IN NUMBER := NULL,
850 p_last_update_date IN DATE := NULL,
851 x_return_status OUT NOCOPY VARCHAR2);
852
853
854
855 --------------------------------------------------------------------------
856 -- API name : Insert_eamBalAcct
857 -- Type : Public
858 -- Function : This API inserts data in CST_EAM_BALANCE_BY_ACCOUNTS
859 -- table.
860 -- Pre-reqs : None.
861 -- Parameters :
862 -- IN :p_api_version IN NUMBER Required
863 -- p_init_msg_list IN VARCHAR2 Required
864 -- p_commit IN VARCHAR2 Required
865 -- p_validation_level IN NUMBER Required
866 -- p_period_id IN NUMBER Required
867 -- p_period_set_name IN VARCHAR2 Required
868 -- p_period_name IN VARCHAR2 Required
869 -- p_org_id IN NUMBER Required
870 -- p_wip_entity_id IN NUMBER Required
871 -- p_owning_dept_id IN NUMBER Required
872 -- p_dept_id IN NUMBER Required
873 -- p_maint_cost_cat IN NUMBER Required
874 -- p_opseq_num IN NUMBER Required
875 -- p_period_start_dat IN DATE Required
876 -- p_account_ccid IN NUMBER Required
877 -- p_value IN NUMBER Required
878 -- p_txn_type IN NUMBER Required
879 -- p_wip_acct_class IN VARCHAR2 Required
880 -- p_mfg_cost_element_id IN NUMBER Required
881 -- p_user_id IN NUMBER Required
882 -- p_request_id IN NUMBER Required
883 -- p_prog_id IN NUMBER Required
884 -- p_prog_app_id IN NUMBER Required
885 -- p_login_id IN NUMBER Required
886 -- OUT x_return_status OUT VARCHAR2(1)
887 -- x_msg_count OUT NUMBER
888 -- x_msg_data OUT VARCHAR2(2000)
889 -- Version : Current version 1.0
890 -- Initial version 1.0
891 --
892 -- HISTORY
893 -- 04/29/05 Anjali R Added as part of eAM Requirements Project (R12)
894 --
895 --------------------------------------------------------------------------
896
897 PROCEDURE Insert_eamBalAcct(
898 p_api_version IN NUMBER,
899 p_init_msg_list IN VARCHAR2,
900 p_commit IN VARCHAR2,
901 p_validation_level IN NUMBER,
902 x_return_status OUT NOCOPY VARCHAR2,
903 x_msg_count OUT NOCOPY NUMBER,
904 x_msg_data OUT NOCOPY VARCHAR2,
905 p_period_id IN NUMBER,
906 p_period_set_name IN VARCHAR2,
907 p_period_name IN VARCHAR2,
908 p_org_id IN NUMBER,
909 p_wip_entity_id IN NUMBER,
910 p_owning_dept_id IN NUMBER,
911 p_dept_id IN NUMBER,
912 p_maint_cost_cat IN NUMBER,
913 p_opseq_num IN NUMBER,
914 p_period_start_date IN DATE,
915 p_account_ccid IN NUMBER,
916 p_value IN NUMBER,
917 p_txn_type IN NUMBER,
918 p_wip_acct_class IN VARCHAR2,
919 p_mfg_cost_element_id IN NUMBER,
920 p_user_id IN NUMBER,
921 p_request_id IN NUMBER,
922 p_prog_id IN NUMBER,
923 p_prog_app_id IN NUMBER,
924 p_login_id IN NUMBER
925 );
926
927
928 -------------------------------------------------------------------------------
929 -- API name : Delete_eamBalAcct
930 -- Type : Public
931 -- Function : This API deletes data from CST_EAM_BALANCE_BY_ACCOUNTS
932 -- table for a given wip_entity_id and period.
933 -- Pre-reqs : None.
934 -- Parameters :
935 -- IN :
936 -- p_api_version IN NUMBER Required
937 -- p_init_msg_list IN VARCHAR2 Required
938 -- p_commit IN VARCHAR2 Required
939 -- p_validation_level IN NUMBER Required
940 -- p_org_id IN NUMBER Required
941 -- p_entity_id_tab IN CSTPECEP.wip_entity_id_type
942 -- p_period_set_name IN VARCHAR2 Required
943 -- p_period_name IN VARCHAR2 Required
944 -- OUT :
945 -- x_return_status OUT NOCOPY VARCHAR2(1)
946 -- x_msg_count OUT NOCOPY NUMBER
947 -- x_msg_data OUT NOCOPY VARCHAR2(2000)
948 -- Version : Current version 1.0
949 -- Initial version 1.0
950 --
951 -- History :
952 -- 03/29/05 Anjali R Added as part of eAM requirements Project (R12)
953 --
954 -------------------------------------------------------------------------------
955 PROCEDURE Delete_eamBalAcct
956 (
957 p_api_version IN NUMBER,
958 p_init_msg_list IN VARCHAR2 ,
959 p_commit IN VARCHAR2 ,
960 p_validation_level IN NUMBER,
961 x_return_status OUT NOCOPY VARCHAR2,
962 x_msg_count OUT NOCOPY VARCHAR2,
963 x_msg_data OUT NOCOPY VARCHAR2,
964 p_org_id IN NUMBER,
965 p_entity_id_tab IN CSTPECEP.wip_entity_id_type
966 );
967
968 -------------------------------------------------------------------------------
969 -- API name : Insert_tempEstimateDetails
970 -- Type : Public
971 -- Function : This API inserts data into Global Temporary table
972 -- CST_EAM_DIRECT_ITEMS_TEMP
973 -- Pre-reqs : None.
974 -- Parameters :
975 -- IN :
976 -- p_api_version IN NUMBER Required
977 -- p_init_msg_list IN VARCHAR2 Required
978 -- p_commit IN VARCHAR2 Required
979 -- p_validation_level IN NUMBER Required
980 -- p_entity_id_tab IN CSTPECEP.wip_entity_id_type
981 -- OUT :
982 -- x_return_status OUT NOCOPY VARCHAR2(1)
983 -- x_msg_count OUT NOCOPY NUMBER
984 -- x_msg_data OUT NOCOPY VARCHAR2(2000)
985 -- Version : Current version 1.0
986 -- Initial version 1.0
987 --
988 -- History :
989 -- 02/10/06 Anjali R Added as part of eAM requirements Project (R12)
990 --
991 -------------------------------------------------------------------------------
992 PROCEDURE Insert_tempEstimateDetails
993 (
994 p_api_version IN NUMBER,
995 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
996 p_commit IN VARCHAR2 := FND_API.G_FALSE,
997 p_validation_level IN VARCHAR2 := FND_API.G_VALID_LEVEL_FULL,
998 x_return_status OUT NOCOPY VARCHAR2,
999 x_msg_count OUT NOCOPY NUMBER,
1000 x_msg_data OUT NOCOPY VARCHAR2,
1001 p_entity_id_tab IN CSTPECEP.wip_entity_id_type
1002 );
1003
1004
1005 -------------------------------------------------------------------------------
1006 -- API name : Get_Encumbrance_Data
1007 -- Type : Public
1008 -- Function : This API will return the encumbrance data for OSP
1009 -- item and EAM direct item delivery
1010 -- Pre-reqs : None.
1011 -- Parameters :
1012 -- IN :
1013 -- p_receiving_transaction_id IN NUMBER
1014 -- p_api_version IN NUMBER DEFAULT 1
1015 -- OUT :
1016 -- x_encumbrance_amount OUT NOCOPY NUMBER
1017 -- x_encumbrance_quantity OUT NOCOPY NUMBER
1018 -- x_encumbrance_ccid OUT NOCOPY NUMBER
1019 -- x_encumbrance_type_id OUT NOCOPY NUMBER
1020 -- x_return_status OUT NOCOPY VARCHAR2
1021 -- x_msg_count OUT NOCOPY NUMBER
1022 -- x_msg_data OUT NOCOPY VARCHAR2
1023 -- Version : Current version 1.0
1024 -- Initial version 1.0
1025 --
1026 -- History :
1027 -- 02/08/2010 Creation Added as part of EAM Direct Item and OSP item
1028 -- Encumbrance reversal project
1029 --
1030 -------------------------------------------------------------------------------
1031 PROCEDURE Get_Encumbrance_Data(
1032 p_receiving_transaction_id IN NUMBER
1033 ,p_api_version IN NUMBER DEFAULT 1
1034 ,x_encumbrance_amount OUT NOCOPY NUMBER
1035 ,x_encumbrance_quantity OUT NOCOPY NUMBER
1036 ,x_encumbrance_ccid OUT NOCOPY NUMBER
1037 ,x_encumbrance_type_id OUT NOCOPY NUMBER
1038 ,x_return_status OUT NOCOPY VARCHAR2
1039 ,x_msg_count OUT NOCOPY NUMBER
1040 ,x_msg_data OUT NOCOPY VARCHAR2);
1041
1042 PROCEDURE get_account
1043 (p_wip_entity_id IN NUMBER,
1044 p_item_id IN NUMBER DEFAULT NULL,
1045 p_account_name IN VARCHAR2,
1046 p_api_version IN NUMBER DEFAULT 1,
1047 x_acct OUT NOCOPY NUMBER,
1048 x_return_status OUT NOCOPY VARCHAR2,
1049 x_msg_count OUT NOCOPY NUMBER,
1050 x_msg_data OUT NOCOPY VARCHAR2);
1051
1052
1053 PROCEDURE check_enc_rev_flag
1054 (p_organization_id IN NUMBER,
1055 x_enc_rev_flag OUT NOCOPY VARCHAR2,
1056 x_return_status OUT NOCOPY VARCHAR2,
1057 x_msg_count OUT NOCOPY NUMBER,
1058 x_msg_data OUT NOCOPY VARCHAR2);
1059
1060 END CST_eamCost_PUB;