DECLARE
--> variables needed for API standard parameters
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_api_version_number NUMBER := 1.0;
l_commit VARCHAR2 (1)
:= 'T';
l_return_status VARCHAR2 (1);
l_init_msg_list VARCHAR2 (1)
:= 'T';
l_msg_count NUMBER := 0;
l_msg_data VARCHAR2 (2000);
l_data VARCHAR2 (2000);
l_msg_index_out NUMBER;
v_task_id apps.pa_tasks.task_id%TYPE;
L_LINE_STATUS
NUMBER := 0;
--> variables needed for Oracle Project specific
parameters
l_user_id NUMBER;
l_responsibility_id NUMBER;
l_pm_product_code VARCHAR2 (10);
l_budget_type_code VARCHAR2 (50);
l_pa_project_id NUMBER;
l_pm_project_reference VARCHAR2(40);
l_workflow_started VARCHAR2 (1);
l_pa_task_id NUMBER;
l_resource_list_member_id NUMBER;
l_raw_cost NUMBER;
l_quantity NUMBER;
API_ERROR EXCEPTION;
BEGIN
--> PRODUCT RELATED DATA
l_pm_product_code
:= 'GMS';
--> BUDGET DATA
l_pa_project_id := 76846;
l_budget_type_code := 'FC';
l_pm_project_reference := NULL;
--> BUDGET LINE DATA
l_pa_task_id := 405235;
l_resource_list_member_id := 1034;
l_raw_cost := 1000;
l_quantity := 1000;
---->>===================================
--> SET GLOBAL INFO
SELECT user_id,
responsibility_id
INTO l_user_id,
l_responsibility_id
FROM pa_user_resp_v
WHERE 1=1
and user_name = 'RCHINTHAPATLA'
and RESPONSIBILITY_name
= 'Project,
Vision Operations (USA)' ;
PA_INTERFACE_UTILS_PUB.SET_GLOBAL_INFO
( p_api_version_number
=> 1.0
,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
);
IF l_return_status != 'S'
THEN
FOR n IN 1 .. l_msg_count
LOOP
fnd_msg_pub.get (n, fnd_api.g_false, l_msg_data, l_msg_dummy);
l_output := (TO_CHAR (n) || ':
' || l_msg_data);
DBMS_OUTPUT.PUT_LINE ( '1003 : API Error while
initializing the Application User : ' || l_output);
END LOOP;
END IF;
---->>================================
--> ADDING BUDGET LINE
PA_BUDGET_PUB.ADD_BUDGET_LINE
(p_api_version_number =>
l_api_version_number,
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,
p_pa_project_id => l_pa_project_id,
p_resource_list_member_id => l_resource_list_member_id,
p_budget_type_code => l_budget_type_code,
p_pa_task_id => l_pa_task_id,
p_raw_cost => l_raw_cost,
p_quantity => l_quantity
);
IF l_return_status != 'S'
THEN
RAISE API_ERROR;
DBMS_OUTPUT.PUT_LINE('MSG_COUNT: '||TO_CHAR(L_MSG_COUNT));
END IF;
DBMS_OUTPUT.put_line ('Add Budget Line Status ' || l_return_status);
---->>=====================================
--> CALLING BASELINE BUDGET
IF l_return_status = 'S'
THEN
PA_BUDGET_PUB.BASELINE_BUDGET
(p_api_version_number
=> l_api_version_number,
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_workflow_started => l_workflow_started,
p_pm_product_code => l_pm_product_code,
p_pa_project_id => l_pa_project_id,
p_pm_project_reference => l_pm_project_reference,
p_budget_type_code => l_budget_type_code
);
IF l_return_status != 'S'
THEN
RAISE API_ERROR;
DBMS_OUTPUT.PUT_LINE('MSG_COUNT: '||TO_CHAR(L_MSG_COUNT));
END IF;
DBMS_OUTPUT.put_line ('BASELINE BUDGET STATUS
:' || l_return_status);
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);
DBMS_OUTPUT.put_line ('Error Msg : ' || l_msg_data);
END LOOP;
WHEN OTHERS
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);
DBMS_OUTPUT.put_line ('Error Msg : ' || l_msg_data);
END LOOP;
END;
No comments:
Post a Comment