Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

API BUDGET PROJECT

828290Jan 4 2011 — edited Apr 19 2013
Hi All,

Currently i'm working in API BUDGET for Projects. I don't have much idea about this..

Here i have mentioned what i did if anything need to be rectify please let me know..



CREATE OR REPLACE procedure APPS.xx_bud_detail (errbuf out varchar2,retcode out varchar2) as
-- variables needed for API standard parameters
l_api_version_number NUMBER := 1.20;
l_commit VARCHAR2(1) := 'F';
l_init_msg_list VARCHAR2(1) := 'T';
l_msg_count NUMBER;
l_msg_data VARCHAR2(2000);
l_return_status VARCHAR2(1);
l_data VARCHAR2(2000);
-- l_msg_entity VARCHAR2(100);
-- l_msg_entity_index NUMBER;
l_msg_index NUMBER;
l_msg_index_out NUMBER;
l_encouded VARCHAR2(1);
i NUMBER;
a NUMBER;
-- variables needed for the user_id and responsibility_id
l_user_id NUMBER;
l_responsibility_id NUMBER;
-- variables needed for Oracle Project specific parameters
l_pm_product_code VARCHAR2(10);
l_pa_project_id NUMBER;
l_pm_project_reference VARCHAR2(25);
l_budget_type_code VARCHAR2(30);
l_change_reason_code VARCHAR2(30);
l_description VARCHAR2(255);
l_entry_method_code VARCHAR2(30);
l_resource_list_name VARCHAR2(60);
l_resource_list_id NUMBER;
l_budget_lines_in PA_BUDGET_PUB.BUDGET_LINE_IN_TBL_TYPE;
l_budget_lines_in_rec PA_BUDGET_PUB.BUDGET_LINE_IN_REC_TYPE;
l_budget_lines_out PA_BUDGET_PUB.BUDGET_LINE_OUT_TBL_TYPE;
l_budget_version_name VARCHAR2(20) := 'Version 1';
l_line_index NUMBER;
l_line_return_status VARCHAR2(1);
API_ERROR EXCEPTION;
BEGIN
--PRODUCT RELATED DATA
l_pm_product_code := 'OHABUDGET';
--BUDGET DATA
l_pa_project_id :='410600';
--project id for budget
l_pm_project_reference := 'ABC';
l_budget_type_code := 'AC';
l_change_reason_code := 'Estimating Error';
l_description := 'New Description -> 2';
l_entry_method_code := 'Galfar Cost BEM';
l_resource_list_id := 1002;
-- BUDGET LINES DATA
a := 2;
for i in 1..a loop
if i = 1 then
l_budget_lines_in_rec.pa_task_id := 1;
l_budget_lines_in_rec.resource_list_member_id := 3005; -- Expenses
elsif i = 2 then
l_budget_lines_in_rec.pa_task_id := 2;
l_budget_lines_in_rec.resource_list_member_id := 1077; -- Labor
end if;
l_budget_lines_in_rec.quantity := 500;
l_budget_lines_in_rec.budget_start_date := '03-JAN-2011';
l_budget_lines_in_rec.budget_end_date := '01-JUL-2011';
l_budget_lines_in_rec.period_name := 'JAN-W3-11';
l_budget_lines_in_rec.raw_cost := 8100;
l_budget_lines_in(i) := l_budget_lines_in_rec;
end loop;
-- GET GLOBAL INFO
select user_id, responsibility_id
into l_user_id, l_responsibility_id
from pa_user_resp_v
where user_name = 'OPERATIONS'
AND responsibility_id = '56486'; -- apps login id
-- SET GLOBAL INFO
pa_interface_utils_pub.set_global_info (
p_api_version_number => l_api_version_number ,
p_responsibility_id => l_responsibility_id,
p_user_id => l_user_id,
p_msg_count => l_msg_count,
p_msg_data => l_msg_data,
p_return_status => l_return_status);
-- INIT_BUDGET
pa_budget_pub.init_budget;
-- CREATE_DRAFT_BUDGET
pa_budget_pub.create_draft_budget (
p_api_version_number => l_api_version_number, -- required
p_commit => l_commit,
p_init_msg_list => l_init_msg_list,
p_msg_count => l_msg_count,
p_msg_data => l_msg_data,
p_return_status => l_return_status,
p_pm_product_code => l_pm_product_code, -- required
p_pm_project_reference => l_pm_project_reference,
p_budget_version_name => l_budget_version_name,
p_pa_project_id => l_pa_project_id,
p_budget_type_code => l_budget_type_code, -- required
p_change_reason_code => l_change_reason_code,
p_description => l_description,
p_entry_method_code => l_entry_method_code, -- required
p_resource_list_name => l_resource_list_name,
p_resource_list_id => l_resource_list_id,
p_budget_lines_in => l_budget_lines_in,
p_budget_lines_out => l_budget_lines_out
);
if l_return_status != 'S'
then
raise API_ERROR;
end if;
for i in 1..l_budget_lines_out.count loop
dbms_output.put_line('create draft budget was successful for line ' || i);
dbms_output.put_line('Return Code = ' || l_budget_lines_out(i).return_status);
end loop;
-- CLEAR_BUDGET
pa_budget_pub.clear_budget;
if l_return_status != 'S'
then
raise API_ERROR;
end if;
-- HANDLE EXCEPTIONS
EXCEPTION
when API_ERROR then
for i in 1..l_msg_count loop
pa_interface_utils_pub.get_messages(
p_msg_data => l_msg_data,
p_data => l_data,
p_msg_count => l_msg_count,
p_msg_index_out => l_msg_index_out);
dbms_output.put_line('error msg ' || l_data);
end loop;
for i in 1..l_msg_count loop
pa_interface_utils_pub.get_messages(
p_msg_data => l_msg_data,
p_data => l_data,
p_msg_count => l_msg_count,
p_msg_index_out => l_msg_index_out);
dbms_output.put_line('error msg ' || l_data);
end loop;
end xx_bud_detail;





declare
a varchar2(25);
b varchar2(25);
begin
xx_bud_detail(a,b);
end;


when i run the above procedure this should affect the base table PA_PROJECTS_ALL

But i'm getting the following error

error msg Please enter a valid product code for this project.
error msg Project ID is invalid.
error msg
error msg
a:
b:

Any kind of help is highly appreciated..

Thanks in advance..

Regards,
Suresh
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 17 2013
Added on Jan 4 2011
3 comments
6,352 views