299: l_stmt_num := 5;
300:
301: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
302: if (l_debug = 'Y') then
303: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_mark_non_project_world_txns');
304: end if;
305:
306: -- The query is to mark all non-project world txns satisfying the
307: -- arguments provided, as processed.
384:
385: END IF;
386:
387: if (l_debug = 'Y') then
388: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: NP Count MMT is #: '||to_char(SQL%ROWCOUNT) );
389: end if;
390:
391: /* Changes for consigned inventory */
392: /* Mark all transactions not owned by the current org as cost collected */
413: AND mmt.transaction_date <= ((trunc(sysdate) - p_prior_days) + 0.99999)
414: AND mmt.costed_flag is null;
415:
416: if (l_debug = 'Y') then
417: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Count of consigned txns in MMT - no cost collection - is #: '||to_char(SQL%ROWCOUNT) );
418: end if;
419:
420: l_stmt_num := 35;
421:
461: OR NVL(mmt.logical_trx_type_code,5) = 4
462: );
463:
464: if (l_debug = 'Y') then
465: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Count of logical txns or retroactive price updates in MMT - no cost collection - is #: '||to_char(SQL%ROWCOUNT) );
466: end if;
467:
468:
469: l_stmt_num := 40;
621: l_stmt_num := 1;
622:
623: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
624: if (l_debug = 'Y') then
625: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: assign_groups_to_mmt_txns');
626: end if;
627:
628:
629: l_stmt_num := 10;
792: l_error_explanation := '';
793:
794: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
795: if (l_debug = 'Y') then
796: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_cc_worker_mmt ...');
797: end if;
798:
799: l_stmt_num := 10;
800:
809:
810: IF (l_count = 0)
811: THEN
812: if (l_debug = 'Y') then
813: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Transfer between same project and task.' ||
814: ' No need to collect cost');
815: end if;
816:
817: UPDATE mtl_material_transactions mmt
832: FOR cpmtv_rec IN sel_mmt_trx_to_cost(p_transaction_id,
833: p_Org_Id) LOOP
834:
835: if (l_debug = 'Y') then
836: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Processing transaction : '||to_char(p_transaction_id));
837: end if;
838:
839: savepoint pm_cc_worker_mmt;
840:
1234: l_stmt_num := 1;
1235:
1236: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
1237: if (l_debug = 'Y') then
1238: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: assign_groups_to_wt_txns ...');
1239: end if;
1240:
1241: l_stmt_num := 10;
1242:
1474: l_return_status := fnd_api.g_ret_sts_success;
1475:
1476: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
1477: if (l_debug = 'Y') then
1478: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_cc_worker_wt');
1479: end if;
1480:
1481: l_stmt_num := 10;
1482:
1482:
1483: FOR wt_rec IN sel_wt_trx_to_cost(p_transaction_id, p_Org_Id) LOOP
1484:
1485: if (l_debug = 'Y') then
1486: FND_FILE.PUT_LINE(FND_FILE.LOG,'Processing transaction : '||to_char(p_transaction_id));
1487: end if;
1488:
1489: savepoint pm_cc_worker_wt;
1490: pm_check_error_wt ( p_transaction_id,
1591: x_expenditure_type => l_expenditure_type
1592: );
1593:
1594: if (l_return_status <> fnd_api.g_ret_sts_success) then
1595: FND_FILE.put_line(FND_FILE.log, l_msg_data);
1596: l_api_message := 'get_ExpType_for_DirectItem returned unexpected error';
1597: FND_MESSAGE.set_name('BOM','CST_API_MESSAGE');
1598: FND_MESSAGE.set_token('TEXT', l_api_message);
1599: FND_MSG_pub.add;
2606:
2607:
2608: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
2609: if (l_debug = 'Y') then
2610: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_process_txn_mmt ...');
2611: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Transaction ID: '||to_char(p_transaction_id));
2612: end if;
2613:
2614:
2607:
2608: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
2609: if (l_debug = 'Y') then
2610: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_process_txn_mmt ...');
2611: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Transaction ID: '||to_char(p_transaction_id));
2612: end if;
2613:
2614:
2615:
2961:
2962: l_stmt_num := 125;
2963:
2964: if (l_debug = 'Y') then
2965: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Processing Project Miscellaneous Transactions ...');
2966: end if;
2967:
2968: FOR c_rec1 IN c_sel_std_misc LOOP
2969:
3166:
3167: l_stmt_num := 145;
3168:
3169: if (l_debug = 'Y') then
3170: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Collecting MOH costs ...');
3171: end if;
3172:
3173: FOR c_rec2 IN c_sel_moh_txn LOOP
3174:
3288: interorg transaction */
3289:
3290: If (l_earn_tomoh <> -99 AND p_transaction_id <> -99 ) then
3291:
3292: FND_FILE.PUT_LINE(FND_FILE.LOG,'Collecting the MOH absorption on the receiving side');
3293:
3294: l_rownum := 0;
3295:
3296: For c_rec9 in c_sel_tomoh LOOP
3317: where organization_id = l_org_id ;
3318:
3319: If l_blue_print_enabled_flag = 'Y' then
3320:
3321: FND_FILE.PUT_LINE(FND_FILE.LOG,'Blue print org ' || l_org_id);
3322: If l_autoaccounting_flag = 'Y' then
3323:
3324: /* BP and autoaccounting */
3325: Select pts1.transaction_source,
3603: l_stmt_num := 160;
3604:
3605:
3606: if (l_debug = 'Y') then
3607: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Collecting Project related Locator txn costs ...');
3608: end if;
3609:
3610: FOR c_rec3 IN c_sel_prj_txn LOOP
3611:
3667: l_stmt_num := 170;
3668:
3669:
3670: If c_rec3.burdened_cost = 0 then
3671: fnd_file.put_line(fnd_file.log,'Burdened cost is zero');
3672: end if;
3673:
3674: If c_rec3.burdened_cost <> 0 then
3675:
3833:
3834: l_stmt_num := 175;
3835:
3836: if (l_debug = 'Y') then
3837: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Collecting Transfer Side Locator Project costs ...');
3838: end if;
3839:
3840: FOR c_rec4 IN c_sel_toprj_txn LOOP
3841:
3922:
3923: END IF; /* check for BP org */
3924:
3925: If c_rec4.burdened_cost = 0 then
3926: fnd_file.put_line(fnd_file.log,'Burdened cost is zero');
3927: end if;
3928:
3929: If c_rec4.burdened_cost <> 0 then
3930:
4046: p_organization_id);
4047:
4048: IF (l_costed_flag = 'N') THEN
4049: if (l_debug = 'Y') then
4050: fnd_file.put_line(fnd_file.log, 'Receving Txn not yet costed!!!!');
4051: end if;
4052: RAISE ROW_NOT_COSTED;
4053: ELSE
4054:
4111:
4112: l_stmt_num := 185;
4113:
4114: if (l_debug = 'Y') then
4115: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Collecting source side project costs ...');
4116: end if;
4117:
4118: FOR c_rec5 IN c_sel_src_txn LOOP
4119:
4277: l_rownum := 0;
4278: l_stmt_num := 200;
4279:
4280: if (l_debug = 'Y') then
4281: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Collecting Borrow Payback transactions ...');
4282: end if;
4283:
4284: FOR c_rec6 IN c_sel_bp_txn LOOP
4285:
4551:
4552: l_rownum := 0;
4553:
4554: if (l_debug = 'Y') then
4555: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Collecting purchase price variances ...');
4556: FND_FILE.PUT_LINE(FND_FILE.LOG,'ppv_txfr_flag : '||ppv_txfr_flag||
4557: 'p_primary_cost_method : '||p_primary_cost_method||
4558: 'l_primary_cost_method_snd : '||l_primary_cost_method_snd||
4559: ' p_organization_id : '||p_organization_id||
4552: l_rownum := 0;
4553:
4554: if (l_debug = 'Y') then
4555: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Collecting purchase price variances ...');
4556: FND_FILE.PUT_LINE(FND_FILE.LOG,'ppv_txfr_flag : '||ppv_txfr_flag||
4557: 'p_primary_cost_method : '||p_primary_cost_method||
4558: 'l_primary_cost_method_snd : '||l_primary_cost_method_snd||
4559: ' p_organization_id : '||p_organization_id||
4560: ' p_transaction_id : '||p_transaction_id||
4993: l_stmt_num := 1;
4994:
4995: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
4996: if (l_debug = 'Y') then
4997: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_check_error_mmt');
4998: end if;
4999:
5000: IF(p_transaction_source_type_id = 5 AND p_source_project_id IS NOT NULL) THEN
5001: l_proj_job_ind := 1;
5426:
5427:
5428: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
5429: if (l_debug = 'Y') then
5430: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_mark_error_mmt');
5431: end if;
5432:
5433: l_stmt_num := 10;
5434:
5648: l_stmt_num := 1;
5649:
5650: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
5651: if (l_debug = 'Y') then
5652: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_process_txn_wt');
5653: end if;
5654:
5655: -- Initialize the batch name as CC followed by group_id
5656:
5795: * resource cost element. If there is a resource based overhead, it
5796: * should be passed with a transaction source of WIP. */
5797: If c_rec.employee_number is NOT NULL and p_cost_element_id <> 5 then
5798:
5799: fnd_file.put_line(fnd_file.log,'Setting Straight time');
5800: fnd_file.put_line(fnd_file.log,p_wip_straight_time_literal);
5801: l_transaction_source := p_wip_straight_time_literal ;
5802:
5803: /* set the sys linkage to the system linkage to which this transaction source maps to
5796: * should be passed with a transaction source of WIP. */
5797: If c_rec.employee_number is NOT NULL and p_cost_element_id <> 5 then
5798:
5799: fnd_file.put_line(fnd_file.log,'Setting Straight time');
5800: fnd_file.put_line(fnd_file.log,p_wip_straight_time_literal);
5801: l_transaction_source := p_wip_straight_time_literal ;
5802:
5803: /* set the sys linkage to the system linkage to which this transaction source maps to
5804: (usually this transaction source should map to the straight time system linkage) */
5843: from wip_transactions
5844: where transaction_id = p_transaction_id ;
5845:
5846: If l_debug = 'Y' then
5847: fnd_file.put_line(fnd_file.log,' UOM code for the WIP txn : ' || l_uom_code);
5848: fnd_file.put_line(fnd_file.log,' Quantity : ' || c_rec.quantity);
5849: fnd_file.put_line(fnd_file.log,' Raw Cost Rate : ' || l_raw_cost_rate);
5850: end If;
5851:
5844: where transaction_id = p_transaction_id ;
5845:
5846: If l_debug = 'Y' then
5847: fnd_file.put_line(fnd_file.log,' UOM code for the WIP txn : ' || l_uom_code);
5848: fnd_file.put_line(fnd_file.log,' Quantity : ' || c_rec.quantity);
5849: fnd_file.put_line(fnd_file.log,' Raw Cost Rate : ' || l_raw_cost_rate);
5850: end If;
5851:
5852: /* This following insert statement into pa_transaction_interface will be changes to insert into pa_transaction_interface_all */
5845:
5846: If l_debug = 'Y' then
5847: fnd_file.put_line(fnd_file.log,' UOM code for the WIP txn : ' || l_uom_code);
5848: fnd_file.put_line(fnd_file.log,' Quantity : ' || c_rec.quantity);
5849: fnd_file.put_line(fnd_file.log,' Raw Cost Rate : ' || l_raw_cost_rate);
5850: end If;
5851:
5852: /* This following insert statement into pa_transaction_interface will be changes to insert into pa_transaction_interface_all */
5853:
6065: l_organization_name := '';
6066:
6067: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
6068: if (l_debug = 'Y') then
6069: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_check_error_wt');
6070: end if;
6071:
6072: p_process_yn := 1; /* 1 Implies Process the Txn */
6073: --
6312: l_stmt_num := 1;
6313:
6314: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
6315: if (l_debug = 'Y') then
6316: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_mark_error_wt ' );
6317: end if;
6318:
6319:
6320: l_stmt_num := 10;
6469: l_wip_txn_source_type := '';
6470:
6471: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
6472: if (l_debug = 'Y') then
6473: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#: pm_get_mta_accts');
6474: end if;
6475:
6476: BEGIN
6477: /****** Get Transaction Information ******/
6742: l_cost_element_id := -99;
6743: l_mta_primary_quantity := -1 * l_mmt_primary_quantity;
6744: l_accounting_line_type := 5;
6745:
6746: fnd_file.put_line(fnd_file.log,'PO delivery Adjustment transaction');
6747:
6748: end if;
6749:
6750: END IF;
6749:
6750: END IF;
6751:
6752: if (l_debug = 'Y') then
6753: FND_FILE.PUT_LINE (FND_FILE.LOG,
6754: 'DEBIT DATA. Txn: '||to_char(l_mta_transaction_id)
6755: ||' Exp_Flag: '||to_char(l_exp_flag)
6756: ||' Xfer_Exp_Flag: '
6757: ||to_char(l_xfer_exp_flag)
6970: END IF; /*MAIN IF */
6971:
6972: IF (l_citw_flag <> 1) THEN
6973: IF l_debug = 'Y' THEN
6974: FND_FILE.put_line(fnd_file.log, 'CREDIT DATA: ');
6975: FND_FILE.put_line(fnd_file.log, 'Cost Element: '||to_char(l_cost_element_id) || ' Accounting Line Type: '||to_char(l_accounting_line_type)||' Primary Quantity: '||to_char(l_mta_primary_quantity));
6976: END IF;
6977: -- Bug 936641, for borrow payback variance, should NOT
6978: -- store both Cr and Dr with the same accounting information
6971:
6972: IF (l_citw_flag <> 1) THEN
6973: IF l_debug = 'Y' THEN
6974: FND_FILE.put_line(fnd_file.log, 'CREDIT DATA: ');
6975: FND_FILE.put_line(fnd_file.log, 'Cost Element: '||to_char(l_cost_element_id) || ' Accounting Line Type: '||to_char(l_accounting_line_type)||' Primary Quantity: '||to_char(l_mta_primary_quantity));
6976: END IF;
6977: -- Bug 936641, for borrow payback variance, should NOT
6978: -- store both Cr and Dr with the same accounting information
6979: -- The line 'O_cr_code_combination_id := O_dr_code_combination_id;'
7045: O_cr_code_combination_id := O_dr_code_combination_id;
7046: O_inv_cr_sub_ledger_id := O_inv_dr_sub_ledger_id;
7047:
7048: IF l_debug = 'Y' THEN
7049: FND_FILE.put_line(FND_FILE.log, 'Credit Account not found. It will be set the same as Debit account');
7050: END IF;
7051:
7052: END IF;
7053:
7260: l_cse_hook_used := 0;
7261:
7262: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
7263: if (l_debug = 'Y') then
7264: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#:pm_insert_pti_pvt');
7265: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Transaction_id :'||to_char(p_transaction_id));
7266: end if;
7267:
7268: l_stmt_num := 10;
7261:
7262: l_debug := FND_PROFILE.VALUE('MRP_DEBUG');
7263: if (l_debug = 'Y') then
7264: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Reached#:pm_insert_pti_pvt');
7265: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Transaction_id :'||to_char(p_transaction_id));
7266: end if;
7267:
7268: l_stmt_num := 10;
7269:
7430: O_err_msg => l_cse_err_msg);
7431:
7432: l_stmt_num := 40;
7433:
7434: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: CSE hook usage flag :'||to_char(l_cse_hook_used));
7435: IF (l_err_num <> 0) THEN
7436:
7437: RAISE CST_FAILED_CSE_CALL;
7438:
7507: l_hook_used ,
7508: l_err_num ,
7509: l_err_code ,
7510: l_err_msg);
7511: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: INV hook usage flag :'||to_char(l_hook_used));
7512:
7513: IF (l_err_num <> 0) THEN
7514:
7515: RAISE CST_FAILED_CST_CC_HOOK;
7547:
7548: IF (l_hook_used = 0 ) THEN
7549:
7550: if (l_debug = 'Y') then
7551: FND_FILE.PUT_LINE(FND_FILE.LOG,'DEBUG: Inserting transaction into PTI ');
7552: end if;
7553:
7554:
7555: /* The following insert statement into pa_transaction_interface will be changed to insert into pa_transaction_interface_all */
7566: where msi.inventory_item_id = p_inventory_item_id
7567: AND msi.organization_id = p_organization_id;
7568:
7569: If l_debug = 'Y' then
7570: fnd_file.put_line(fnd_file.log,'UOM code for the INV txn : ' || l_uom_code);
7571: end If;
7572:
7573:
7574: