[Home] [Help]
PACKAGE BODY: APPS.CSTPSISC
Source
1 PACKAGE BODY CSTPSISC AS
2 /* $Header: CSTSISCB.pls 120.3.12010000.3 2010/01/29 00:38:04 jkwac ship $ */
3
4 -- PROCEDURE
5 -- ins_std_cost This function inserts standard cost in mcacd,
6 -- transaction cost in mctcd and sub-elemental
7 -- costs in macs.
8 --
9 --
10
11 procedure ins_std_cost(
12 I_ORG_ID IN NUMBER,
13 I_INV_ITEM_ID IN NUMBER,
14 I_TXN_ID IN NUMBER,
15 I_TXN_ACTION_ID IN NUMBER,
16 I_TXN_SOURCE_TYPE_ID IN NUMBER,
17 I_EXP_ITEM IN NUMBER,
18 I_EXP_SUB IN NUMBER,
19 I_TXN_COST IN NUMBER,
20 I_ACTUAL_COST IN NUMBER,
21 I_PRIOR_COST IN NUMBER,
22 I_USER_ID IN NUMBER,
23 I_LOGIN_ID IN NUMBER,
24 I_REQUEST_ID IN NUMBER,
25 I_PROG_APPL_ID IN NUMBER,
26 I_PROG_ID IN NUMBER,
27 O_Err_Num OUT NOCOPY NUMBER,
28 O_Err_Code OUT NOCOPY VARCHAR2,
29 O_Err_Msg OUT NOCOPY VARCHAR2
30 )
31 is
32 l_err_num number;
33 l_err_code varchar2(240);
34 l_err_msg varchar2(240);
35 l_profile_option number;
36
37 l_org_id number;
38 l_txfr_org_id number;
39 l_txn_qty number;
40 l_fob_point number;
41 l_stmt_num number;
42 ins_std_cost_error EXCEPTION;
43
44 /* EAM Acct Enh Project */
45 l_zero_cost_flag NUMBER := -1;
46 l_return_status VARCHAR2(1);
47 l_msg_count NUMBER := 0;
48 l_msg_data VARCHAR2(8000);
49 l_api_message VARCHAR2(8000);
50 l_debug VARCHAR2(100);
51 l_earn_moh NUMBER; /* Added for bug6157916 */
52 moh_rules_error EXCEPTION; /* Added for bug6157916 */
53
54 BEGIN
55 l_return_status := fnd_api.g_ret_sts_success;
56 l_msg_data := '';
57 l_err_num := 0;
58 l_err_code := '';
59 l_err_msg := '';
60
61 o_err_num := l_err_num;
62 o_err_code := l_err_code;
63 o_err_msg := l_err_msg;
64
65
66 -- we break down into two major cases
67 -- 1. PO delivery, RTV, PO delivery adjustment are exception cases
68 -- so we group them together. within this group, asset item in
69 -- asset sub is the only case that use standard cost. otherwise,
70 -- we're using po price.
71 -- 2. all other asset item transactions are another group
72 -- wip scrap uses actual cost, and the others use standard cost.
73
74 l_stmt_num := 10;
75
76 if (i_txn_source_type_id = 1) then
77 -- PO delivery, RTV, PO delivery adjustment
78
79 l_stmt_num := 20;
80
81 /*
82 gwu@us: This profile option is obsolete. Forcing the
83 profile option to 2 (INV/WIP) for all 11i installs.
84
85 -- Check the profile option. If profile option is 2 (INV/WIP), then
86 -- no need to insert into mctcd. This insertion has been done by
87 -- transaction manager (in inltpu module). It fixes bug 837911
88 l_profile_option := fnd_profile.value('CST_AVG_COSTING_OPTION');
89 */
90 l_profile_option := 2;
91
92 if (l_profile_option <> 2) then
93
94 INSERT INTO MTL_CST_TXN_COST_DETAILS (
95 transaction_id,
96 organization_id,
97 inventory_item_id,
98 cost_element_id,
99 level_type,
100 transaction_cost,
101 new_average_cost,
102 percentage_change,
103 value_change,
104 last_update_date,
105 last_updated_by,
106 creation_date,
107 created_by,
108 last_update_login,
109 request_id,
110 program_application_id,
111 program_id,
112 program_update_date
113 )
114 VALUES(
115 i_txn_id,
116 i_org_id,
117 i_inv_item_id,
118 1, -- material
119 1, -- this level
120 i_txn_cost,
121 NULL,
122 NULL,
123 NULL,
124 sysdate,
125 i_user_id,
126 sysdate,
127 i_user_id,
128 i_login_id,
129 i_request_id,
130 i_prog_appl_id,
131 i_prog_id,
132 sysdate);
133
134 end if;
135
136 l_stmt_num := 30;
137
138 if (i_exp_item = 0 and i_exp_sub = 0) then
139 -- asset item in asset sub is an exception case, use standard cost
140
141 l_stmt_num := 40;
142
143 INSERT INTO MTL_CST_ACTUAL_COST_DETAILS (
144 transaction_id,
145 organization_id,
146 layer_id,
147 cost_element_id,
148 level_type,
149 transaction_action_id,
150 last_update_date,
151 last_updated_by,
152 creation_date,
153 created_by,
154 last_update_login,
155 request_id,
156 program_application_id,
157 program_id,
158 program_update_date,
159 inventory_item_id,
160 actual_cost,
161 prior_cost,
162 new_cost,
163 insertion_flag,
164 variance_amount,
165 user_entered)
166 SELECT
167 i_txn_id,
168 i_org_id,
169 -1, -- layer_id = -1 for std.
170 cost_element_id,
171 level_type,
172 i_txn_action_id,
173 sysdate,
174 i_user_id,
175 sysdate,
176 i_user_id,
177 i_login_id,
178 i_request_id,
179 i_prog_appl_id,
180 i_prog_id,
181 sysdate,
182 i_inv_item_id,
183 SUM(DECODE(LEVEL_TYPE,2,DECODE(COST_ELEMENT_ID,1,ITEM_COST,
184 2,ITEM_COST,
185 3,ITEM_COST,
186 4,ITEM_COST,
187 5,ITEM_COST),
188 1,DECODE(COST_ELEMENT_ID,1,ITEM_COST,
189 2,ITEM_COST,
190 3,ITEM_COST,
191 4,ITEM_COST,
192 5,ITEM_COST))),
193 NULL,
194 NULL,
195 'N',
196 NULL,
197 'N'
198 FROM CST_ITEM_COST_DETAILS CICD,
199 MTL_PARAMETERS MP
200 WHERE MP.organization_id = i_org_id
201 AND CICD.organization_id = MP.cost_organization_id
202 AND CICD.inventory_item_id = i_inv_item_id
203 AND CICD.cost_type_id = 1
204 GROUP BY CICD.level_type, CICD.cost_element_id;
205
206 l_stmt_num := 45;
207 /* Bug6157916 : Check if MOH Absorption rule has been defined
208 and if the MOH absorption rule is not overridden then
209 only insert into MACS
210 */
211 l_earn_moh := 1;
212 cst_mohRules_pub.apply_moh(
213 1.0,
214 p_organization_id => i_org_id,
215 p_earn_moh =>l_earn_moh,
216 p_txn_id => i_txn_id,
217 p_item_id => i_inv_item_id,
218 x_return_status => l_return_status,
219 x_msg_count => l_msg_count,
220 x_msg_data => l_msg_data);
221 IF l_return_status <> FND_API.g_ret_sts_success THEN
222 FND_FILE.put_line(FND_FILE.log, l_msg_data);
223 raise moh_rules_error;
224 END IF;
225 IF(l_earn_moh = 0) THEN
226 IF l_debug = 'Y' THEN
227 fnd_file.put_line(fnd_file.log, '---Material Overhead Absorption Overridden--');
228 END IF;
229 ELSE
230 l_stmt_num := 46;
231
232 INSERT INTO mtl_actual_cost_subelement(
233 transaction_id,
234 organization_id,
235 layer_id,
236 cost_element_id,
237 level_type,
238 resource_id,
239 last_update_date,
240 last_updated_by,
241 creation_date,
242 created_by,
243 last_update_login,
244 request_id,
245 program_application_id,
246 program_id,
247 program_update_date,
248 actual_cost,
249 user_entered)
250 SELECT i_txn_id,
251 i_org_id,
252 -1, -- layer_id = -1 for std.
253 cost_element_id,
254 level_type,
255 resource_id,
256 sysdate,
257 i_user_id,
258 sysdate,
259 i_user_id,
260 i_login_id,
261 i_request_id,
262 i_prog_appl_id,
263 i_prog_id,
264 sysdate,
265 item_cost,
266 'N'
267 FROM CST_ITEM_COST_DETAILS CICD,
268 MTL_PARAMETERS MP
269 WHERE MP.organization_id = i_org_id
270 AND CICD.organization_id = MP.cost_organization_id
271 AND CICD.inventory_item_id = i_inv_item_id
272 AND CICD.cost_type_id = 1
273 AND CICD.level_type = 1
274 AND CICD.cost_element_id = 2;
275 END IF ; /* l_earn_moh = 0 */
276
277 else
278 -- for all others, use transaction_cost which is po price
279 -- as a this level material cost
280
281 l_stmt_num := 50;
282
283 INSERT INTO MTL_CST_ACTUAL_COST_DETAILS (
284 transaction_id,
285 organization_id,
286 layer_id,
287 cost_element_id,
288 level_type,
289 transaction_action_id,
290 last_update_date,
291 last_updated_by,
292 creation_date,
293 created_by,
294 last_update_login,
295 request_id,
296 program_application_id,
297 program_id,
298 program_update_date,
299 inventory_item_id,
300 actual_cost,
301 prior_cost,
302 new_cost,
303 insertion_flag,
304 variance_amount,
305 user_entered
306 )
307 VALUES(
308 i_txn_id,
309 i_org_id,
310 -1, -- layer_id = -1 for std.
311 1, -- material
312 1, -- this level
313 i_txn_action_id,
314 sysdate,
315 i_user_id,
316 sysdate,
317 i_user_id,
318 i_login_id,
319 i_request_id,
320 i_prog_appl_id,
321 i_prog_id,
322 sysdate,
323 i_inv_item_id,
324 i_txn_cost,
325 NULL,
326 NULL,
327 'N',
328 NULL,
329 'N');
330
331 end if;
332
333 elsif (i_exp_item = 0) then
334
335 l_stmt_num := 60;
336
337 if (i_txn_action_id = 30) then
338 -- WIP scrap for asset item
339
340 INSERT INTO MTL_CST_ACTUAL_COST_DETAILS (
341 transaction_id,
342 organization_id,
343 layer_id,
344 cost_element_id,
345 level_type,
346 transaction_action_id,
347 last_update_date,
348 last_updated_by,
349 creation_date,
350 created_by,
351 last_update_login,
352 request_id,
353 program_application_id,
354 program_id,
355 program_update_date,
356 inventory_item_id,
357 actual_cost,
358 prior_cost,
359 new_cost,
360 insertion_flag,
361 variance_amount,
362 user_entered
363 )
364 VALUES(
365 i_txn_id,
366 i_org_id,
367 -1, -- layer_id = -1 for std.
368 1, -- material
369 1, -- this level
370 i_txn_action_id,
371 sysdate,
372 i_user_id,
373 sysdate,
374 i_user_id,
375 i_login_id,
376 i_request_id,
377 i_prog_appl_id,
378 i_prog_id,
379 sysdate,
380 i_inv_item_id,
381 i_actual_cost,
382 NULL,
383 NULL,
384 'N',
385 NULL,
386 'N');
387
388 else
389 -- all other cases for asset items
390 l_stmt_num := 70;
391 SELECT primary_quantity, organization_id, transfer_organization_id
392 INTO l_txn_qty, l_org_id, l_txfr_org_id
393 FROM mtl_material_transactions
394 WHERE transaction_id = i_txn_id;
395
396 /* For intransit shipments, FOB shipment, this function is called twice -
397 once for the sending org and once for the receiving org.
398 For the receiving org we need to only make entries for MOH that gets absorbed. */
399 /* Bug 2695063 to facilitate AX translation needs rows in MCACD for
400 sending org and receiving org. This is applicable for both FOB shipment and
401 FOB receipt. Commented IF condition for bug2695063.
402 IF(i_txn_action_id <> 21 OR l_org_id = i_org_id) THEN */
403
404 l_stmt_num := 73;
405 /* EAM Acct Enh Project */
406 CST_Utility_PUB.get_zeroCostIssue_flag (
407 p_api_version => 1.0,
408 x_return_status => l_return_status,
409 x_msg_count => l_msg_count,
410 x_msg_data => l_msg_data,
411 p_txn_id => i_txn_id,
412 x_zero_cost_flag => l_zero_cost_flag
413 );
414
415 if (l_return_status <> fnd_api.g_ret_sts_success) then
416 FND_FILE.put_line(FND_FILE.log, l_msg_data);
417 l_api_message := 'get_zeroCostIssue_flag returned unexpected error';
418 FND_MESSAGE.set_name('BOM','CST_API_MESSAGE');
419 FND_MESSAGE.set_token('TEXT', l_api_message);
420 FND_MSG_pub.add;
421 raise fnd_api.g_exc_unexpected_error;
422 end if;
423
424 l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
425
426 /*if (l_debug = 'Y') then
427 FND_FILE.PUT_LINE(FND_FILE.LOG,'zero_cost_flag:'|| to_char(l_zero_cost_flag));
428 end if;
429
430 FND_FILE.PUT_LINE(FND_FILE.LOG, 'Inserting into MCACD... ');*/
431
432 if (l_zero_cost_flag <> 1) then
433
434 l_stmt_num := 75;
435 INSERT INTO MTL_CST_ACTUAL_COST_DETAILS (
436 transaction_id,
437 organization_id,
438 layer_id,
439 cost_element_id,
440 level_type,
441 transaction_action_id,
442 last_update_date,
443 last_updated_by,
444 creation_date,
445 created_by,
446 last_update_login,
447 request_id,
448 program_application_id,
449 program_id,
450 program_update_date,
451 inventory_item_id,
452 actual_cost,
453 prior_cost,
454 new_cost,
455 insertion_flag,
456 variance_amount,
457 user_entered)
458 SELECT
459 i_txn_id,
460 i_org_id,
461 -1, -- layer_id = -1 for std.
462 cost_element_id,
463 level_type,
464 i_txn_action_id,
465 sysdate,
466 i_user_id,
467 sysdate,
468 i_user_id,
469 i_login_id,
470 i_request_id,
471 i_prog_appl_id,
472 i_prog_id,
473 sysdate,
474 i_inv_item_id,
475 SUM(DECODE(LEVEL_TYPE,2,DECODE(COST_ELEMENT_ID,1,ITEM_COST,
476 2,ITEM_COST,
477 3,ITEM_COST,
478 4,ITEM_COST,
479 5,ITEM_COST),
480 1,DECODE(COST_ELEMENT_ID,1,ITEM_COST,
481 2,ITEM_COST,
482 3,ITEM_COST,
483 4,ITEM_COST,
484 5,ITEM_COST))),
485 NULL,
486 NULL,
487 'N',
488 NULL,
489 'N'
490 FROM CST_ITEM_COST_DETAILS CICD,
491 MTL_PARAMETERS MP
492 WHERE MP.organization_id = i_org_id
493 AND CICD.organization_id = MP.cost_organization_id
494 AND CICD.inventory_item_id = i_inv_item_id
495 AND CICD.cost_type_id = 1
496 GROUP BY CICD.level_type, CICD.cost_element_id;
497
498 if (SQL%NOTFOUND) then
499 INSERT INTO MTL_CST_ACTUAL_COST_DETAILS (
500 transaction_id,
501 organization_id,
502 layer_id,
503 cost_element_id,
504 level_type,
505 transaction_action_id,
506 last_update_date,
507 last_updated_by,
508 creation_date,
509 created_by,
510 last_update_login,
511 request_id,
512 program_application_id,
513 program_id,
514 program_update_date,
515 inventory_item_id,
516 actual_cost,
517 prior_cost,
518 new_cost,
519 insertion_flag,
520 variance_amount,
521 user_entered)
522 SELECT
523 i_txn_id,
524 i_org_id,
525 -1, -- layer_id = -1 for std.
526 1, -- hard coded to 1 for items having no cicd
527 1, -- hard coded to 1 for items having no cicd
528 i_txn_action_id,
529 sysdate,
530 i_user_id,
531 sysdate,
532 i_user_id,
533 i_login_id,
534 i_request_id,
535 i_prog_appl_id,
536 i_prog_id,
537 sysdate,
538 i_inv_item_id,
539 0,
540 NULL,
541 NULL,
542 'N',
543 NULL,
544 'N'
545 FROM dual;
546 end if;
547
548 else
549
550 l_stmt_num := 77;
551 /* l_zero_cost_flag = 1*/
552 INSERT INTO MTL_CST_ACTUAL_COST_DETAILS (
553 transaction_id,
554 organization_id,
555 layer_id,
556 cost_element_id,
557 level_type,
558 transaction_action_id,
559 last_update_date,
560 last_updated_by,
561 creation_date,
562 created_by,
563 last_update_login,
564 request_id,
565 program_application_id,
566 program_id,
567 program_update_date,
568 inventory_item_id,
569 actual_cost,
570 prior_cost,
571 new_cost,
572 insertion_flag,
573 variance_amount,
574 user_entered)
575 SELECT
576 i_txn_id,
577 i_org_id,
578 -1, -- layer_id = -1 for std.
579 cost_element_id,
580 level_type,
581 i_txn_action_id,
582 sysdate,
583 i_user_id,
584 sysdate,
585 i_user_id,
586 i_login_id,
587 i_request_id,
588 i_prog_appl_id,
589 i_prog_id,
590 sysdate,
591 i_inv_item_id,
592 0,
593 NULL,
594 NULL,
595 'N',
596 NULL,
597 'N'
598 FROM CST_ITEM_COST_DETAILS CICD,
599 MTL_PARAMETERS MP
600 WHERE MP.organization_id = i_org_id
601 AND CICD.organization_id = MP.cost_organization_id
602 AND CICD.inventory_item_id = i_inv_item_id
603 AND CICD.cost_type_id = 1
604 GROUP BY CICD.level_type, CICD.cost_element_id;
605
606 end if; /* l_zero_cost_flag <> 1 */
607
608 /* Bug 2695063 to facilitate AX translation needs rows in MCACD for
609 sending org and receiving org. This is applicable for both FOB shipment and
610 FOB receipt. Commented ELSE condition for bug2695063.
611 ELSE
612 FND_FILE.PUT_LINE(FND_FILE.LOG, 'Inserting into MCACD for receiving org... ');
613 l_stmt_num := 76;
614
615 INSERT INTO MTL_CST_ACTUAL_COST_DETAILS (
616 transaction_id,
617 organization_id,
618 layer_id,
619 cost_element_id,
620 level_type,
621 transaction_action_id,
622 last_update_date,
623 last_updated_by,
624 creation_date,
625 created_by,
626 last_update_login,
627 request_id,
628 program_application_id,
629 program_id,
630 program_update_date,
631 inventory_item_id,
632 actual_cost,
633 prior_cost,
634 new_cost,
635 insertion_flag,
636 variance_amount,
637 user_entered)
638 SELECT
639 i_txn_id,
640 i_org_id,
641 -1, -- layer_id = -1 for std.
642 cost_element_id,
643 level_type,
644 i_txn_action_id,
645 sysdate,
646 i_user_id,
647 sysdate,
648 i_user_id,
649 i_login_id,
650 i_request_id,
651 i_prog_appl_id,
652 i_prog_id,
653 sysdate,
654 i_inv_item_id,
655 SUM(DECODE(LEVEL_TYPE,2,DECODE(COST_ELEMENT_ID,1,ITEM_COST,
656 2,ITEM_COST,
657 3,ITEM_COST,
658 4,ITEM_COST,
659 5,ITEM_COST),
660 1,DECODE(COST_ELEMENT_ID,1,ITEM_COST,
661 2,ITEM_COST,
662 3,ITEM_COST,
663 4,ITEM_COST,
664 5,ITEM_COST))),
665 NULL,
666 NULL,
667 'N',
668 NULL,
669 'N'
670 FROM CST_ITEM_COST_DETAILS CICD,
671 MTL_PARAMETERS MP
672 WHERE MP.organization_id = i_org_id
673 AND CICD.organization_id = MP.cost_organization_id
674 AND CICD.inventory_item_id = i_inv_item_id
675 AND CICD.cost_type_id = 1
676 AND CICD.cost_element_id = 2
677 GROUP BY CICD.level_type, CICD.cost_element_id;
678
679 END IF; */
680
681 l_stmt_num := 80;
682
683 -- Modified for fob stamping project
684 if (i_txn_action_id = 21) THEN
685 SELECT nvl(MMT.fob_point, MIP.fob_point)
686 INTO l_fob_point
687 FROM MTL_INTERORG_PARAMETERS MIP, MTL_MATERIAL_TRANSACTIONS MMT
688 WHERE MIP.from_organization_id = l_org_id
689 AND MIP.to_organization_id = l_txfr_org_id
690 AND MMT.transaction_id = i_txn_id;
691
692 elsif (i_txn_action_id = 12) THEN
693 SELECT nvl(MMT.fob_point, MIP.fob_point)
694 INTO l_fob_point
695 FROM MTL_INTERORG_PARAMETERS MIP, MTL_MATERIAL_TRANSACTIONS MMT
696 WHERE MIP.from_organization_id = l_txfr_org_id
697 AND MIP.to_organization_id = l_org_id
698 AND MMT.transaction_id = i_txn_id;
699
700 end if;
701
702 l_stmt_num := 90;
703
704 if ((i_txn_action_id = 31 and i_txn_source_type_id = 5) /* WIP completion */
705 OR
706 (i_txn_action_id = 32 and i_txn_source_type_id = 5) /* Assembly return */
707 OR
708 (i_txn_action_id = 3 and l_txn_qty >0) /* Direct interorg receipt */
709 OR
710 (i_txn_action_id = 21 and l_fob_point = 1 and l_org_id <> i_org_id)
711 OR
712 /* commented following line and added a line below for
713 bug 2695063
714 (i_txn_action_id = 12 and l_fob_point = 2 ) */
715 (i_txn_action_id = 12 and l_fob_point = 2 and l_org_id = i_org_id) /* Intransit Receipt */
716 OR
717 /* OPM INVCONV umoogala */
718 (i_txn_action_id = 15)
719 OR
720 /* OPM INVCONV umoogala */
721 (i_txn_action_id = 22)
722 ) then
723
724 /* Bug6157916 : Check if MOH Absorption rule has been defined
725 and if the MOH absorption rule is not overridden then
726 only insert into MACS
727 */
728 l_earn_moh := 1;
729 cst_mohRules_pub.apply_moh(
730 1.0,
731 p_organization_id => i_org_id,
732 p_earn_moh =>l_earn_moh,
733 p_txn_id => i_txn_id,
734 p_item_id => i_inv_item_id,
735 x_return_status => l_return_status,
736 x_msg_count => l_msg_count,
737 x_msg_data => l_msg_data);
738 IF l_return_status <> FND_API.g_ret_sts_success THEN
739 FND_FILE.put_line(FND_FILE.log, l_msg_data);
740 raise moh_rules_error;
741 END IF;
742 IF(l_earn_moh = 0) THEN
743 IF l_debug = 'Y' THEN
744 fnd_file.put_line(fnd_file.log, '---Material Overhead Absorption Overridden--');
745 END IF;
746 ELSE
747 FND_FILE.PUT_LINE(FND_FILE.LOG, 'Inserting into MACS... ');
748 l_stmt_num := 100;
749
750 INSERT INTO mtl_actual_cost_subelement(
751 transaction_id,
752 organization_id,
753 layer_id,
754 cost_element_id,
755 level_type,
756 resource_id,
757 last_update_date,
758 last_updated_by,
759 creation_date,
760 created_by,
761 last_update_login,
762 request_id,
763 program_application_id,
764 program_id,
765 program_update_date,
766 actual_cost,
767 user_entered)
768 SELECT i_txn_id,
769 i_org_id,
770 -1, -- layer_id = -1 for std.
771 cost_element_id,
772 level_type,
773 resource_id,
774 sysdate,
775 i_user_id,
776 sysdate,
777 i_user_id,
778 i_login_id,
779 i_request_id,
780 i_prog_appl_id,
781 i_prog_id,
782 sysdate,
783 item_cost,
784 'N'
785 FROM CST_ITEM_COST_DETAILS CICD,
786 MTL_PARAMETERS MP
787 WHERE MP.organization_id = i_org_id
788 AND CICD.organization_id = MP.cost_organization_id
789 AND CICD.inventory_item_id = i_inv_item_id
790 AND CICD.cost_type_id = 1
791 AND CICD.level_type = 1
792 AND CICD.cost_element_id = 2;
793 END IF; /*l_earn_moh = 0*/
794 end if;
795 end if;
796 end if;
797
798
799 EXCEPTION
800 when ins_std_cost_error then
801 o_err_num := l_err_num;
802 o_err_code := l_err_code;
803 o_err_msg := 'CSTPSISC.INS_STD_COST:' || l_err_msg;
804 when moh_rules_error THEN
805 o_err_num := 9999;
806 o_err_code := 'CST_RULES_ERROR';
807 FND_MESSAGE.set_name('BOM', 'CST_RULES_ERROR');
808 o_err_msg := 'CSTPSISC.INS_STD_COST:'||FND_MESSAGE.Get;
809 when others then
810 o_err_num := SQLCODE;
811 o_err_msg := 'CSTPSISC.INS_STD_COST (' || to_char(l_stmt_num) || '): '
812 || substrb(SQLERRM,1,150);
813
814 END ins_std_cost;
815
816 END CSTPSISC;
817