1: package body PA_BUDGET_PUB as
2: --$Header: PAPMBUPB.pls 120.26.12010000.3 2008/09/09 22:50:47 snizam ship $
3:
4: --package global to be used during updates
5: G_USER_ID CONSTANT NUMBER := FND_GLOBAL.user_id;
6: G_LOGIN_ID CONSTANT NUMBER := FND_GLOBAL.login_id;
7: l_pm_product_code VARCHAR2(2) :='Z'; /*for bug 2413400 a new variable defined.*/
8:
9: -- Bug Fix: 4569365. Removed MRC code.
2: --$Header: PAPMBUPB.pls 120.26.12010000.3 2008/09/09 22:50:47 snizam ship $
3:
4: --package global to be used during updates
5: G_USER_ID CONSTANT NUMBER := FND_GLOBAL.user_id;
6: G_LOGIN_ID CONSTANT NUMBER := FND_GLOBAL.login_id;
7: l_pm_product_code VARCHAR2(2) :='Z'; /*for bug 2413400 a new variable defined.*/
8:
9: -- Bug Fix: 4569365. Removed MRC code.
10: -- g_mrc_exception EXCEPTION; /* FPB2 */
490: ELSE
491: l_project_id := p_pa_project_id;
492: END IF;
493: --Get the user id and responsibility Ids
494: l_user_id := FND_GLOBAL.User_id;
495: l_resp_id := FND_GLOBAL.Resp_id;
496:
497: -- This api will initialize the data that will be used by the map_new_amg_msg.
498: -- Commented out the procedure call as required by Venkatesh. 25-APR-03
491: l_project_id := p_pa_project_id;
492: END IF;
493: --Get the user id and responsibility Ids
494: l_user_id := FND_GLOBAL.User_id;
495: l_resp_id := FND_GLOBAL.Resp_id;
496:
497: -- This api will initialize the data that will be used by the map_new_amg_msg.
498: -- Commented out the procedure call as required by Venkatesh. 25-APR-03
499: /*
3451:
3452: END IF;
3453:
3454: --Get the user id and responsibility Ids
3455: l_user_id := FND_GLOBAL.User_id;
3456: l_resp_id := FND_GLOBAL.Resp_id;
3457:
3458:
3459: -- This api will initialize the data that will be used by the map_new_amg_msg.
3452: END IF;
3453:
3454: --Get the user id and responsibility Ids
3455: l_user_id := FND_GLOBAL.User_id;
3456: l_resp_id := FND_GLOBAL.Resp_id;
3457:
3458:
3459: -- This api will initialize the data that will be used by the map_new_amg_msg.
3460: -- commented out the procedure call as required by venkatesh. 25-APR-03
5761: PA_FIN_PLAN_PVT.lock_unlock_version
5762: ( p_budget_version_id => l_budget_version_id
5763: ,p_record_version_number => l_record_version_number
5764: ,p_action => 'L'
5765: ,p_user_id => FND_GLOBAL.User_id
5766: ,p_person_id => null
5767: ,x_return_status => p_return_status
5768: ,x_msg_count => p_msg_count
5769: ,x_msg_data => p_msg_data);
5805: PA_FIN_PLAN_PVT.lock_unlock_version
5806: ( p_budget_version_id => l_budget_version_id
5807: ,p_record_version_number => l_record_version_number
5808: ,p_action => 'U'
5809: ,p_user_id => FND_GLOBAL.User_id
5810: ,p_person_id => null
5811: ,x_return_status => p_return_status
5812: ,x_msg_count => p_msg_count
5813: ,x_msg_data => p_msg_data);
6127: FND_MSG_PUB.initialize;
6128:
6129: END IF;
6130: -- This api will initialize the data that will be used by the map_new_amg_msg.
6131: l_resp_id := FND_GLOBAL.Resp_id;
6132: l_user_id := FND_GLOBAL.User_id;
6133:
6134: -- Added Logic by Xin Liu to handle MISS vars based on Manoj's code review.
6135: -- 28-APR-03
6128:
6129: END IF;
6130: -- This api will initialize the data that will be used by the map_new_amg_msg.
6131: l_resp_id := FND_GLOBAL.Resp_id;
6132: l_user_id := FND_GLOBAL.User_id;
6133:
6134: -- Added Logic by Xin Liu to handle MISS vars based on Manoj's code review.
6135: -- 28-APR-03
6136: IF p_fin_plan_type_id = PA_INTERFACE_UTILS_PUB.G_PA_MISS_NUM THEN
6791: UPDATE pa_proj_fp_options
6792: SET gen_src_cost_plan_version_id = NULL,
6793: record_version_number = record_version_number + 1,
6794: last_update_date = SYSDATE,
6795: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6796: last_update_login = FND_GLOBAL.LOGIN_ID
6797: WHERE project_id = l_project_id
6798: AND gen_src_cost_plan_version_id = l_budget_version_id;
6799: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_REVENUE
6792: SET gen_src_cost_plan_version_id = NULL,
6793: record_version_number = record_version_number + 1,
6794: last_update_date = SYSDATE,
6795: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6796: last_update_login = FND_GLOBAL.LOGIN_ID
6797: WHERE project_id = l_project_id
6798: AND gen_src_cost_plan_version_id = l_budget_version_id;
6799: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_REVENUE
6800: THEN
6801: UPDATE pa_proj_fp_options
6802: SET gen_src_rev_plan_version_id = NULL,
6803: record_version_number = record_version_number + 1,
6804: last_update_date = SYSDATE,
6805: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6806: last_update_login = FND_GLOBAL.LOGIN_ID
6807: WHERE project_id = l_project_id
6808: AND gen_src_rev_plan_version_id = l_budget_version_id;
6809: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_ALL
6802: SET gen_src_rev_plan_version_id = NULL,
6803: record_version_number = record_version_number + 1,
6804: last_update_date = SYSDATE,
6805: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6806: last_update_login = FND_GLOBAL.LOGIN_ID
6807: WHERE project_id = l_project_id
6808: AND gen_src_rev_plan_version_id = l_budget_version_id;
6809: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_ALL
6810: THEN
6811: UPDATE pa_proj_fp_options
6812: SET gen_src_all_plan_version_id = NULL,
6813: record_version_number = record_version_number + 1,
6814: last_update_date = SYSDATE,
6815: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6816: last_update_login = FND_GLOBAL.LOGIN_ID
6817: WHERE project_id = l_project_id
6818: AND gen_src_all_plan_version_id = l_budget_version_id;
6819: END IF;
6812: SET gen_src_all_plan_version_id = NULL,
6813: record_version_number = record_version_number + 1,
6814: last_update_date = SYSDATE,
6815: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6816: last_update_login = FND_GLOBAL.LOGIN_ID
6817: WHERE project_id = l_project_id
6818: AND gen_src_all_plan_version_id = l_budget_version_id;
6819: END IF;
6820:
6824: IF SQL%ROWCOUNT > 0 THEN
6825: UPDATE pa_budget_versions
6826: SET record_version_number = record_version_number + 1,
6827: last_update_date = SYSDATE,
6828: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6829: last_update_login = FND_GLOBAL.LOGIN_ID
6830: WHERE project_id = l_project_id
6831: AND budget_version_id = l_budget_version_id;
6832: END IF;
6825: UPDATE pa_budget_versions
6826: SET record_version_number = record_version_number + 1,
6827: last_update_date = SYSDATE,
6828: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
6829: last_update_login = FND_GLOBAL.LOGIN_ID
6830: WHERE project_id = l_project_id
6831: AND budget_version_id = l_budget_version_id;
6832: END IF;
6833:
7702: UPDATE pa_proj_fp_options
7703: SET gen_src_cost_plan_version_id = NULL,
7704: record_version_number = record_version_number + 1,
7705: last_update_date = SYSDATE,
7706: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7707: last_update_login = FND_GLOBAL.LOGIN_ID
7708: WHERE project_id = l_project_id
7709: AND gen_src_cost_plan_version_id = l_budget_version_id;
7710: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_REVENUE
7703: SET gen_src_cost_plan_version_id = NULL,
7704: record_version_number = record_version_number + 1,
7705: last_update_date = SYSDATE,
7706: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7707: last_update_login = FND_GLOBAL.LOGIN_ID
7708: WHERE project_id = l_project_id
7709: AND gen_src_cost_plan_version_id = l_budget_version_id;
7710: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_REVENUE
7711: THEN
7712: UPDATE pa_proj_fp_options
7713: SET gen_src_rev_plan_version_id = NULL,
7714: record_version_number = record_version_number + 1,
7715: last_update_date = SYSDATE,
7716: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7717: last_update_login = FND_GLOBAL.LOGIN_ID
7718: WHERE project_id = l_project_id
7719: AND gen_src_rev_plan_version_id = l_budget_version_id;
7720: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_ALL
7713: SET gen_src_rev_plan_version_id = NULL,
7714: record_version_number = record_version_number + 1,
7715: last_update_date = SYSDATE,
7716: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7717: last_update_login = FND_GLOBAL.LOGIN_ID
7718: WHERE project_id = l_project_id
7719: AND gen_src_rev_plan_version_id = l_budget_version_id;
7720: ELSIF l_version_type = PA_FP_CONSTANTS_PKG.G_VERSION_TYPE_ALL
7721: THEN
7722: UPDATE pa_proj_fp_options
7723: SET gen_src_all_plan_version_id = NULL,
7724: record_version_number = record_version_number + 1,
7725: last_update_date = SYSDATE,
7726: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7727: last_update_login = FND_GLOBAL.LOGIN_ID
7728: WHERE project_id = l_project_id
7729: AND gen_src_all_plan_version_id = l_budget_version_id;
7730: END IF;
7723: SET gen_src_all_plan_version_id = NULL,
7724: record_version_number = record_version_number + 1,
7725: last_update_date = SYSDATE,
7726: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7727: last_update_login = FND_GLOBAL.LOGIN_ID
7728: WHERE project_id = l_project_id
7729: AND gen_src_all_plan_version_id = l_budget_version_id;
7730: END IF;
7731:
7735: IF SQL%ROWCOUNT > 0 THEN
7736: UPDATE pa_budget_versions
7737: SET record_version_number = record_version_number + 1,
7738: last_update_date = SYSDATE,
7739: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7740: last_update_login = FND_GLOBAL.LOGIN_ID
7741: WHERE project_id = l_project_id
7742: AND budget_version_id = l_budget_version_id;
7743: END IF;
7736: UPDATE pa_budget_versions
7737: SET record_version_number = record_version_number + 1,
7738: last_update_date = SYSDATE,
7739: last_updated_by = to_number(nvl(fnd_profile.value('USER_ID'),fnd_global.user_id)),
7740: last_update_login = FND_GLOBAL.LOGIN_ID
7741: WHERE project_id = l_project_id
7742: AND budget_version_id = l_budget_version_id;
7743: END IF;
7744:
8725: PA_FIN_PLAN_PVT.lock_unlock_version
8726: ( p_budget_version_id => l_budget_version_id
8727: ,p_record_version_number => l_record_version_number
8728: ,p_action => 'L'
8729: ,p_user_id => FND_GLOBAL.User_id
8730: ,p_person_id => null
8731: ,x_return_status => p_return_status
8732: ,x_msg_count => p_msg_count
8733: ,x_msg_data => p_msg_data);
8795: PA_FIN_PLAN_PVT.lock_unlock_version
8796: ( p_budget_version_id => l_budget_version_id
8797: ,p_record_version_number => l_record_version_number
8798: ,p_action => 'U'
8799: ,p_user_id => FND_GLOBAL.User_id
8800: ,p_person_id => null
8801: ,x_return_status => p_return_status
8802: ,x_msg_count => p_msg_count
8803: ,x_msg_data => p_msg_data);
9587: lx_burden_rate_flag := p_burden_rate_flag ;
9588: END IF;
9589: /*Checks End for Plan Amount Entry Flags for bug 6408139*/
9590:
9591: l_user_id := FND_GLOBAL.User_id;
9592:
9593: /* The G_MISS_XXX/null handling for these variables below has been deleted from the existing code in update_budget
9594: . This handling would be done in validate_header_info now */
9595: l_project_id := p_pa_project_id;
13838: PA_FIN_PLAN_PVT.lock_unlock_version
13839: ( p_budget_version_id => l_budget_version_id
13840: ,p_record_version_number => l_record_version_number
13841: ,p_action => 'L'
13842: ,p_user_id => FND_GLOBAL.User_id
13843: ,p_person_id => null
13844: ,x_return_status => p_return_status
13845: ,x_msg_count => p_msg_count
13846: ,x_msg_data => p_msg_data);
13882: PA_FIN_PLAN_PVT.lock_unlock_version
13883: ( p_budget_version_id => l_budget_version_id
13884: ,p_record_version_number => l_record_version_number
13885: ,p_action => 'U'
13886: ,p_user_id => FND_GLOBAL.User_id
13887: ,p_person_id => null
13888: ,x_return_status => p_return_status
13889: ,x_msg_count => p_msg_count
13890: ,x_msg_data => p_msg_data);
14438: p_return_status := FND_API.G_RET_STS_ERROR;
14439: RAISE FND_API.G_EXC_ERROR;
14440: END IF;
14441:
14442: l_resp_id := FND_GLOBAL.Resp_id;
14443: l_user_id := FND_GLOBAL.User_id;
14444: -- l_module_name := 'PA_FP_MAINTAIN_GENERATED_PLAN'; -- 'PA_PM_UPDATE_BUDGET_LINE';
14445:
14446: -- Bug 2863564
14439: RAISE FND_API.G_EXC_ERROR;
14440: END IF;
14441:
14442: l_resp_id := FND_GLOBAL.Resp_id;
14443: l_user_id := FND_GLOBAL.User_id;
14444: -- l_module_name := 'PA_FP_MAINTAIN_GENERATED_PLAN'; -- 'PA_PM_UPDATE_BUDGET_LINE';
14445:
14446: -- Bug 2863564
14447: -- The code below commented out as all the security checks are shifted to a common API
14446: -- Bug 2863564
14447: -- The code below commented out as all the security checks are shifted to a common API
14448: /*
14449: IF p_update_db_flag = 'Y' THEN
14450: l_resp_id := FND_GLOBAL.Resp_id;
14451: l_user_id := FND_GLOBAL.User_id;
14452: --l_module_name := p_pm_product_code||'.'||'PA_PM_UPDATE_BUDGET_LINE';
14453: l_module_name := 'PA_PM_UPDATE_BUDGET_LINE';
14454:
14447: -- The code below commented out as all the security checks are shifted to a common API
14448: /*
14449: IF p_update_db_flag = 'Y' THEN
14450: l_resp_id := FND_GLOBAL.Resp_id;
14451: l_user_id := FND_GLOBAL.User_id;
14452: --l_module_name := p_pm_product_code||'.'||'PA_PM_UPDATE_BUDGET_LINE';
14453: l_module_name := 'PA_PM_UPDATE_BUDGET_LINE';
14454:
14455: -- As part of enforcing project security, which would determine
15445: PA_FIN_PLAN_PVT.LOCK_UNLOCK_VERSION
15446: ( p_budget_version_id => l_budget_version_id
15447: ,p_record_version_number => l_record_version_number
15448: ,p_action => 'L'
15449: ,p_user_id => FND_GLOBAL.User_id
15450: ,p_person_id => NULL
15451: ,x_return_status => p_return_status
15452: ,x_msg_count => p_msg_count
15453: ,x_msg_data => p_msg_data);
16509: PA_FIN_PLAN_PVT.LOCK_UNLOCK_VERSION
16510: ( p_budget_version_id => l_budget_version_id
16511: ,p_record_version_number => l_record_version_number
16512: ,p_action => 'U'
16513: ,p_user_id => FND_GLOBAL.User_id
16514: ,p_person_id => NULL
16515: ,x_return_status => p_return_status
16516: ,x_msg_count => p_msg_count
16517: ,x_msg_data => p_msg_data);
17608: END IF;
17609:
17610:
17611:
17612: l_user_id := FND_GLOBAL.User_id;
17613:
17614: pa_budget_pvt.Validate_Header_Info
17615: ( p_api_version_number => p_api_version_number
17616: ,p_budget_version_name => p_budget_version_name
17685: IF nvl(p_replace_current_working_flag,'N')= 'Y' THEN
17686:
17687: l_record_version_number := pa_fin_plan_utils.Retrieve_Record_Version_Number
17688: (p_budget_version_id => l_curr_work_version_id);
17689: l_user_id := FND_GLOBAL.User_id;
17690: pa_fin_plan_pvt.lock_unlock_version
17691: (p_budget_version_id => l_curr_work_version_id,
17692: p_record_version_number => l_record_version_number,
17693: p_action => 'L',
18532:
18533: l_CW_record_version_number := pa_fin_plan_utils.Retrieve_Record_Version_Number(l_CW_version_id);
18534:
18535: l_created_ver_rec_ver_num := pa_fin_plan_utils.Retrieve_Record_Version_Number(l_created_version_id);
18536: l_user_id := FND_GLOBAL.User_id;
18537: PA_COMP_PROFILE_PUB.GET_USER_INFO
18538: (p_user_id => l_user_id,
18539: x_person_id => t_person_id,
18540: x_resource_id => t_resource_id,