SET serveroutput on;
DECLARE
l_user_name fnd_user.user_name%TYPE := 'OPERATIONS';
l_task_name jtf_tasks_tl.task_name%TYPE := 'Task1';
l_task_priority jtf_task_priorities_tl.NAME%TYPE := 'Medium';
l_task_status jtf_task_statuses_tl.NAME%TYPE := 'Open';
l_show_on_cal jtf_task_all_assignments.show_on_calendar%TYPE := 'N';
l_planned_start_date DATE := SYSDATE;
l_planned_end_date DATE := SYSDATE;
l_user_id NUMBER := 1318; -- User Id for Operations - Select user_id from fnd_user where user_name = 'OPERATIONS';
l_resource_id NUMBER := 199; -- Resource Id for Operations - select resource_id from jtf_rs_resource_extns where user_name = 'OPERATIONS';
l_task_type_id NUMBER := 9; -- Meeting.
l_task_status_id NUMBER := 10; -- Open;
l_task_priority_id NUMBER;
l_task_id NUMBER;
l_return_status VARCHAR2 (1);
l_msg_count NUMBER;
l_msg_data VARCHAR2 (1000);
BEGIN
jtf_tasks_pub.create_task (p_api_version => 1.0
, p_init_msg_list => fnd_api.g_true
, p_commit => fnd_api.g_false
, p_task_name => l_task_name
, p_task_type_id => l_task_type_id
, p_task_status_id => l_task_status_id
, p_task_priority_id => l_task_priority_id
, p_owner_type_code => 'RS_EMPLOYEE'
, p_owner_id => l_resource_id
, p_show_on_calendar => l_show_on_cal
, p_planned_start_date => l_planned_start_date
, p_planned_end_date => l_planned_end_date
, p_date_selected => 'P'
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data
, x_task_id => l_task_id
);
IF l_return_status <> fnd_api.g_ret_sts_success
THEN
IF l_msg_count > 0
THEN
l_msg_data := NULL;
FOR i IN 1 .. l_msg_count
LOOP
l_msg_data := l_msg_data || ' ' || fnd_msg_pub.get (1, 'F');
END LOOP;
fnd_message.set_encoded (l_msg_data);
DBMS_OUTPUT.put_line (l_msg_data);
END IF;
ROLLBACK;
ELSE
DBMS_OUTPUT.put_line ('Task Id = ' || l_task_id);
DBMS_OUTPUT.put_line ('Return Status = ' || l_return_status);
COMMIT;
END IF;
END;
/
DECLARE
l_user_name fnd_user.user_name%TYPE := 'OPERATIONS';
l_task_name jtf_tasks_tl.task_name%TYPE := 'Task1';
l_task_priority jtf_task_priorities_tl.NAME%TYPE := 'Medium';
l_task_status jtf_task_statuses_tl.NAME%TYPE := 'Open';
l_show_on_cal jtf_task_all_assignments.show_on_calendar%TYPE := 'N';
l_planned_start_date DATE := SYSDATE;
l_planned_end_date DATE := SYSDATE;
l_user_id NUMBER := 1318; -- User Id for Operations - Select user_id from fnd_user where user_name = 'OPERATIONS';
l_resource_id NUMBER := 199; -- Resource Id for Operations - select resource_id from jtf_rs_resource_extns where user_name = 'OPERATIONS';
l_task_type_id NUMBER := 9; -- Meeting.
l_task_status_id NUMBER := 10; -- Open;
l_task_priority_id NUMBER;
l_task_id NUMBER;
l_return_status VARCHAR2 (1);
l_msg_count NUMBER;
l_msg_data VARCHAR2 (1000);
BEGIN
jtf_tasks_pub.create_task (p_api_version => 1.0
, p_init_msg_list => fnd_api.g_true
, p_commit => fnd_api.g_false
, p_task_name => l_task_name
, p_task_type_id => l_task_type_id
, p_task_status_id => l_task_status_id
, p_task_priority_id => l_task_priority_id
, p_owner_type_code => 'RS_EMPLOYEE'
, p_owner_id => l_resource_id
, p_show_on_calendar => l_show_on_cal
, p_planned_start_date => l_planned_start_date
, p_planned_end_date => l_planned_end_date
, p_date_selected => 'P'
, x_return_status => l_return_status
, x_msg_count => l_msg_count
, x_msg_data => l_msg_data
, x_task_id => l_task_id
);
IF l_return_status <> fnd_api.g_ret_sts_success
THEN
IF l_msg_count > 0
THEN
l_msg_data := NULL;
FOR i IN 1 .. l_msg_count
LOOP
l_msg_data := l_msg_data || ' ' || fnd_msg_pub.get (1, 'F');
END LOOP;
fnd_message.set_encoded (l_msg_data);
DBMS_OUTPUT.put_line (l_msg_data);
END IF;
ROLLBACK;
ELSE
DBMS_OUTPUT.put_line ('Task Id = ' || l_task_id);
DBMS_OUTPUT.put_line ('Return Status = ' || l_return_status);
COMMIT;
END IF;
END;
/
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.