142: WHERE run_id = p_run_id);
143: End If;
144:
145: IF g_debug_mode = 'Y' THEN
146: pa_debug.write_file('LOG','Inside release_capint_txns_exists['||l_exists||']');
147: End If;
148: RETURN l_exists;
149:
150: EXCEPTION
149:
150: EXCEPTION
151: WHEN NO_DATA_FOUND THEN
152: IF g_debug_mode = 'Y' THEN
153: pa_debug.write_file('LOG','Inside release_capint_txns_exists['||l_exists||']');
154: End If;
155: RETURN l_exists;
156:
157: WHEN OTHERS THEN
240: IF p_threshold_amt_type = 'BUDGET' Then
241: OPEN threshold_type;
242: FETCH threshold_type INTO cur_thres_type;
243: IF g_debug_mode = 'Y' THEN
244: PA_DEBUG.write_file('LOG','Inside get_bdgt_entry level Type['
245: ||cur_thres_type.threshold_Type||
246: ']entry method code['||cur_thres_type.budget_entry_method_code||
247: ']Bdgt Version['||cur_thres_type.budget_version_id||
248: ']');
267: CLOSE threshold_type;
268:
269: END IF;
270: IF g_debug_mode = 'Y' THEN
271: pa_debug.write_file('LOG','Budget Entry level code['||l_entry_method||']');
272: END IF;
273:
274: Return l_entry_method;
275:
725: r_task cur_non_cap_tasks%ROWTYPE;
726: **/
727: BEGIN
728: IF g_debug_mode = 'Y' THEN
729: pa_debug.write_file('LOG','Inside Check Thresholds: Budget Type['||p_budget_type||
730: ']Finplan type['||p_fin_plan_type_id||']Amt Type['||p_threshold_amt_type||
731: ']Cost Type['||p_cip_cost_type||']Duration['||x_duration_threshold||
732: ']Threshold Amt['||x_amt_threshold||']p_start_date['||p_start_date||']');
733: END IF;
749: ,x_return_status
750: ,x_error_msg_count
751: ,x_error_msg_code);
752: IF g_debug_mode = 'Y' THEN
753: pa_debug.write_file('LOG','Threshold amt from Client Extn:Amt['||x_amt_threshold||
754: ']Duration['||x_duration_threshold||']x_return_status['||x_return_status||
755: ']g_bdgt_entry_level_code['||g_bdgt_entry_level_code||']');
756: End If;
757:
793: ,p_amount_type => p_cip_cost_type)
794: ,0);
795:
796: IF g_debug_mode = 'Y' THEN
797: pa_debug.write_file('LOG','Budget/Plan amt from Finplanutils API['||ln_amount||']');
798: End If;
799:
800: /** This check is not required as the setup of budget should be ensured that
801: ** the budget is only for Capitalized projects and Tasks
1134: /* Bug fix:3051131 if there is any un-expected error encounters and If there are no trxn or exceptions
1135: * created then delete the run created in the exception portion
1136: */
1137: IF g_debug_mode = 'Y' THEN
1138: pa_debug.write_file('LOG','Inside remove_run mode = EXCEPTION');
1139: End If;
1140: IF p_run_id is NOT NULL then
1141:
1142: SELECT 'Y'
1167:
1168: EXCEPTION
1169: WHEN NO_DATA_FOUND THEN
1170: IF g_debug_mode = 'Y' THEN
1171: pa_debug.write_file('LOG',' No Trxn found, Removing the run');
1172: End If;
1173: IF l_exists = 'N' Then
1174: Delete from pa_alloc_runs_all
1175: where run_id = p_run_id;
1556: x_error_msg_code := NULL;
1557: l_init_run_id := x_run_id; -- store passed in value for when others.
1558:
1559: -- Initialize the error stack
1560: pa_debug.init_err_stack ('PA_CAP_INT_PVT.GENERATE_CAP_INTEREST');
1561:
1562: fnd_profile.get('PA_DEBUG_MODE',g_debug_mode);
1563: g_debug_mode := NVL(g_debug_mode, 'N');
1564:
1558:
1559: -- Initialize the error stack
1560: pa_debug.init_err_stack ('PA_CAP_INT_PVT.GENERATE_CAP_INTEREST');
1561:
1562: fnd_profile.get('PA_DEBUG_MODE',g_debug_mode);
1563: g_debug_mode := NVL(g_debug_mode, 'N');
1564:
1565: pa_debug.set_process
1566: (x_process => 'PLSQL'
1561:
1562: fnd_profile.get('PA_DEBUG_MODE',g_debug_mode);
1563: g_debug_mode := NVL(g_debug_mode, 'N');
1564:
1565: pa_debug.set_process
1566: (x_process => 'PLSQL'
1567: ,x_write_file => 'LOG'
1568: ,x_debug_mode => g_debug_mode);
1569:
1571: -- Clear the message stack
1572: fnd_msg_pub.initialize;
1573:
1574: If g_debug_mode = 'Y' Then
1575: pa_debug.write_file('LOG',substr('INSIDE Generate Capint API IN PARAMS: p_from_project_num ['
1576: ||p_from_project_num||']p_to_project_num['||p_to_project_num||
1577: ']p_gl_period['||p_gl_period||']p_exp_item_date['||p_exp_item_date||
1578: ']p_source_details['||p_source_details||']p_autorelease['||p_autorelease||
1579: ']p_mode['||p_mode||']x_run_id['||x_run_id||']',1,250) );
1590: -- Execution section if this is run in 'Generate' mode
1591: IF p_mode = 'G' THEN
1592:
1593: IF g_debug_mode = 'Y' THEN
1594: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||' Start program');
1595: END IF;
1596:
1597:
1598: -- Get the start and end dates for the parameter GL period
1607: ,x_error_msg_count
1608: ,x_error_msg_code);
1609:
1610: IF x_return_status = 'U' THEN
1611: pa_debug.g_err_stage := 'Get_Period_Dates for Period '||p_gl_period||
1612: ']x-errmsg['||x_error_msg_code||']';
1613: RAISE process_error;
1614: END IF;
1615:
1627: -- Set global variable for Exp Item Date
1628: g_exp_item_date := NVL(p_exp_item_date,g_period_end_date);
1629:
1630: IF g_debug_mode = 'Y' THEN
1631: pa_debug.write_file('LOG','Global Var:Currency['||lv_currency_code||']Org['||ln_org_id||
1632: ']g_gl_period['||g_gl_period||']g_period_start_date['||g_period_start_date||
1633: ']g_period_end_date['||g_period_end_date||']g_exp_item_date['||g_exp_item_date||
1634: ']');
1635: END IF;
1639: --------------------------------------
1640: FOR r_rate IN cur_rates LOOP
1641:
1642: IF g_debug_mode = 'Y' THEN
1643: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1644: ' Rate ['||r_rate.rate_name||']');
1645: END IF;
1646:
1647: -- Initialize rate process variables
1666: ln_curr_period_mult := 0;
1667: END IF;
1668:
1669: IF g_debug_mode = 'Y' THEN
1670: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1671: ' Current Period Multiplier['||TO_CHAR(ln_curr_period_mult)||']');
1672: END IF;
1673:
1674:
1679: ln_period_mult := 1/num_of_periods(ln_fiscal_year);
1680: END IF;
1681:
1682: IF g_debug_mode = 'Y' THEN
1683: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1684: ' Period Rate Multiplier['||SUBSTR(TO_CHAR(ln_period_mult),1,6)||']');
1685: END IF;
1686:
1687:
1703: ,x_error_msg_count
1704: ,x_error_msg_code);
1705:
1706: IF x_return_status = 'U' THEN
1707: pa_debug.g_err_stage := 'Write_Run for Rate['||g_rate_name||
1708: 'Error-msg['||x_error_msg_code;
1709: pa_debug.write_file('LOG',substr(pa_debug.g_err_stage,1,250));
1710: RAISE process_error;
1711: END IF;
1705:
1706: IF x_return_status = 'U' THEN
1707: pa_debug.g_err_stage := 'Write_Run for Rate['||g_rate_name||
1708: 'Error-msg['||x_error_msg_code;
1709: pa_debug.write_file('LOG',substr(pa_debug.g_err_stage,1,250));
1710: RAISE process_error;
1711: END IF;
1712:
1713: COMMIT;
1712:
1713: COMMIT;
1714:
1715: IF g_debug_mode = 'Y' THEN
1716: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1717: ' Run ID ['||TO_CHAR(ln_run_id)||']');
1718: END IF;
1719:
1720:
1725:
1726: IF R_RATE.INTEREST_SCH_ID = R_PROJECT.INTEREST_SCH_ID THEN /* Added for Bug 6757697 */
1727:
1728: IF g_debug_mode = 'Y' THEN
1729: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1730: ' Project Number ['||r_project.project_num||']' ||
1731: ' ID ['||TO_CHAR(r_project.project_id)||']');
1732: END IF;
1733:
1732: END IF;
1733:
1734:
1735: -- Acquire a lock on the project info
1736: IF pa_debug.acquire_user_lock('PA_CAP_INT_'||to_char(r_project.project_id))<>0 THEN
1737: IF g_debug_mode = 'Y' THEN
1738: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1739: ' Could not lock the project '||r_project.project_num);
1740: END IF;
1734:
1735: -- Acquire a lock on the project info
1736: IF pa_debug.acquire_user_lock('PA_CAP_INT_'||to_char(r_project.project_id))<>0 THEN
1737: IF g_debug_mode = 'Y' THEN
1738: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1739: ' Could not lock the project '||r_project.project_num);
1740: END IF;
1741:
1742: lv_bypass_project := 'Y';
1739: ' Could not lock the project '||r_project.project_num);
1740: END IF;
1741:
1742: lv_bypass_project := 'Y';
1743: pa_debug.g_err_stage := 'Lock for Project '||r_project.project_num;
1744: lv_exception_code := c_proj_lock;
1745: lv_exception_type := 'E';
1746: END IF;
1747:
1768:
1769: -- Check whether the project exists in current batches
1770: IF lv_bypass_project = 'N' AND x_return_status = 'S' THEN
1771: IF g_debug_mode = 'Y' THEN
1772: pa_debug.write_file('LOG','Check Project batch exists for the period');
1773: END IF;
1774: check_project_batches
1775: (g_project_id
1776: ,g_cap_int_rule_id
1782: ,x_return_status
1783: ,x_error_msg_count
1784: ,x_error_msg_code);
1785:
1786: pa_debug.g_err_stage := 'Check_Project_Batches for Project '||
1787: r_project.project_num;
1788: IF g_debug_mode = 'Y' THEN
1789: pa_debug.write_file('LOG','lv_bypass_project['||lv_bypass_project||
1790: ']x_return_status['||x_return_status||
1785:
1786: pa_debug.g_err_stage := 'Check_Project_Batches for Project '||
1787: r_project.project_num;
1788: IF g_debug_mode = 'Y' THEN
1789: pa_debug.write_file('LOG','lv_bypass_project['||lv_bypass_project||
1790: ']x_return_status['||x_return_status||
1791: ']x-errmsg['||x_error_msg_code||']' );
1792: END IF;
1793:
1804:
1805: -- Check whether the project has a compiled Cap Interest schedule for the exp item date
1806: IF lv_bypass_project = 'N' AND x_return_status = 'S' THEN
1807: IF g_debug_mode = 'Y' THEN
1808: pa_debug.write_file('LOG','Check Project Schedule exists for the period');
1809: END IF;
1810: check_project_schedule
1811: (r_project.interest_sch_id
1812: ,g_period_end_date
1815: ,x_return_status
1816: ,x_error_msg_count
1817: ,x_error_msg_code);
1818:
1819: pa_debug.g_err_stage := 'Check_Project_Schedule for Project '||
1820: r_project.project_num;
1821:
1822: IF g_debug_mode = 'Y' THEN
1823: pa_debug.write_file('LOG','lv_bypass_project['||lv_bypass_project||
1819: pa_debug.g_err_stage := 'Check_Project_Schedule for Project '||
1820: r_project.project_num;
1821:
1822: IF g_debug_mode = 'Y' THEN
1823: pa_debug.write_file('LOG','lv_bypass_project['||lv_bypass_project||
1824: ']x_return_status['||x_return_status||
1825: ']x-errmsg['||x_error_msg_code||']' );
1826: END IF;
1827:
1838: /* Bug fix: 3227816 Starts here */
1839: --Check if the rate name is used for this schedule
1840: IF lv_bypass_project = 'N' AND x_return_status = 'S' THEN
1841: IF g_debug_mode = 'Y' THEN
1842: pa_debug.write_file('LOG','Check Schedule has Ratename ');
1843: END IF;
1844: check_schedule_has_ratename
1845: (p_sch_id => r_project.interest_sch_id
1846: ,p_sch_rev_date => g_period_end_date
1851: ,x_error_msg_count => x_error_msg_count
1852: ,x_error_msg_code => x_error_msg_code );
1853:
1854: IF g_debug_mode = 'Y' THEN
1855: pa_debug.write_file('LOG','lv_bypass_project['||lv_bypass_project||
1856: ']x_return_status['||x_return_status||
1857: ']x-errmsg['||x_error_msg_code||']' );
1858: END IF;
1859:
1871:
1872: -- Check whether the project has met the threshold values
1873: IF lv_bypass_project = 'N' AND x_return_status = 'S' Then
1874: IF g_debug_mode = 'Y' THEN
1875: pa_debug.write_file('LOG','Check Project Thresholds');
1876: END IF;
1877:
1878: /* Bug fix:2972865 Set the Budget entry level code */
1879: g_bdgt_entry_level_code := Get_Bdgt_entry_level_code
1900: ,x_return_status
1901: ,x_error_msg_count
1902: ,x_error_msg_code);
1903:
1904: pa_debug.g_err_stage := 'Check_Thresholds for Project '||r_project.project_num;
1905: IF g_debug_mode = 'Y' THEN
1906: pa_debug.write_file('LOG','lv_bypass_project['||lv_bypass_project||
1907: ']x_return_status['||x_return_status||
1908: ']x-errmsg['||x_error_msg_code||']');
1902: ,x_error_msg_code);
1903:
1904: pa_debug.g_err_stage := 'Check_Thresholds for Project '||r_project.project_num;
1905: IF g_debug_mode = 'Y' THEN
1906: pa_debug.write_file('LOG','lv_bypass_project['||lv_bypass_project||
1907: ']x_return_status['||x_return_status||
1908: ']x-errmsg['||x_error_msg_code||']');
1909: END IF;
1910: IF x_return_status = 'U' THEN
1953: lt_process_task_flag.DELETE;
1954:
1955:
1956: IF g_debug_mode = 'Y' THEN
1957: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
1958: ' Load the CDL cursor rows');
1959: END IF;
1960:
1961:
1991: ,lt_attribute10;
1992: CLOSE cur_cdls;
1993:
1994: IF g_debug_mode = 'Y' THEN
1995: pa_debug.write_file('LOG', 'After Load the CDL cursor Number of rows['||
1996: lt_process_task_flag.count||']');
1997: END IF;
1998:
1999:
2002:
2003: lv_bypass_project := 'Y';
2004: lv_exception_code := c_proj_no_txns;
2005: lv_exception_type := 'W';
2006: pa_debug.g_err_stage := 'No CDLs for Project '||r_project.project_num;
2007:
2008:
2009: -- Otherwise, process the cdl rows for this project
2010: ELSE
2043: lv_bypass_project := 'Y';
2044: lv_exception_code := c_proj_threshold;
2045: lv_exception_type := 'W';
2046:
2047: pa_debug.g_err_stage := 'Check CIP Thresholds for Project '||
2048: r_project.project_num;
2049: END IF;
2050: END IF;
2051:
2057: -- Loop through every row and accumulate the amounts
2058: FOR i IN lt_task_id.FIRST..lt_task_id.LAST LOOP
2059:
2060: IF g_debug_mode = 'Y' THEN
2061: pa_debug.write_file('LOG','Loop index['||i||']lv_first_exp_flag['||
2062: lv_first_exp_flag||']lt_task_id['||
2063: lt_task_id(i)||']lv_bypass_task['||lv_bypass_task||']ln_curr_task_id['||
2064: ln_curr_task_id||']ln_task_tot_amt['||ln_task_tot_amt||
2065: ']lv_threshold_amt_type['||lv_threshold_amt_type||']' );
2102: ,x_error_msg_count
2103: ,x_error_msg_code);
2104:
2105: IF g_debug_mode = 'Y' THEN
2106: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2107: ||' Task '||lv_curr_task_num
2108: ||' bypassed by Actual Task Threshold');
2109: END IF;
2110:
2108: ||' bypassed by Actual Task Threshold');
2109: END IF;
2110:
2111: IF x_return_status = 'U' THEN
2112: pa_debug.g_err_stage := 'Write_Exception for Task '
2113: ||lv_curr_task_num||' in Project '
2114: ||r_project.project_num||
2115: ']x-errmsg['||x_error_msg_code||']';
2116: RAISE process_error;
2120: END IF;
2121:
2122:
2123: IF g_debug_mode = 'Y' THEN
2124: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
2125: ' Task Number ['||lt_task_num(i)||']' ||
2126: ' ID ['||TO_CHAR(lt_task_id(i))||']');
2127: END IF;
2128:
2143: -- Check whether the task has met the duration and
2144: -- budget threshold values
2145: IF lv_bypass_task = 'N' AND x_return_status = 'S' THEN
2146: IF g_debug_mode = 'Y' THEN
2147: pa_debug.write_file('LOG','Check Task Thresholds');
2148: End If;
2149: check_thresholds
2150: (g_project_id
2151: ,ln_curr_task_id
2163: ,x_return_status
2164: ,x_error_msg_count
2165: ,x_error_msg_code);
2166:
2167: pa_debug.g_err_stage := 'Check_Thresholds for Task '
2168: ||lv_curr_task_num||' in Project '||r_project.project_num;
2169: IF g_debug_mode = 'Y' THEN
2170: pa_debug.write_file('LOG','lv_bypass_task['
2171: ||lv_bypass_task||']x_return_status['
2166:
2167: pa_debug.g_err_stage := 'Check_Thresholds for Task '
2168: ||lv_curr_task_num||' in Project '||r_project.project_num;
2169: IF g_debug_mode = 'Y' THEN
2170: pa_debug.write_file('LOG','lv_bypass_task['
2171: ||lv_bypass_task||']x_return_status['
2172: ||x_return_status||
2173: ']x-errmsg['||x_error_msg_code||']');
2174: END IF;
2187:
2188: -- Get the target task
2189: IF lv_bypass_task = 'N' AND x_return_status = 'S' THEN
2190: IF g_debug_mode = 'Y' THEN
2191: pa_debug.write_file('LOG','get target Task');
2192: End If;
2193: pa_client_extn_cap_int.get_target_task
2194: (ln_curr_task_id
2195: ,lv_curr_task_num
2199: ,x_return_status
2200: ,x_error_msg_count
2201: ,x_error_msg_code);
2202:
2203: pa_debug.g_err_stage := 'Get_Target_Task for Task '
2204: ||lv_curr_task_num||' in Project '||r_project.project_num
2205: ||']x-errmsg['||x_error_msg_code||']';
2206:
2207: IF x_return_status = 'U' THEN
2219:
2220: -- Revalidate the target task
2221: IF lv_bypass_task = 'N' AND x_return_status = 'S' THEN
2222: IF g_debug_mode = 'Y' THEN
2223: pa_debug.write_file('LOG','Validate Target Task');
2224: End If;
2225: validate_task
2226: (g_project_id
2227: ,ln_target_task_id
2231: ,x_return_status
2232: ,x_error_msg_count
2233: ,x_error_msg_code);
2234:
2235: pa_debug.g_err_stage := 'Validate_Target_Task for Task '
2236: ||lv_target_task_num||' in Project '||r_project.project_num;
2237:
2238: IF g_debug_mode = 'Y' THEN
2239: pa_debug.write_file('LOG','lv_bypass_task['
2235: pa_debug.g_err_stage := 'Validate_Target_Task for Task '
2236: ||lv_target_task_num||' in Project '||r_project.project_num;
2237:
2238: IF g_debug_mode = 'Y' THEN
2239: pa_debug.write_file('LOG','lv_bypass_task['
2240: ||lv_bypass_task||']x_return_status['
2241: ||x_return_status||
2242: ']x-errmsg['||x_error_msg_code||']');
2243: END IF;
2256:
2257: -- Get the rate multiplier if source specified is task owning org
2258: IF lv_bypass_task = 'N' AND x_return_status = 'S' THEN
2259: IF g_debug_mode = 'Y' THEN
2260: pa_debug.write_file('LOG','Calling get_rate_multiplier');
2261: End If;
2262: get_rate_multiplier
2263: (g_rate_name
2264: ,ln_sched_version_id
2268: ,x_return_status
2269: ,x_error_msg_count
2270: ,x_error_msg_code);
2271:
2272: pa_debug.g_err_stage := 'Get_Rate_Multiplier for Rate '
2273: ||g_rate_name||' and Task '||lv_curr_task_num
2274: ||' in Project['||r_project.project_num
2275: ||']x-errmsg['||x_error_msg_code||']';
2276:
2290:
2291: IF lv_bypass_task = 'Y' THEN
2292:
2293: IF g_debug_mode = 'Y' THEN
2294: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
2295: ' Task bypassed by '||pa_debug.g_err_stage);
2296: END IF;
2297:
2298: -- Write the exception for the task if appropriate
2291: IF lv_bypass_task = 'Y' THEN
2292:
2293: IF g_debug_mode = 'Y' THEN
2294: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
2295: ' Task bypassed by '||pa_debug.g_err_stage);
2296: END IF;
2297:
2298: -- Write the exception for the task if appropriate
2299: write_exception
2307: ,x_error_msg_count
2308: ,x_error_msg_code);
2309:
2310: IF x_return_status = 'U' THEN
2311: pa_debug.g_err_stage := 'Write_Exception for Task '
2312: ||lv_curr_task_num||' in Project['
2313: ||r_project.project_num
2314: ||']x-errmsg['||x_error_msg_code||']';
2315: RAISE process_error;
2373: ,2);
2374:
2375: -- Perform a custom calculation if desired
2376: IF g_debug_mode = 'Y' THEN
2377: pa_debug.write_file('LOG','Calling Client Extn calculate_capInt');
2378: End if;
2379: pa_client_extn_cap_int.calculate_cap_interest
2380: (g_gl_period
2381: ,g_rate_name
2396: ,x_error_msg_code);
2397:
2398: -- Check the results of the custom calculation
2399: IF x_return_status = 'U' THEN
2400: pa_debug.g_err_stage := 'Calculate_Cap_Interest client extension x-errmsg['||x_error_msg_code||']';
2401: RAISE process_error;
2402: END IF;
2403:
2404:
2432:
2433:
2434: -- Check the results of the attribute retrieval
2435: IF x_return_status = 'U' THEN
2436: pa_debug.g_err_stage :=
2437: 'Get_Txn_Attributes client extension'||
2438: ']x-errmsg['||x_error_msg_code||']';
2439: RAISE process_error;
2440: END IF;
2452: WHEN OTHERS THEN
2453: x_return_status := 'U';
2454: x_error_msg_count := 1;
2455: x_error_msg_code := SQLERRM;
2456: pa_debug.g_err_stage := 'Get Alloc Txn ID'||
2457: ']x-errmsg['||x_error_msg_code||']';
2458: RAISE process_error;
2459: END;
2460:
2491: - lt_curr_period_amt(j);
2492: END LOOP;
2493:
2494: IF g_debug_mode = 'Y' THEN
2495: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2496: ||' Task '||lv_curr_task_num
2497: ||' bypassed by Actual Task Threshold');
2498: END IF;
2499:
2509: ,x_error_msg_count
2510: ,x_error_msg_code);
2511:
2512: IF x_return_status = 'U' THEN
2513: pa_debug.g_err_stage := 'Write_Exception for Task '
2514: ||lv_curr_task_num||' in Project '||r_project.project_num||
2515: ']x-errmsg['||x_error_msg_code||']';
2516: RAISE process_error;
2517: END IF;
2531: -- Bulk load the appropriate interest transactions from the current project
2532: ---------------------------------------------------------------------------
2533: IF ln_proj_trans_count > 0 THEN
2534: IF g_debug_mode = 'Y' THEN
2535: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
2536: ' Create the Interest Transactions');
2537: END IF;
2538:
2539: BEGIN
2537: END IF;
2538:
2539: BEGIN
2540: IF g_debug_mode = 'Y' THEN
2541: pa_debug.write_file('LOG','Insert pa_alloc_txn_details');
2542: pa_debug.write_file('LOG','Task_count'||lt_task_id.count||
2543: ']alloctxnid_count ['||lt_alloc_txn_id.count||
2544: ']target_task_count['||lt_target_task_id.count||
2545: ']capintamtcount[' ||lt_cap_int_amt.count||
2538:
2539: BEGIN
2540: IF g_debug_mode = 'Y' THEN
2541: pa_debug.write_file('LOG','Insert pa_alloc_txn_details');
2542: pa_debug.write_file('LOG','Task_count'||lt_task_id.count||
2543: ']alloctxnid_count ['||lt_alloc_txn_id.count||
2544: ']target_task_count['||lt_target_task_id.count||
2545: ']capintamtcount[' ||lt_cap_int_amt.count||
2546: ']lt taskid count[' ||lt_task_id.count||
2644: WHEN OTHERS THEN
2645: x_return_status := 'U';
2646: x_error_msg_count := 1;
2647: x_error_msg_code := SQLERRM;
2648: pa_debug.g_err_stage :=
2649: 'Insert Interest Transactions for Project '
2650: ||r_project.project_num||']x-errMsg['||x_error_msg_code
2651: ||']' ;
2652: RAISE process_error;
2657: -- Bulk load the associated source detail if requested
2658: ------------------------------------------------------
2659: IF p_source_details = 'Y' THEN
2660: IF g_debug_mode = 'Y' THEN
2661: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||
2662: ' Create the Source Details');
2663: END IF;
2664:
2665: BEGIN
2726: WHEN OTHERS THEN
2727: x_return_status := 'U';
2728: x_error_msg_count := 1;
2729: x_error_msg_code := SQLERRM;
2730: pa_debug.g_err_stage :=
2731: 'Insert Source Details for Project'||r_project.project_num||
2732: ']x-errMsg['||x_error_msg_code||']';
2733: RAISE process_error;
2734: END;
2757: ,x_error_msg_count
2758: ,x_error_msg_code);
2759:
2760: IF g_debug_mode = 'Y' THEN
2761: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2762: ||' Project bypassed by '||pa_debug.g_err_stage);
2763: END IF;
2764:
2765: IF x_return_status = 'U' THEN
2758: ,x_error_msg_code);
2759:
2760: IF g_debug_mode = 'Y' THEN
2761: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2762: ||' Project bypassed by '||pa_debug.g_err_stage);
2763: END IF;
2764:
2765: IF x_return_status = 'U' THEN
2766: pa_debug.g_err_stage := 'Write_Exception for Project '||r_project.project_num
2762: ||' Project bypassed by '||pa_debug.g_err_stage);
2763: END IF;
2764:
2765: IF x_return_status = 'U' THEN
2766: pa_debug.g_err_stage := 'Write_Exception for Project '||r_project.project_num
2767: ||']x-errMsg['||x_error_msg_code||']';
2768: RAISE process_error;
2769: END IF;
2770:
2782: ln_warning_written := ln_warning_written + ln_proj_warning_count;
2783:
2784:
2785: IF g_debug_mode = 'Y' THEN
2786: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2787: ||' Num of Trans '||TO_CHAR(ln_proj_trans_count));
2788: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2789: ||' Num of Details is '||TO_CHAR(ln_proj_detail_count));
2790: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2784:
2785: IF g_debug_mode = 'Y' THEN
2786: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2787: ||' Num of Trans '||TO_CHAR(ln_proj_trans_count));
2788: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2789: ||' Num of Details is '||TO_CHAR(ln_proj_detail_count));
2790: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2791: ||' Num of Errors '||TO_CHAR(ln_proj_error_count));
2792: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2786: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2787: ||' Num of Trans '||TO_CHAR(ln_proj_trans_count));
2788: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2789: ||' Num of Details is '||TO_CHAR(ln_proj_detail_count));
2790: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2791: ||' Num of Errors '||TO_CHAR(ln_proj_error_count));
2792: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2793: ||' Num of Warnings '||TO_CHAR(ln_proj_warning_count));
2794: END IF;
2788: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2789: ||' Num of Details is '||TO_CHAR(ln_proj_detail_count));
2790: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2791: ||' Num of Errors '||TO_CHAR(ln_proj_error_count));
2792: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
2793: ||' Num of Warnings '||TO_CHAR(ln_proj_warning_count));
2794: END IF;
2795:
2796:
2794: END IF;
2795:
2796:
2797: -- Release the project lock
2798: IF pa_debug.release_user_lock('PA_CAP_INT_'||to_char(r_project.project_id)) < 0 THEN
2799: pa_debug.g_err_stage := 'Lock Release for Project '||r_project.project_num;
2800: x_return_status := 'U';
2801: x_error_msg_count := 1;
2802: x_error_msg_code := NVL(fnd_message.get_string('PA', 'PA_CAP_CANNOT_RELS_LOCK'),
2795:
2796:
2797: -- Release the project lock
2798: IF pa_debug.release_user_lock('PA_CAP_INT_'||to_char(r_project.project_id)) < 0 THEN
2799: pa_debug.g_err_stage := 'Lock Release for Project '||r_project.project_num;
2800: x_return_status := 'U';
2801: x_error_msg_count := 1;
2802: x_error_msg_code := NVL(fnd_message.get_string('PA', 'PA_CAP_CANNOT_RELS_LOCK'),
2803: 'PA_CAP_CANNOT_RELS_LOCK');
2824: ,x_error_msg_count
2825: ,x_error_msg_code);
2826:
2827: IF x_return_status <> 'S' THEN
2828: pa_debug.g_err_stage := 'Remove_Run for Rate '||g_rate_name||
2829: ']x-errMsg['||x_error_msg_code||']';
2830: RAISE process_error;
2831: END IF;
2832:
2856: WHEN OTHERS THEN
2857: x_return_status := 'U';
2858: x_error_msg_count := 1;
2859: x_error_msg_code := SQLERRM;
2860: pa_debug.g_err_stage := 'Updating Total Trans Amt for Rate '
2861: ||g_rate_name||']x-errMsg['||x_error_msg_code||']';
2862: RAISE process_error;
2863: END;
2864:
2868: * no successful transactions exists in pa_alloc_txn_details table
2869: */
2870: IF release_capint_txns_exists(ln_run_id) = 'Y' THEN
2871: IF g_debug_mode = 'Y' THEN
2872: pa_debug.write_file('LOG','Calling pa_alloc_run.release_capint_txns API');
2873: End If;
2874:
2875: pa_alloc_run.release_capint_txns
2876: (ln_run_id
2878: ,x_error_msg_count
2879: ,x_error_msg_code);
2880:
2881: IF x_return_status = 'U' THEN
2882: pa_debug.g_err_stage := 'Release_Alloc_Txns for Rate '||g_rate_name||
2883: ']x-errMsg['||x_error_msg_code||']';
2884: RAISE process_error;
2885: END IF;
2886: END IF; -- End of txn_exists
2888: END IF; -- end of successful run
2889: END LOOP; -- rate
2890:
2891: IF g_debug_mode = 'Y' THEN
2892: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||' End program');
2893: END IF;
2894:
2895: -- Execution section if called from the form button in 'Release' mode
2896: ELSE
2899: * no successful transactions exists in pa_alloc_txn_details table
2900: */
2901: IF release_capint_txns_exists(x_run_id) = 'Y' THEN
2902: IF g_debug_mode = 'Y' THEN
2903: pa_debug.write_file('LOG','Calling pa_alloc_run.release_capint_txns API');
2904: End If;
2905:
2906: pa_alloc_run.release_capint_txns
2907: (x_run_id
2909: ,x_error_msg_count
2910: ,x_error_msg_code);
2911:
2912: IF x_return_status = 'U' THEN
2913: pa_debug.g_err_stage := 'Release_Alloc_Txns for Run ID '||TO_CHAR(x_run_id)||
2914: ']x-errMsg['||x_error_msg_code||']';
2915: RAISE process_error;
2916: END IF;
2917: END IF ; -- end of txns_exists
2916: END IF;
2917: END IF ; -- end of txns_exists
2918: END IF;
2919:
2920: pa_debug.reset_err_stack;
2921: EXCEPTION
2922: WHEN process_error THEN
2923: pa_debug.write_file('LOG',substr('EXCEPTION:'||pa_debug.g_err_stage||'X-errMsg['||
2924: x_error_msg_code||']X-retStats['||x_return_status||']'||sqlcode||sqlerrm,1,500));
2919:
2920: pa_debug.reset_err_stack;
2921: EXCEPTION
2922: WHEN process_error THEN
2923: pa_debug.write_file('LOG',substr('EXCEPTION:'||pa_debug.g_err_stage||'X-errMsg['||
2924: x_error_msg_code||']X-retStats['||x_return_status||']'||sqlcode||sqlerrm,1,500));
2925: ROLLBACK; -- Added here as the releasing dbms lock always causes commit
2926: IF p_mode = 'G' and ln_run_id is NOT NULL Then
2927: remove_run
2931: ,x_error_msg_count
2932: ,x_error_msg_code);
2933: End If;
2934: IF p_mode = 'G' and g_project_id is not NULL then
2935: v_success_flag :=pa_debug.release_user_lock('PA_CAP_INT_'||to_char(g_project_id));
2936: End If;
2937:
2938: pa_debug.reset_err_stack;
2939: RAISE;
2934: IF p_mode = 'G' and g_project_id is not NULL then
2935: v_success_flag :=pa_debug.release_user_lock('PA_CAP_INT_'||to_char(g_project_id));
2936: End If;
2937:
2938: pa_debug.reset_err_stack;
2939: RAISE;
2940: -- R12 NOCOPY mandate - adding when others for param x_run_id
2941: WHEN OTHERS THEN
2942: pa_debug.write_file('LOG',substr('EXCEPTION:' || sqlcode
2938: pa_debug.reset_err_stack;
2939: RAISE;
2940: -- R12 NOCOPY mandate - adding when others for param x_run_id
2941: WHEN OTHERS THEN
2942: pa_debug.write_file('LOG',substr('EXCEPTION:' || sqlcode
2943: ||sqlerrm,1,500));
2944: ROLLBACK; -- Added here as the releasing dbms lock always causes commit
2945: x_return_status := 'U';
2946: x_error_msg_count := x_error_msg_count + 1;
2988: x_error_msg_code := NULL;
2989:
2990:
2991: -- Initialize the error stack
2992: pa_debug.init_err_stack ('PA_CAP_INT_PVT.GENERATE_CAP_INTEREST');
2993:
2994: fnd_profile.get('PA_DEBUG_MODE',g_debug_mode);
2995: g_debug_mode := NVL(g_debug_mode, 'N');
2996:
2990:
2991: -- Initialize the error stack
2992: pa_debug.init_err_stack ('PA_CAP_INT_PVT.GENERATE_CAP_INTEREST');
2993:
2994: fnd_profile.get('PA_DEBUG_MODE',g_debug_mode);
2995: g_debug_mode := NVL(g_debug_mode, 'N');
2996:
2997: pa_debug.set_process
2998: (x_process => 'PLSQL'
2993:
2994: fnd_profile.get('PA_DEBUG_MODE',g_debug_mode);
2995: g_debug_mode := NVL(g_debug_mode, 'N');
2996:
2997: pa_debug.set_process
2998: (x_process => 'PLSQL'
2999: ,x_write_file => 'LOG'
3000: ,x_debug_mode => g_debug_mode);
3001:
3012: g_request_id := fnd_global.conc_request_id;
3013:
3014:
3015: IF g_debug_mode = 'Y' THEN
3016: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:') ||' Start program');
3017: END IF;
3018:
3019:
3020: -- Get information for the parameter GL period
3029: ,x_error_msg_count
3030: ,x_error_msg_code);
3031:
3032: IF x_return_status = 'U' THEN
3033: pa_debug.g_err_stage := 'Get_Period_Dates for Period '||p_gl_period;
3034: RAISE process_error;
3035: END IF;
3036:
3037:
3053:
3054: COMMIT;
3055:
3056: IF g_debug_mode = 'Y' THEN
3057: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
3058: ||' Rows deleted ['||TO_CHAR(ln_rows_deleted)||']');
3059: END IF;
3060: EXCEPTION
3061: WHEN NO_DATA_FOUND THEN
3063: WHEN OTHERS THEN
3064: x_return_status := 'U';
3065: x_error_msg_count := 1;
3066: x_error_msg_code := SQLERRM;
3067: pa_debug.g_err_stage := 'Delete_Source_Detail x-errMsg['||x_error_msg_code||']';
3068: RAISE process_error;
3069: END;
3070:
3071:
3078: END LOOP;
3079:
3080:
3081: IF g_debug_mode = 'Y' THEN
3082: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
3083: ||' Total Rows deleted ['||TO_CHAR(ln_tot_rows_deleted)||']');
3084: END IF;
3085:
3086: pa_debug.reset_err_stack;
3082: pa_debug.write_file('LOG', TO_CHAR(SYSDATE,'HH24:MI:SS:')
3083: ||' Total Rows deleted ['||TO_CHAR(ln_tot_rows_deleted)||']');
3084: END IF;
3085:
3086: pa_debug.reset_err_stack;
3087: EXCEPTION
3088: WHEN process_error THEN
3089: pa_debug.write_file('LOG',substr('EXCEPTION IN PURGE_SOURCE_DETAIL:'||x_error_msg_code,1,500));
3090: pa_debug.reset_err_stack;
3085:
3086: pa_debug.reset_err_stack;
3087: EXCEPTION
3088: WHEN process_error THEN
3089: pa_debug.write_file('LOG',substr('EXCEPTION IN PURGE_SOURCE_DETAIL:'||x_error_msg_code,1,500));
3090: pa_debug.reset_err_stack;
3091: RAISE;
3092: END;
3093:
3086: pa_debug.reset_err_stack;
3087: EXCEPTION
3088: WHEN process_error THEN
3089: pa_debug.write_file('LOG',substr('EXCEPTION IN PURGE_SOURCE_DETAIL:'||x_error_msg_code,1,500));
3090: pa_debug.reset_err_stack;
3091: RAISE;
3092: END;
3093:
3094: