41: CURSOR unit_price_cur (p_item_id NUMBER, p_source_organization_id NUMBER) IS
42:
43: SELECT cic.item_cost
44: FROM cst_item_costs_for_gl_view cic,
45: mtl_parameters mp
46: WHERE cic.inventory_item_id = p_item_id
47: AND cic.organization_id = mp.cost_organization_id
48: AND cic.inventory_asset_flag = 1
49: AND mp.organization_id= p_source_organization_id;
275: END;
276: END IF;
277:
278: -- If Expense Account not available in Item Master, get account
279: -- from MTL_PARAMETERS for the Destination Organization
280: IF (l_charge_account IS NULL) THEN
281: BEGIN
282: SELECT expense_account
283: INTO l_charge_account
280: IF (l_charge_account IS NULL) THEN
281: BEGIN
282: SELECT expense_account
283: INTO l_charge_account
284: FROM mtl_parameters
285: WHERE organization_id = p_destination_organization_id;
286:
287: EXCEPTION
288: WHEN OTHERS THEN
305: IF l_subinventory_type = 'X' then
306: BEGIN
307: SELECT material_account
308: INTO l_charge_account
309: FROM mtl_parameters
310: WHERE organization_id = p_destination_organization_id;
311: EXCEPTION
312: WHEN OTHERS THEN
313: l_charge_account := 1111;
326: END;
327: -- If charge account is NULL for the Subinventory, get the default account
328:
329:
330: -- for the Organization from MTL_PARAMETERS
331: IF (l_charge_account is NULL) THEN
332: BEGIN
333: SELECT expense_account
334: INTO l_charge_account
331: IF (l_charge_account is NULL) THEN
332: BEGIN
333: SELECT expense_account
334: INTO l_charge_account
335: FROM mtl_parameters
336: WHERE organization_id = p_destination_organization_id;
337: EXCEPTION
338: WHEN OTHERS THEN
339: l_charge_account := 1113;
352: l_charge_account := 1114;
353: END;
354:
355: -- If Charge_account is not availabe for the Subinventory,
356: -- get it for the Destination Organization from MTL_PARAMETERS
357: IF (l_charge_account IS NULL) THEN
358: BEGIN
359: SELECT material_account
360: INTO l_charge_account
357: IF (l_charge_account IS NULL) THEN
358: BEGIN
359: SELECT material_account
360: INTO l_charge_account
361: FROM mtl_parameters
362: WHERE organization_id = p_destination_organization_id;
363: EXCEPTION
364: WHEN OTHERS THEN
365: l_charge_account := 1115;
1073: FROM sys.dual;
1074:
1075: -- Cursor to get Accrual Account ID and Variance Account ID
1076: -- For Destination Type Code INVENTORY get accrual account id
1077: -- from MTL_PARAMETERS
1078: -- Per Requisition Import program (pocis.opc).
1079: CURSOR accrual_account_id_cur (p_destination_organization_id NUMBER) IS
1080: SELECT mp.ap_accrual_account,
1081: mp.invoice_price_var_account
1078: -- Per Requisition Import program (pocis.opc).
1079: CURSOR accrual_account_id_cur (p_destination_organization_id NUMBER) IS
1080: SELECT mp.ap_accrual_account,
1081: mp.invoice_price_var_account
1082: FROM mtl_parameters mp
1083: WHERE mp.organization_id = p_destination_organization_id;
1084:
1085: -- Get Item Category ID
1086: -- As in Requisition Import
1102:
1103: -- If encumbrance flag is 'Y' get the budget account
1104: -- For Internal Req, Destination Type Code will be INVENTORY
1105: -- Hence, it is assumed that the budget account will come
1106: -- from MTL_PARAMETERS for the Item and the Destination Organization
1107: CURSOR budget_account_cur (p_destination_organization_id NUMBER,
1108: p_item_id NUMBER) IS
1109: SELECT nvl (msi.encumbrance_account,mp.encumbrance_account)
1110: FROM mtl_system_items msi,
1107: CURSOR budget_account_cur (p_destination_organization_id NUMBER,
1108: p_item_id NUMBER) IS
1109: SELECT nvl (msi.encumbrance_account,mp.encumbrance_account)
1110: FROM mtl_system_items msi,
1111: mtl_parameters mp
1112: WHERE msi.inventory_item_id = p_item_id
1113: AND msi.organization_id = p_destination_organization_id
1114: AND mp.organization_id = msi.organization_id;
1115:
2096: Raise INVALID_CHARGE_ACCOUNT;
2097: END IF;
2098:
2099: -- Get Accrual Account ID and Variance Account ID for the
2100: --Destination Organization from MTL_PARAMETERS
2101:
2102: OPEN accrual_account_id_cur (l_header_Rec.dest_organization_id);
2103: FETCH accrual_account_id_cur
2104: INTO l_dist_rec.accrual_account_id,