The following lines contain the word 'select', 'insert', 'update' or 'delete':
select 'X' into l_group_id
from jtf_rs_group_members
where resource_id = p_resource_id
and group_id = l_grp_owner
and nvl(delete_flag, 'N') = 'N'
and rownum < 2;
select distribution_status_id into l_distribution_status
from ieu_uwqm_items
where workitem_pk_id = l_source_object_id
and workitem_obj_code = l_source_object_code;
select task_assignment_id, object_version_number
into l_assignment_id, l_object_version_number
from jtf_task_assignments
where resource_id = p_resource_id
and resource_type_code not in ('RS_TEAM', 'RS_GROUP')
and task_id = p_ws_input_data(j).workitem_pk_id
and rownum < 2;
SELECT 'X' into l_sr_task_exist
FROM cs_incidents_b_sec inc,
jtf_tasks_b sel_task
where inc.incident_id=sel_task.source_object_id
and sel_task.task_id =p_ws_input_data(j).workitem_pk_id ;
jtf_task_assignments_pub.update_task_assignment(
p_api_version => 1.0,
p_object_version_number => l_object_version_number,
p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_true,
p_task_assignment_id => l_assignment_id,
p_task_id => p_ws_input_data(j).workitem_pk_id,
p_resource_type_code => 'RS_INDIVIDUAL',--l_resource_type_code,
p_resource_id => l_task_distributed_to, --l_resource_id,
p_actual_effort => null,
p_actual_effort_uom => null,
p_schedule_flag => null,
p_alarm_type_code => null,
p_alarm_contact => null,
p_sched_travel_distance => null,
p_sched_travel_duration => null,
p_sched_travel_duration_uom => null,
p_actual_travel_distance => null,
p_actual_travel_duration => null,
p_actual_travel_duration_uom => null,
p_actual_start_date => null,
p_actual_end_date => null,
p_palm_flag => null,
p_wince_flag => null,
p_laptop_flag => null,
p_device1_flag => null,
p_device2_flag => null,
p_device3_flag => null,
p_resource_territory_id => null,
p_shift_construct_id => null,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data
);
IEU_WR_PUB.UPDATE_WR_ITEM(
p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_true,
p_workitem_obj_code => p_ws_input_data(j).workitem_obj_code,
p_workitem_pk_id => p_ws_input_data(j).workitem_pk_id,
p_title => p_ws_input_data(j).title,
p_party_id => p_ws_input_data(j).party_id,
p_priority_code => p_ws_input_data(j).priority_code,
p_due_date => p_ws_input_data(j).due_date,
p_owner_id => p_ws_input_data(j).owner_id,
p_owner_type => p_ws_input_data(j).owner_type,
p_assignee_id => l_task_distributed_to,
p_assignee_type => 'RS_INDIVIDUAL',
p_source_object_id => p_ws_input_data(j).source_object_id,
p_source_object_type_code => p_ws_input_data(j).source_object_type_code,
p_application_id => p_ws_input_data(j).application_id,
p_work_item_status => p_ws_input_data(j).work_item_status,
p_user_id => FND_GLOBAL.USER_ID,
p_login_id => FND_GLOBAL.LOGIN_ID,
x_msg_count => l_msg_count,
x_msg_data => L_MSG_DATA,
x_return_status => L_RETURN_STATUS);
-- Update SR Item based on Business rules. This should
-- internally call Update UWQ Repository Item based on
-- Distribution rules. In this case, the Update should be done to
-- UWQ Assignee_id and Assignee_type
elsIf (l_distributed_to = 'INDIVIDUAL_OWNED')
Then
-- Distribute SR
IEU_WR_PUB.UPDATE_WR_ITEM(
p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_true,
p_workitem_obj_code => p_ws_input_data(j).workitem_obj_code,
p_workitem_pk_id => p_ws_input_data(j).workitem_pk_id,
p_title => p_ws_input_data(j).title,
p_party_id => p_ws_input_data(j).party_id,
p_priority_code => p_ws_input_data(j).priority_code,
p_due_date => p_ws_input_data(j).due_date,
p_owner_id => l_task_distributed_to,
p_owner_type => 'RS_INDIVIDUAL',
p_assignee_id => p_ws_input_data(j).assignee_id,
p_assignee_type => p_ws_input_data(j).assignee_type,
p_source_object_id => p_ws_input_data(j).source_object_id,
p_source_object_type_code => p_ws_input_data(j).source_object_type_code,
p_application_id => p_ws_input_data(j).application_id,
p_user_id => FND_GLOBAL.USER_ID,
p_login_id => FND_GLOBAL.LOGIN_ID,
x_msg_count => l_msg_count,
x_msg_data => L_MSG_DATA,
x_return_status => L_RETURN_STATUS);