Showing posts with label Projects. Show all posts
Showing posts with label Projects. Show all posts

Friday, December 3, 2010

PA Detail Query



SELECT DISTINCT
hou.NAME org,
hou.organization_id org_id,
ppc.class_category CATEGORY,
ppc.class_code code,
ppa.project_id,
NULL expenditure_type,
ppa.segment1 proj_num,
ppa.NAME proj_name,
ppa.project_type project_type,
pcd.pa_date,
pcd.pa_period_name,
pet.expenditure_category expenditure_category,
(SELECT xx.description
FROM fnd_flex_values_vl xx
WHERE xx.flex_value_set_id = a.flex_value_set_id
AND a.parent_flex_value = xx.flex_value
AND xx.summary_flag = 'Y'
AND flex_value <> 'T')
account_type,
FROM apps.pa_projects_all ppa,
apps.pa_tasks ppt,
apps.hr_all_organization_units hou,
apps.pa_project_classes ppc,
apps.pa_cost_distribution_lines_all pcd,
apps.pa_expenditures_all e,
apps.pa_expenditure_items_all pei,
apps.pa_expenditure_types pet,
fnd_flex_value_children_v a,
fnd_id_flex_segments j
WHERE ppa.carrying_out_organization_id = hou.organization_id
AND ppa.project_id = ppt.project_id
AND ppa.project_id = pei.project_id
AND pei.task_id = ppt.task_id
AND e.expenditure_id = pei.expenditure_id
AND ppa.project_id = ppc.project_id
AND pei.expenditure_item_id = pcd.expenditure_item_id
AND pet.expenditure_type = pei.expenditure_type
AND a.flex_value_set_id = j.flex_value_set_id
AND UPPER (j.segment_name) = 'ACCOUNT'
AND j.id_flex_code = 'GLLE'
AND ppt.attribute1 = a.flex_value

Wednesday, July 7, 2010

PA Budget API



pa_budget_pub.create_draft_finplan
(p_api_version_number => 1.0,
p_commit => 'F',
p_init_msg_list => 'T',
p_pm_product_code => 'LEGACY',
p_pa_project_id => l_project_id,
p_fin_plan_type_name => 'Approved Cost',
p_version_type => 'COST',
p_time_phased_code => '',
p_resource_list_name => 'RESOURCE LIST BY EXPENDITURE CATEGORY', p_fin_plan_level_code => 'P',
p_budget_version_name => '1.0',
p_description => 'CONVERSION',
p_raw_cost_flag => 'Y',
p_burdened_cost_flag => 'Y',
p_create_new_curr_working_flag => 'N',
p_replace_current_working_flag => 'Y',
p_using_resource_lists_flag => 'Y',
p_finplan_trans_tab => t_finplan_tbl,
x_finplan_version_id => x_finplan_version_id,
x_return_status => x_return_status,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data
);

Where t_finplan_tbl is table type variable. Assign record type variable to it as below
t_finplan_tbl (i) := t_finplan_rec;
t_finplan_rec.pm_product_code := 'LEGACY';
t_finplan_rec.task_id := l_task_id;
t_finplan_rec.pm_task_reference := '1';
t_finplan_rec.currency_code := 'EUR';
t_finplan_rec.resource_alias := '1';
t_finplan_rec.resource_list_member_id := '1023';
t_finplan_rec.raw_cost := rec_tasks.raw_cost;
t_finplan_rec.burdened_cost := rec_tasks.burdened_cost;

pa_budget_pub.baseline_budget
(p_api_version_number => 1.0,
p_commit => 'F',
p_init_msg_list => 'T',
p_msg_count => x_msg_count2,
p_msg_data => x_msg_data2,
p_return_status => x_return_status2,
p_workflow_started => x_workflow_started,
p_pm_product_code => 'LEGACY',
p_pa_project_id => l_project_id,
p_pm_project_reference => rec_budget.project_number, p_budget_type_code => '',
p_mark_as_original => '',
p_fin_plan_type_id => 10020,
p_fin_plan_type_name => 'Approved Cost',
p_version_type => 'COST'
);