DBA Data[Home] [Help]

APPS.POS_WCAPPROVE_PVT SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 52

procedure UpdateWorkflowInfo
(
p_itemtype        in varchar2,
p_itemkey         in varchar2,
p_shipment_header_id in varchar2);
Line: 110

		select to_char(PO_WF_ITEMKEY_S.NEXTVAL)
		into l_seq_for_item_key
		from sys.dual;
Line: 129

			select count(*)
			into   l_wf_created
			from   wf_items
			where  item_type = p_itemtype
			and    item_key  = l_itemkey;
Line: 180

	select shipment_num
	into l_work_confirmation_number
	from rcv_shipment_headers
	where shipment_header_id = p_work_confirmation_id
	and nvl(asn_type,'STD') = 'WC';
Line: 200

        select max(po_header_id)
        into l_po_header_id
        from rcv_shipment_lines
        where shipment_header_id = p_work_confirmation_id;
Line: 288

** Update the old notifications to closed status for this document.
*/
procedure Close_old_notif
(
p_itemtype        in varchar2,
p_itemkey         in varchar2,
p_actid           in number,
p_funcmode        in varchar2,
x_resultout       out NOCOPY varchar2 ) IS

l_work_confirmation_id  Number;
Line: 303

select wf_item_key
from rcv_shipment_headers
where shipment_header_id = p_header_id;
Line: 424

	select created_by
	into l_wc_preparer_id
	from rcv_shipment_headers
	where shipment_header_id= l_work_confirmation_id;
Line: 430

	select employee_id
	into l_employee_id
	from fnd_user
	where user_id = l_wc_preparer_id;
Line: 495

	select poh.segment1,
	       poh.agent_id
	into l_po_number,
	     l_po_preparer_id
	from po_headers_all poh
	where po_header_id = l_po_header_id;
Line: 611

procedure update_workflow_info( p_itemtype        in varchar2,
                                p_itemkey         in varchar2,
                                p_actid           in number,
                                p_funcmode        in varchar2,
                                x_resultout       out NOCOPY varchar2) is
l_shipment_header_id number;
Line: 618

l_api_name varchar2(50) := p_itemkey || ' update_workflow_info';
Line: 621

	l_progress := 'POS_WCAPPROVE_PVT.update_workflow_info: 01.';
Line: 624

				l_api_name,'Enter in update_workflow_info ' || l_progress);
Line: 638

	l_progress := 'POS_WCAPPROVE_PVT.update_workflow_info: 02.';
Line: 644

	UpdateWorkflowInfo(p_itemtype,p_itemkey,l_shipment_header_id);
Line: 648

	l_progress := 'POS_WCAPPROVE_PVT.update_workflow_info: 02.';
Line: 651

				l_api_name,'Leave update_workflow_info ' || l_progress);
Line: 658

				l_api_name,'Exception in update_workflow_info '
			|| l_progress);
Line: 662

end update_workflow_info;
Line: 671

select pk1_value
from fnd_attached_documents
where entity_name='RCV_LINES'
and pk1_value in (select shipment_line_id
		  from rcv_shipment_lines
		  where shipment_header_id=l_shipment_header_id);
Line: 713

	select count(*)
	into l_attach_count
	from fnd_attached_documents
	where entity_name =' RCV_LINES'
	and pk1_value in (select shipment_line_id
			  from rcv_shipment_lines
			  where shipment_header_id=l_shipment_header_id);
Line: 761

/* Insert a submit action  row in po_action_history to signal the
 * submisinon of the document for Approval. Also insert an
 * additional row with a NULL ACTION_CODE to simulate a
 * forward-to. We need to do this for each shipment line in this
 * document.
*/
procedure Ins_actionhist_submit(p_itemtype        in varchar2,
                                p_itemkey         in varchar2,
                                p_actid           in number,
                                p_funcmode        in varchar2,
                                x_resultout       out NOCOPY varchar2)is
l_progress varchar2(200);
Line: 782

select shipment_line_id
from rcv_shipment_lines
where shipment_header_id=l_shipment_header_id;
Line: 788

select max(sequence_num)
from po_action_history
where object_id=l_shipment_header_id
and object_type_code = 'WC';
Line: 794

select action_code
from po_action_history
where object_id = l_shipment_header_id
and object_type_code='WC'
and sequence_num = l_seq_num;
Line: 877

				l_api_name,'before call to InsertPOActionHistory ' ||
				l_sequence_num);
Line: 884

			      InsertPOActionHistory(
				   p_object_id => l_shipment_header_id,
				   p_object_type_code=>'WC',
                                   p_object_sub_type_code => NULL,
                                   p_sequence_num =>l_sequence_num ,
                                   p_action_code =>'SUBMIT' ,
                                   p_action_date =>sysdate ,
                                   p_employee_id => null, --l_wc_preparer_id forsupplier
                                   p_approval_path_id  => NULL ,
                                   p_note => NULL,
                                   p_object_revision_num => NULL,
                                   p_offline_code =>  '',
                                   p_request_id =>  0,
                                   p_program_application_id => 0,
                                   p_program_id =>0 ,
                                   p_program_date => sysdate ,
                                   p_user_id => fnd_global.user_id  ,
                                   p_login_id => fnd_global.login_id);
Line: 924

		/* Insert the null action code*/
		IF (g_asn_debug = 'Y') THEN
		    debug_log(FND_LOG.LEVEL_STATEMENT,
				l_api_name,'insert null action_code ' ||
				l_sequence_num);
Line: 932

		      /*InsertPOActionHistory(
			   p_object_id => l_shipment_header_id,
			   p_object_type_code=>'WC',
			   p_object_sub_type_code => NULL,
			   p_sequence_num =>l_sequence_num+1 ,
			   p_action_code =>NULL ,
			   p_action_date =>sysdate ,
			   p_employee_id => null,--l_wc_preparer_id for supplier
			   p_approval_path_id  => NULL ,
			   p_note => NULL,
			   p_object_revision_num => NULL,
			   p_offline_code =>  '',
			   p_request_id =>  0,
			   p_program_application_id => 0,
			   p_program_id =>0 ,
			   p_program_date => sysdate ,
			   p_user_id => fnd_global.user_id  ,
			   p_login_id => fnd_global.login_id);             */
Line: 982

l_insertion_type            VARCHAR2(30);
Line: 1223

                    SELECT person_id, full_name
                    into l_next_approver_id,l_next_approver_name
                     FROM (
                       SELECT person.person_id, person.full_name
                       FROM per_all_people_f person, per_all_assignments_f asg
                       WHERE asg.position_id = l_next_approver(1).orig_system_id
                       and trunc(sysdate) between person.effective_start_date
                       and nvl(person.effective_end_date, trunc(sysdate))
                       and person.person_id = asg.person_id
                       and asg.primary_flag = 'Y'
                       and asg.assignment_type in ('E','C')
                       and ( person.current_employee_flag = 'Y'
                                or person.current_npw_flag = 'Y' )
                       and asg.assignment_status_type_id not in
                         (
                          SELECT assignment_status_type_id
                                FROM per_assignment_status_types
                                WHERE per_system_status = 'TERM_ASSIGN'
                         )
                        and trunc(sysdate) between asg.effective_start_date
                                        and asg.effective_end_date
                        order by person.last_name
                       ) where rownum = 1;
Line: 1252

                SELECT employee_id
                into l_next_approver_id
                FROM fnd_user
                WHERE user_id = l_next_approver(1).orig_system_id
                and trunc(sysdate) between start_date and nvl(end_date, sysdate+1);
Line: 1270

                                l_api_name,'l_insertion_type '
                                || l_insertion_type);
Line: 1294

                                      aname      => 'AME_INSERTION_TYPE' ,
                                      avalue     => l_insertion_type);
Line: 1363

procedure Insert_Action_History(p_itemtype        in varchar2,
                                p_itemkey         in varchar2,
                                p_actid           in number,
                                p_funcmode        in varchar2,
                                x_resultout       out NOCOPY varchar2) is

l_progress varchar2(200);
Line: 1375

l_api_name varchar2(50) := p_itemkey || ' Insert_Action_History';
Line: 1379

select shipment_line_id
from rcv_shipment_lines
where shipment_header_id=l_shipment_header_id;
Line: 1385

  SELECT  object_id,
          object_type_code,
          object_sub_type_code,
          sequence_num,
          object_revision_num,
          request_id,
          program_application_id,
          program_date,
          program_id,
          last_update_date,
          employee_id
    FROM  PO_ACTION_HISTORY
   WHERE  object_type_code = 'WC'
     AND  object_id  = l_shipment_header_id
     AND  sequence_num = l_sequence_num;
Line: 1417

	l_progress := 'POS_WCAPPROVE_PVT.Insert_Action_History: 01.';
Line: 1420

				l_api_name,'Enter in Insert_Action_History '
			|| l_progress);
Line: 1447

                l_progress := 'POS_WCAPPROVE_PVT.Insert_Action_History: 04.';
Line: 1449

		SELECT count(*)
		INTO l_count
		FROM PO_ACTION_HISTORY
		WHERE object_type_code = 'WC'
		AND object_id   = l_shipment_header_id
		AND action_code IS NULL;
Line: 1469

			SELECT max(sequence_num)
			INTO l_sequence_num
			FROM PO_ACTION_HISTORY
			WHERE object_type_code = 'WC'
			AND object_id = l_shipment_header_id;
Line: 1500

			** want to update the first NULL row in POAH
			** with FORWARD action
			*/


			If l_count = 1 then


				IF (g_asn_debug = 'Y') THEN
				    debug_log(FND_LOG.LEVEL_STATEMENT,
							l_api_name,
						'update Action history ' );
Line: 1514

				UpdatePOActionHistory(
                                p_object_id => Recinfo.object_id,
                                p_object_type_code => Recinfo.object_type_code,
                                p_employee_id => Recinfo.employee_id,
                                p_action_code => 'FORWARD',
                                p_note => NULL,
                                p_user_id => fnd_global.user_id,
                                p_login_id => fnd_global.login_id);
Line: 1534

						'Insert Action history ' );
Line: 1539

			      InsertPOActionHistory(
				   p_object_id => Recinfo.object_id,
				   p_object_type_code=>Recinfo.object_type_code,
                                   p_object_sub_type_code => NULL,
                                   p_sequence_num => Recinfo.sequence_num+1 ,
                                   p_action_code =>NULL ,
                                   p_action_date =>NULL ,
                                   p_employee_id => l_approver_id,
                                   p_approval_path_id  => NULL ,
                                   p_note => NULL,
                                   p_object_revision_num => NULL,
                                   p_offline_code =>  NULL,
                                   p_request_id =>  Recinfo.request_id,
                                   p_program_application_id => Recinfo.program_application_id,
                                   p_program_id =>Recinfo.program_id ,
                                   p_program_date => Recinfo.program_date ,
                                   p_user_id => fnd_global.user_id  ,
                                   p_login_id => fnd_global.login_id);
Line: 1569

			'Exit Insert Action history ' );
Line: 1576

			l_api_name,'invalid_action in Insert_Action_History '
			|| l_progress);
Line: 1583

			l_api_name,'invalid_data in Insert_Action_History '
			|| l_progress);
Line: 1590

				l_api_name,'Exception in Insert_Action_History '
			|| l_progress);
Line: 1594

end Insert_Action_History;
Line: 1617

    SELECT notification_id
    FROM   wf_item_activity_statuses_v
    WHERE  item_type = p_itemtype
    AND    item_key = p_itemkey
    AND    activity_name =  p_activity_name
    ORDER BY activity_end_date DESC;
Line: 1656

		SELECT attribute_value
		into l_note
		FROM   wf_notification_attr_resp_v
		WHERE  group_id = l_notification_id
		AND    attribute_name = 'NOTE';
Line: 1669

	update_approval_status(p_shipment_header_id => l_shipment_header_id,
                               p_note => l_note,
                               p_approval_status => 'APPROVED',
			       p_level => 'LINES',
                               x_resultout => l_result);
Line: 1713

    SELECT notification_id
    FROM   wf_item_activity_statuses_v
    WHERE  item_type = p_itemtype
    AND    item_key = p_itemkey
    AND    activity_name =  p_activity_name
    ORDER BY activity_end_date DESC;
Line: 1752

		SELECT attribute_value
		into l_note
		FROM   wf_notification_attr_resp_v
		WHERE  group_id = l_notification_id
		AND    attribute_name = 'NOTE';
Line: 1767

	update_approval_status(p_shipment_header_id => l_shipment_header_id,
                               p_note => l_note,
                               p_approval_status => 'REJECTED',
			       p_level => 'LINES',
                               x_resultout => l_result);
Line: 1828

	select count(*)
	into l_reject_lines
	from rcv_shipment_lines
	where shipment_header_id = l_shipment_header_id
	and approval_status = 'REJECTED';
Line: 1859

procedure Update_Approval_List_Response
			   (p_itemtype        in varchar2,
                            p_itemkey         in varchar2,
                            p_actid           in number,
                            p_funcmode        in varchar2,
                            x_resultout       out NOCOPY varchar2) IS

CURSOR c_group_id (p_itemtype VARCHAR2,
		   p_itemkey VARCHAR2,
		   p_activity_name VARCHAR2) IS
    SELECT notification_id
    FROM   wf_item_activity_statuses_v
    WHERE  item_type = p_itemtype
    AND    item_key = p_itemkey
    AND    activity_name =  p_activity_name
    ORDER BY activity_end_date DESC;
Line: 1877

    SELECT '1'
     FROM   WF_NOTIFICATIONS
    WHERE   notification_id = p_notif_id
      AND   status = 'CANCELED';
Line: 1883

    SELECT recipient_role, attribute_value
    FROM   wf_notification_attr_resp_v
    WHERE  group_id = p_group_id
    AND    attribute_name = 'RESULT';
Line: 1889

    SELECT attribute_value
    FROM   wf_notification_attr_resp_v
    WHERE  group_id = p_group_id
    AND    attribute_name = 'NOTE';
Line: 1895

    SELECT nvl((wfu.orig_system_id), -9996)
    FROM   wf_users wfu
    WHERE  wfu.name = p_responder
    AND    wfu.orig_system not in ('HZ_PARTY', 'POS', 'ENG_LIST', 'CUST_CONT');
Line: 1900

  l_api_name varchar2(50) := p_itemkey || ' update_approval_list_response';
Line: 1919

  l_insertion_type            VARCHAR2(30);
Line: 1933

	l_progress := 'POS_WCAPPROVE_PVT.Update_Approval_List_Response: 01.';
Line: 1937

				'Enter in Update_Approval_List_Response '
			|| l_progress);
Line: 1989

		l_progress := 'POS_WCAPPROVE_PVT.Update_Approval_List_Response'
					|| ': 02.';
Line: 1993

		SELECT wfn.responder, wfn.recipient_role, wfn.end_date
		INTO l_responder, l_recipient_role, l_response_end_date
		FROM   wf_notifications wfn
		WHERE  wfn.notification_id = l_group_id;
Line: 2040

		l_progress := 'POS_WCAPPROVE_PVT.Update_Approval_List_Response'
				|| ':02.';
Line: 2065

		l_progress := 'POS_WCAPPROVE_PVT.Update_Approval_List_Response'
				|| ': 03.';
Line: 2077

		l_progress := 'POS_WCAPPROVE_PVT.Update_Approval_List_Response'
					|| ': 04.';
Line: 2095

		l_progress := 'POS_WCAPPROVE_PVT.Update_Approval_List_Response'
					|| ': 05.';
Line: 2124

	l_insertion_type := wf_engine.GetItemAttrText(itemtype => p_itemtype,
					 itemkey  => p_itemkey,
					 aname    => 'AME_INSERTION_TYPE');
Line: 2131

				' l_insertion_type '
				|| l_insertion_type);
Line: 2213

		select count(*)
		into l_reject_lines
		from rcv_shipment_lines
		where shipment_header_id = l_shipment_header_id
		and approval_status = 'REJECTED';
Line: 2256

                ame_api2.updateApprovalStatus(applicationIdIn=>l_application_Id,                            transactionIdIn=>l_shipment_header_id,
                            approverIn=>l_current_approver,
                            transactionTypeIn=>l_transaction_type);
Line: 2267

				l_api_name,'Exception in update_approval_list_response '
			|| l_progress);
Line: 2271

end Update_Approval_List_Response;
Line: 2273

procedure Update_Action_History_Approve
			   (p_itemtype        in varchar2,
                            p_itemkey         in varchar2,
                            p_actid           in number,
                            p_funcmode        in varchar2,
                            x_resultout       out NOCOPY varchar2) IS
l_progress varchar2(300);
Line: 2280

l_api_name varchar2(50) := p_itemkey || ' update_action_history_approve';
Line: 2282

	l_progress := 'POS_WCAPPROVE_PVT.Update_Approval_History_Approve: 01.';
Line: 2286

				'Enter in Update_Action_History_Approve '
			|| l_progress);
Line: 2295

	Update_Action_History(p_itemtype => p_itemtype,
			      p_itemkey => p_itemkey,
			      p_action_code => 'APPROVE');
Line: 2304

				'Leave in Update_Action_History_Approve '
			|| l_progress);
Line: 2315

				l_api_name,'Exception in update_action_history_approve '
			|| l_progress);
Line: 2319

end Update_Action_History_Approve;
Line: 2321

procedure Update_Action_History_Reject
			   (p_itemtype        in varchar2,
                            p_itemkey         in varchar2,
                            p_actid           in number,
                            p_funcmode        in varchar2,
                            x_resultout       out NOCOPY varchar2) IS
l_progress varchar2(300);
Line: 2328

l_api_name varchar2(50) := p_itemkey || ' update_action_history_Reject';
Line: 2330

	l_progress := 'POS_WCAPPROVE_PVT.Update_action_history_reject: 01.';
Line: 2334

				'Enter in Update_Action_History_Reject '
			|| l_progress);
Line: 2343

	Update_Action_History(p_itemtype => p_itemtype,
			      p_itemkey => p_itemkey,
			      p_action_code => 'REJECT');
Line: 2352

				'Leave in Update_Action_History_Reject '
			|| l_progress);
Line: 2363

				l_api_name,'Exception in update_action_history_Reject '
			|| l_progress);
Line: 2367

end Update_Action_History_REJECT;
Line: 2371

procedure Update_Action_History
			   (p_itemtype        in varchar2,
                            p_itemkey         in varchar2,
                            p_action_code     in  varchar2) IS

CURSOR c_responderid(l_responder VARCHAR2) IS
    SELECT nvl((wfu.orig_system_id), -9996)
    FROM   wf_users wfu
    WHERE  wfu.name = l_responder
    AND    wfu.orig_system not in ('HZ_PARTY', 'POS', 'ENG_LIST', 'CUST_CONT');
Line: 2385

select rsl.shipment_line_id ,
nvl(rsl.comments,rsh.comments),
rsl.approval_status
from rcv_shipment_lines rsl,
rcv_shipment_headers rsh
where rsh.shipment_header_id = l_shipment_header_id
and rsh.shipment_header_id= rsl.shipment_header_id;
Line: 2394

l_api_name varchar2(50) := p_itemkey || ' update_action_history';
Line: 2411

	l_progress := 'POS_WCAPPROVE_PVT.Update_Action_history: 01.';
Line: 2415

				'Enter in Update_Action_History '
			|| l_progress);
Line: 2433

	l_progress := 'POS_WCAPPROVE_PVT.Update_Action_history: 02.';
Line: 2434

	SELECT nvl(max(wf.notification_id), -9995)
	into    l_notification_id
	FROM    wf_notifications wf,
	wf_item_activity_statuses wias
	WHERE  wias.item_type = p_itemtype
	and wias.item_key = p_itemkey
	and wias.notification_id = wf.group_id;
Line: 2450

	l_progress := 'POS_WCAPPROVE_PVT.Update_Action_history: 03.';
Line: 2451

	SELECT wfn.responder, wfn.recipient_role,
               wfn.original_recipient, wfn.more_info_role
        INTO l_responder, l_recipient_role,
             l_original_recipient, l_more_info_role
        FROM   wf_notifications wfn
        WHERE  wfn.notification_id = l_notification_id;
Line: 2499

	SELECT wfu.orig_system_id
	INTO l_original_recipient_id
	FROM wf_roles wfu
	WHERE wfu.name = l_original_recipient
	AND wfu.orig_system NOT IN ('POS', 'ENG_LIST', 'CUST_CONT');
Line: 2519

		l_progress := 'POS_WCAPPROVE_PVT.update_approval_history: 04.';
Line: 2529

		    UpdateActionHistory(l_more_origsysid,
                        l_original_recipient_id,
                        l_responder_id,
			FALSE,
                        p_action_code,
                        l_comments,
                        l_shipment_header_id);
Line: 2539

				l_api_name,'After updateactionhistory' ||
				l_shipment_header_id);
Line: 2546

			l_api_name,'Leave update_action_history' );
Line: 2555

			l_api_name,'Exception in Update_Action_History '
			|| l_progress);
Line: 2560

END Update_Action_History;
Line: 2562

PROCEDURE UpdateActionHistory(p_more_info_id           IN NUMBER,
                              p_original_recipient_id  IN NUMBER,
                              p_responder_id           IN NUMBER,
			      p_last_approver          IN BOOLEAN,
                              p_action_code            IN VARCHAR2,
                              p_comments               IN VARCHAR2,
                              p_shipment_header_id     IN NUMBER)
IS

-- pragma AUTONOMOUS_TRANSACTION;
Line: 2572

l_api_name varchar2(50) := 'UpdateActionHistory';
Line: 2578

  SELECT  ph.action_code action_code ,
          ph.object_type_code object_type_code ,
          ph.sequence_num sequence_num,
          ph.approval_path_id approval_path_id,
          ph.request_id request_id ,
          ph.program_application_id program_application_id,
          ph.program_date program_date ,
          ph.program_id program_id ,
          ph.last_update_date last_update_date,
          ph.object_id object_id,
	  ph.employee_id employee_id
  FROM
     rcv_shipment_headers rsh,
     po_action_history ph
  WHERE rsh.shipment_header_id = ph.object_id
     and rsh.shipment_header_id=p_shipment_header_id
     and ph.sequence_num = l_sequence_num;
Line: 2600

	l_progress := 'POS_WCAPPROVE_PVT.UpdateActionHistory: 01.';
Line: 2603

				l_api_name,'Enter in UpdateActionHistory '
			|| l_progress);
Line: 2611

	SELECT max(sequence_num)
	INTO l_sequence_num
	FROM PO_ACTION_HISTORY
	WHERE object_type_code = 'WC'
	AND object_id = p_shipment_header_id;
Line: 2636

				 'Before call to InsertPOActionHistory ');
Line: 2640

		      InsertPOActionHistory(
			   p_object_id => Recinfo.object_id,
			   p_object_type_code=>Recinfo.object_type_code,
			   p_object_sub_type_code => NULL,
			   p_sequence_num => Recinfo.sequence_num+1 ,
			   p_action_code =>NULL ,
			   p_action_date =>NULL ,
			   p_employee_id => p_original_recipient_id,
			   p_approval_path_id  => NULL ,
			   p_note => NULL,
			   p_object_revision_num => NULL,
			   p_offline_code =>  NULL,
			   p_request_id =>  Recinfo.request_id,
			   p_program_application_id => Recinfo.program_application_id,
			   p_program_id =>Recinfo.program_id ,
			   p_program_date => Recinfo.program_date ,
			   p_user_id => fnd_global.user_id  ,
			   p_login_id => fnd_global.login_id);
Line: 2665

		 ** post notification function  so that the update
		 ** to action history can be viewed at the moment of
		 ** reassignment. The following code is used to handle
		 ** request for more info:
		 ** 1. at the moment an approver requests for more info,
		 **    action history is updated (performed within post
		 ** notification)
		 ** 2. if the approver approve/reject the requisition
		 **      before the more info request is responded
		 **    then we need to update the action history
		 **      to reflect 'no action' from the more info
		*/
		IF (p_more_info_id is not null) THEN --{


			/*
			** update the original NULL row for the
			** original approver with
			** action code of 'NO ACTION'
			*/


			UpdatePOActionHistory(
			p_object_id => Recinfo.object_id,
			p_object_type_code => Recinfo.object_type_code,
			p_employee_id => p_more_info_id,
			p_action_code => 'NO ACTION',
			p_note => NULL,
			p_user_id => fnd_global.user_id,
			p_login_id => fnd_global.login_id);
Line: 2699

			** insert a new NULL row into PO_ACTION_HISTORY  for
			** the new approver
			*/


		      InsertPOActionHistory(
			   p_object_id => Recinfo.object_id,
			   p_object_type_code=>Recinfo.object_type_code,
			   p_object_sub_type_code => NULL,
			   p_sequence_num => Recinfo.sequence_num+1 ,
			   p_action_code =>NULL ,
			   p_action_date =>NULL ,
			   p_employee_id => p_responder_id,
			   p_approval_path_id  => NULL ,
			   p_note => NULL,
			   p_object_revision_num => NULL,
			   p_offline_code =>  NULL,
			   p_request_id =>  Recinfo.request_id,
			   p_program_application_id => Recinfo.program_application_id,
			   p_program_id =>Recinfo.program_id ,
			   p_program_date => Recinfo.program_date ,
			   p_user_id => fnd_global.user_id  ,
			   p_login_id => fnd_global.login_id);
Line: 2729

	l_progress := 'POS_WCAPPROVE_PVT.UpdateActionHistory: 02.';
Line: 2734

	** update pending row of action history with approval action
	*/
		IF (g_asn_debug = 'Y') THEN
		    debug_log(FND_LOG.LEVEL_STATEMENT,
					l_api_name,
				 'Before call to UpdatePOActionHistory '
			||l_progress);
Line: 2743

		UpdatePOActionHistory(
		p_object_id => Recinfo.object_id,
		p_object_type_code => Recinfo.object_type_code,
		p_employee_id => Recinfo.employee_id,
		p_action_code => p_action_code,
		p_note =>substrb(p_comments,1,4000),
		p_user_id => fnd_global.user_id,
		p_login_id => fnd_global.login_id);
Line: 2761

				'No data found in UpdateActionHistory '
			|| l_progress);
Line: 2769

				l_api_name,'Exception in UpdateActionHistory '
			|| l_progress);
Line: 2774

END UpdateActionHistory;
Line: 2818

PROCEDURE UpdatePOActionHistory (p_object_id            IN NUMBER,
                                 p_object_type_code     IN VARCHAR2,
                                 p_employee_id      IN NUMBER,
                                 p_action_code          IN VARCHAR2,
                                 p_note                 IN VARCHAR2,
                                 p_user_id              IN NUMBER,
                                 p_login_id             IN NUMBER)
IS
        l_progress      VARCHAR2(250) := '';
Line: 2829

	l_api_name varchar2(50) := ' UpdatePOActionHistory';
Line: 2833

	l_progress := 'POS_WCAPPROVE_PVT.UpdatePOActionHistory: 01.';
Line: 2836

				l_api_name,'Enter in UpdatePOActionHistory '
			|| l_progress);
Line: 2869

                SELECT HR.EMPLOYEE_ID
                INTO   l_employee_id
                FROM   FND_USER FND, HR_EMPLOYEES_CURRENT_V HR
                WHERE  FND.USER_ID = NVL(p_user_id, fnd_global.user_id)
                AND    FND.EMPLOYEE_ID = HR.EMPLOYEE_ID;
Line: 2882

	l_progress := 'POS_WCAPPROVE_PVT.UpdatePOActionHistory: 02.';
Line: 2885

				l_api_name,'Before Update '
			|| l_progress);
Line: 2900

				select comments
					into l_note
				from rcv_shipment_headers
				where shipment_header_id=p_object_id;
Line: 2910

        UPDATE PO_ACTION_HISTORY
        SET     last_update_date = sysdate,
                last_updated_by = p_user_id,
                last_update_login = p_login_id,
                employee_id = p_employee_id,
                --employee_id = NVL(l_employee_id, employee_id),
                action_date = sysdate,
                action_code = p_action_code,
                note = nvl(p_note,l_note)
        WHERE   object_id = p_object_id
        AND     object_type_code = p_object_type_code
        AND     action_code IS NULL;
Line: 2925

	l_progress := 'POS_WCAPPROVE_PVT.UpdatePOActionHistory: 02.';
Line: 2939

			l_api_name,'invalid_action in UpdatePOActionHistory '
			|| l_progress);
Line: 2946

				l_api_name,'Exception in UpdatePOActionHistory '
			|| l_progress);
Line: 2951

END UpdatePOActionHistory;
Line: 2954

PROCEDURE InsertPOActionHistory (p_object_id                    IN  NUMBER,
                                  p_object_type_code           IN  VARCHAR2,
                                   p_object_sub_type_code       IN  VARCHAR2,
                                   p_sequence_num               IN  NUMBER,
                                   p_action_code                IN  VARCHAR2,
                                   p_action_date                IN  DATE,
                                   p_employee_id                IN  NUMBER,
                                   p_approval_path_id           IN  NUMBER,
                                   p_note                       IN  VARCHAR2,
                                   p_object_revision_num        IN  NUMBER,
                                   p_offline_code               IN  VARCHAR2,
                                   p_request_id                 IN  NUMBER,
                                   p_program_application_id     IN  NUMBER,
                                   p_program_id                 IN  NUMBER,
                                   p_program_date               IN  DATE,
                                   p_user_id                    IN  NUMBER,
                                   p_login_id                   IN  NUMBER)
IS
-- pragma AUTONOMOUS_TRANSACTION;
Line: 2975

	l_api_name varchar2(50) := ' InsertPOActionHistory';
Line: 2982

	l_progress := 'POS_WCAPPROVE_PVT.InsertPOActionHistory: 01.';
Line: 2985

				l_api_name,'Enter in InsertPOActionHistory '
			|| l_progress);
Line: 3000

	l_progress := 'POS_WCAPPROVE_PVT.InsertPOActionHistory: 02.';
Line: 3002

	SELECT MAX(sequence_num)
	INTO  l_sequence_num
	FROM  PO_ACTION_HISTORY
	WHERE object_id           = p_object_id
	AND   object_type_code    = p_object_type_code;
Line: 3008

	l_progress := 'POS_WCAPPROVE_PVT.InsertPOActionHistory: 03.';
Line: 3011

		l_progress := 'POS_WCAPPROVE_PVT.InsertPOActionHistory: 04.';
Line: 3014

		l_progress := 'POS_WCAPPROVE_PVT.InsertPOActionHistory: 05.';
Line: 3018

	l_progress := 'POS_WCAPPROVE_PVT.InsertPOActionHistory: 06.';
Line: 3023

    l_progress := 'POS_WCAPPROVE_PVT.InsertPOActionHistory: 07.';
Line: 3027

				l_api_name,'l_sequence_num before insert '
			|| l_sequence_num);
Line: 3033

    INSERT INTO PO_ACTION_HISTORY
                (object_id,
                object_type_code,
                object_sub_type_code,
                sequence_num,
                last_update_date,
                last_updated_by,
                employee_id,
                action_code,
                action_date,
                note,
                object_revision_num,
                last_update_login,
                creation_date,
                created_by,
                request_id,
                program_application_id,
                program_id,
                program_date,
                approval_path_id,
                offline_code,
                program_update_date)
    VALUES (p_object_id,
                'WC',
                'WC',
                l_sequence_num,
                sysdate,
                p_user_id,
                p_employee_id,
                p_action_code,
                p_action_date,
                l_note,
                p_object_revision_num,
                p_login_id,
                sysdate,
                p_user_id,
                p_request_id,
                p_program_application_id,
                p_program_id,
                p_program_date,
                p_approval_path_id,
                p_offline_code,
                sysdate);
Line: 3082

				l_api_name,'Exception in InsertPOActionHistory '
			|| l_progress);
Line: 3087

END InsertPOActionHistory;
Line: 3124

select rsl.shipment_line_id
from rcv_shipment_lines rsl
where rsl.shipment_header_id = l_shipment_header_id;
Line: 3130

SELECT  object_id,
        object_type_code,
        object_sub_type_code,
        sequence_num,
        object_revision_num,
        request_id,
        program_application_id,
        program_date,
        program_id,
        last_update_date,
        employee_id
FROM    PO_ACTION_HISTORY
WHERE   object_type_code = 'WC'
        AND  object_id  = l_shipment_header_id
        AND  sequence_num = l_sequence_num;
Line: 3179

    select max(sequence_num)
    into   l_sequence_num
    from   po_action_history
    where  object_type_code ='WC'
           and object_id = l_shipment_header_id;
Line: 3196

    UpdatePOActionHistory( p_object_id => Recinfo.object_id,
                           p_object_type_code => Recinfo.object_type_code,
                           p_employee_id => Recinfo.employee_id,
                           p_action_code => l_action,
                           p_note => wf_engine.context_user_comment,
                           p_user_id => fnd_global.user_id,
                           p_login_id => fnd_global.login_id);
Line: 3205

    InsertPOActionHistory( p_object_id => Recinfo.object_id,
                           p_object_type_code=>Recinfo.object_type_code,
                           p_object_sub_type_code => NULL,
                           p_sequence_num => Recinfo.sequence_num+1 ,
                           p_action_code =>NULL ,
                           p_action_date =>NULL ,
                           p_employee_id => l_new_recipient_id,
                           p_approval_path_id  => NULL ,
                           p_note => NULL,
                           p_object_revision_num => NULL,
                           p_offline_code =>  NULL,
                           p_request_id =>  Recinfo.request_id,
                           p_program_application_id => Recinfo.program_application_id,
                           p_program_id =>Recinfo.program_id ,
                           p_program_date => Recinfo.program_date ,
                           p_user_id => fnd_global.user_id  ,
                           p_login_id => fnd_global.login_id);
Line: 3272

    SELECT fu.USER_ID
    INTO   l_responder_id
    FROM   fnd_user fu,
           wf_notifications wfn
    WHERE  wfn.notification_id = l_notification_id
           AND wfn.original_recipient = fu.user_name;
Line: 3503

	update_approval_status(p_shipment_header_id => l_shipment_header_id,
                               p_note => null,
                               p_approval_status => l_approval_status,
			       p_level => 'HEADER',
                               x_resultout => l_result);
Line: 3620

	update_approval_status(p_shipment_header_id => l_shipment_header_id,
			       p_note => null,
			       p_approval_status => l_approval_status,
			       p_level => 'HEADER',
			       x_resultout => l_result);
Line: 3699

procedure update_approval_status
			   (p_shipment_header_id in number,
                            p_note         in varchar2,
                            p_approval_status in varchar2,
			    p_level           in varchar2,
                            x_resultout       out NOCOPY varchar2) IS

cursor lock_rsh(l_shipment_header_id number) is
select null
from rcv_shipment_headers
where shipment_header_id  = l_shipment_header_id
for update of shipment_header_id nowait;
Line: 3718

l_api_name varchar2(50) := ' update_approval_status';
Line: 3721

	l_progress := 'POS_WCAPPROVE_PVT.update_approval_status: 01.';
Line: 3725

				'Enter in update_approval_status '
			|| l_progress);
Line: 3768

		update rcv_shipment_headers
		set approval_status = p_approval_status,
		    comments = nvl(p_note,comments)
		where shipment_header_id = p_shipment_header_id;
Line: 3778

		 * So update the header with the comments.
		*/
		update rcv_shipment_lines
		set approval_status = p_approval_status
		where shipment_header_id=p_shipment_header_id ;
Line: 3784

		update rcv_shipment_headers
		set comments = nvl(p_note,comments)
		where shipment_header_id = p_shipment_header_id;
Line: 3794

				l_api_name,'Exception in update_approval_status '
			|| l_progress);
Line: 3799

END update_approval_status;
Line: 3801

procedure insert_into_rti(p_itemtype in varchar2,
							p_itemkey  in varchar2,
							p_actid    in number,
							p_funcmode in varchar2,
							x_resultout out NOCOPY varchar2) IS

l_progress varchar2(300);
Line: 3808

l_api_name varchar2(50) := p_itemkey || ' insert_into_rti';
Line: 3812

SELECT rsl.po_line_location_id,
pll.unit_meas_lookup_code,
rsl.unit_of_measure unit_of_measure,
rsl.unit_of_measure primary_unit_of_measure,
rsl.unit_of_measure source_doc_unit_of_measure,
NVL(pll.promised_date, pll.need_by_date) promised_date,
rsl.to_organization_id ship_to_organization_id,
null quantity_ordered,
null amount_ordered,
null quantity_funded,
null amount_funded,
null partial_funded_flag,
NVL(pll.price_override, pl.unit_price) po_unit_price,
pll.match_option,
rsl.category_id,
rsl.item_description,
pl.po_line_id,
ph.currency_code,
ph.rate_type currency_conversion_type,
ph.segment1 document_num,
null po_distribution_id, --pod.po_distribution_id,
rsl.req_distribution_id,
rsl.requisition_line_id,
rsl.deliver_to_location_id deliver_to_location_id,
rsl.deliver_to_location_id location_id,
rsl.deliver_to_person_id,
null currency_conversion_date, --pod.rate_date currency_conversion_date,
null currency_conversion_rate, --pod.rate currency_conversion_rate,
rsl.destination_type_code destination_type_code,
rsl.destination_type_code destination_context,
null charge_account_id, --pod.code_combination_id ,
null destination_organization_id, --pod.destination_organization_id,
null subinventory, --pod.destination_subinventory ,
rsl.ship_to_location_id,
rsl.comments,
rsl.attribute_category attribute_category,
rsl.attribute1 attribute1,
rsl.attribute2 attribute2,
rsl.attribute3 attribute3,
rsl.attribute4 attribute4,
rsl.attribute5 attribute5,
rsl.attribute6 attribute6,
rsl.attribute7 attribute7,
rsl.attribute8 attribute8,
rsl.attribute9 attribute9,
rsl.attribute10 attribute10,
rsl.attribute11 attribute11,
rsl.attribute12 attribute12,
rsl.attribute13 attribute13,
rsl.attribute14 attribute14,
rsl.attribute15 attribute15,
NVL(pll.enforce_ship_to_location_code,'NONE') enforce_ship_to_location_code,
rsl.shipment_line_id,
rsl.item_id,
rsl.item_revision,
rsh.vendor_id,
rsh.shipment_num,
rsh.freight_carrier_code,
rsh.bill_of_lading,
rsh.packing_slip,
rsh.shipped_date,
rsh.expected_receipt_date,
rsh.waybill_airbill_num ,
rsh.vendor_site_id,
rsl.to_organization_id,
rsl.routing_header_id,
rsl.vendor_item_num,
rsl.vendor_lot_num,
rsl.ussgl_transaction_code,
rsl.government_context,
pll.po_header_id,
ph.revision_num po_revision_num,
pl.line_num document_line_num,
pll.shipment_num document_shipment_line_num,
null document_distribution_num , --pod.distribution_num
pll.po_release_id,
pl.job_id,
ph.org_id,
rsl.amount_shipped amount,
rsl.quantity_shipped  quantity,
rsl.quantity_shipped  source_doc_quantity,
rsl.quantity_shipped  primary_quantity,
rsl.quantity_shipped  quantity_shipped,
rsl.amount_shipped amount_shipped,
rsl.requested_amount requested_amount,
rsl.material_stored_amount material_stored_amount,
pll.matching_basis,
Nvl(pdsh.clm_flag,'N') clm_flag
FROM
--po_distributions_all pod,
po_line_locations_all pll,
po_lines_all pl,
po_headers_all ph,
rcv_shipment_lines rsl,
rcv_shipment_headers rsh,
po_doc_style_headers pdsh
WHERE
rsh.shipment_header_id = l_shipment_header_id
and rsl.shipment_header_id =  rsh.shipment_header_id
and rsl.po_header_id =  ph.po_header_id
--and pod.po_header_id = ph.po_header_id
--and pod.line_location_id = pll.line_location_id
and rsl.po_line_id =  pl.po_line_id
and rsl.po_line_location_id =  pll.line_location_id
and rsh.receipt_source_code = 'VENDOR'
and pll.po_line_id = pl.po_line_id
AND NVL(pll.approved_flag, 'N') = 'Y'
AND NVL(pll.cancel_flag, 'N') = 'N'
AND pll.shipment_type IN('STANDARD', 'BLANKET', 'SCHEDULED','PREPAYMENT')
AND NVL(ph.STYLE_ID, 1) = PDSH.STYLE_ID (+)
AND PDSH.STATUS (+) = 'ACTIVE';
Line: 3930

select pod.po_distribution_id,
pod.rate_date currency_conversion_date,
pod.rate currency_conversion_rate,
pod.code_combination_id charge_account_id,
pod.destination_organization_id,
pod.destination_subinventory subinventory,
pod.distribution_num document_distribution_num,
pod.quantity_ordered,
pod.amount_ordered,
pod.quantity_funded,
pod.amount_funded,
Nvl(pod.partial_funded_flag,'N') partial_funded_flag,
pod.destination_type_code destination_type_code,
pod.destination_type_code destination_context
from po_distributions_all pod
where pod.line_location_id = l_line_location_id
order by pod.distribution_num;
Line: 3952

select rsl.shipment_line_id
from rcv_shipment_lines rsl
where rsl.shipment_header_id = l_shipment_header_id;
Line: 3988

l_insert_into_rti boolean := TRUE;
Line: 3995

l_req_amount_inserted BOOLEAN := FALSE;
Line: 3996

l_mat_stored_inserted BOOLEAN := FALSE;
Line: 4013

    l_progress := 'POS_WCAPPROVE_PVT.insert_into_rti: 01.';
Line: 4017

		'Enter in insert_into_rti '
		|| l_progress);
Line: 4031

	SELECT rcv_headers_interface_s.NEXTVAL
	INTO l_header_interface_id
	FROM SYS.DUAL;
Line: 4035

	select rcv_interface_groups_s.nextval
	into l_group_id
	from dual;
Line: 4070

	Modified the earlier logic used to insert data in RTI tables, since it was not populating data correctly in the RTI tables.
	Removed the earlier commented code to incorporate the new logic.
	Please refer to comments and detailed technical resolution data in bug 88100238 BCT for more information

	******************************************************************** */

	-- opening the work confirmation cursor at pay item level
	open get_wcr_info(l_shipment_header_id);
Line: 4081

		l_progress := 'POS_WCAPPROVE_PVT.insert_into_rti:02.';
Line: 4106

			select  muom.uom_code
			into l_uom_code
			from mtl_units_of_measure muom
			WHERE  muom.unit_of_measure = wcr_line_info.unit_of_measure;
Line: 4135

		SELECT Count(*)
    		INTO l_max_dist
    		FROM po_distributions_all pod
    		where pod.line_location_id = wcr_line_info.po_line_location_id;
Line: 4148

    l_req_amount_inserted := FALSE;
Line: 4149

    l_mat_stored_inserted := FALSE;
Line: 4154

		-- looping through the distributions cursor to insert data in RTI
    		loop --{
			l_progress := 'POS_WCAPPROVE_PVT.insert_into_rti:03.';
Line: 4204

				select nvl(sum(amount),0)
				into l_transacted_amount
				from rcv_transactions
				where po_distribution_id= wcr_line_info.po_distribution_id
				and destination_type_code = 'RECEIVING';
Line: 4218

				select nvl(sum(amount),0)
				into l_interface_amount
				from rcv_transactions_interface
				where po_distribution_id= wcr_line_info.po_distribution_id
				and processing_status_code='PENDING'
				and transaction_status_code = 'PENDING'
				and transaction_type = 'RECEIVE';
Line: 4253

					-- last distribution for pay item, insert the l_remaining_amount completely
              IF (l_clm_flag = 'Y' and l_partial_funded_flag = 'Y') THEN
                IF(l_available_amount > 0) THEN
                  IF(l_carry_over_amount > 0) THEN
                    wcr_line_info.amount := l_available_amount;
Line: 4263

				    	    l_insert_into_rti := TRUE;
Line: 4265

                  l_insert_into_rti := FALSE;
Line: 4270

				    	  l_insert_into_rti := TRUE;
Line: 4279

              IF(l_req_amount_inserted) THEN
                wcr_line_info.requested_amount := null;
Line: 4283

              IF(l_mat_stored_inserted) THEN
                wcr_line_info.material_stored_amount := null;
Line: 4287

              l_req_amount_inserted := TRUE;
Line: 4288

              l_mat_stored_inserted := TRUE;
Line: 4291

				    	-- not the last distribution for the pay item, check if we need to insert or not
				    	IF(l_available_amount > 0) THEN
					    	-- this distribution is not yet completely filled,
					    	-- so we "need to insert" depending on l_remaining_amount and l_available_amount
					    	IF(l_carry_over_amount > 0) THEN
							-- the shipped amount is greater than the l_available_amount
							wcr_line_info.amount := l_available_amount;
Line: 4315

                IF(l_req_amount_inserted) THEN
                  wcr_line_info.requested_amount := null;
Line: 4319

                IF(l_mat_stored_inserted) THEN
                  wcr_line_info.material_stored_amount := null;
Line: 4323

                l_req_amount_inserted := TRUE;
Line: 4324

                l_mat_stored_inserted := TRUE;
Line: 4326

				        l_insert_into_rti := TRUE;
Line: 4330

					  -- l_available_amount < 0, so "no need to insert"
            l_insert_into_rti := FALSE;
Line: 4342

				select nvl(sum(quantity),0)
				into l_transacted_quantity
				from rcv_transactions
				where po_distribution_id= wcr_line_info.po_distribution_id
				and destination_type_code = 'RECEIVING';
Line: 4356

				select nvl(sum(quantity),0)
				into l_interface_quantity
				from rcv_transactions_interface
				where po_distribution_id= wcr_line_info.po_distribution_id
				and processing_status_code='PENDING'
				and transaction_status_code = 'PENDING'
				and transaction_type = 'RECEIVE';
Line: 4400

              l_insert_into_rti := TRUE;
Line: 4402

              l_insert_into_rti := FALSE;
Line: 4407

            l_insert_into_rti := TRUE;
Line: 4410

          				-- not the last distribution for the pay item, check if we need to insert or not
          				IF(l_available_quantity > 0) THEN
            					-- this distribution is not yet completely filled,
            					-- so we "need to insert" depending on l_remaining_quantity and l_available_quantity
            					IF(l_carry_over_quantity > 0) THEN
              						-- the shipped quantity is greater than the l_available_quantity
              						wcr_line_info.quantity := l_available_quantity;
Line: 4426

            					l_insert_into_rti := TRUE;
Line: 4429

            					-- l_available_amount < 0, so "no need to insert"
            					l_insert_into_rti := FALSE;
Line: 4440

			If (l_insert_into_rti) then --{
				select rcv_transactions_interface_s.nextval
				into l_interface_id
				from dual;
Line: 4468

                   SELECT set_of_books_id
                                INTO   x_sob_Id
                                FROM   financials_system_parameters WHERE org_id = wcr_line_info.org_id;
Line: 4483

				rcv_asn_interface_trx_ins_pkg.insert_row
			    (l_row_id,
			     l_interface_id,--interface_id
			     l_group_id, --group_id
			     sysdate, --last_updated_date
			     fnd_global.user_id, --last_updated_by,
			     sysdate, --creation_date,
			     fnd_global.login_id, --created_by,
			     fnd_global.login_id, -- last_update_login,
			     NULL, --request_id,
			     null, --program_application_id,
			     null, --program_id,
			     null, --program_update_date,
			     'RECEIVE', --transaction_type,
			     sysdate, --transaction_date,
			     'PENDING', --processing_status_code,
			     'IMMEDIATE', --processing_mode_code,
			     --'BATCH',
			     null, --processing_request_id,
			     'PENDING', --.transaction_status_code,
			     wcr_line_info.category_id,
			     wcr_line_info.quantity, --quantity
			     wcr_line_info.unit_of_measure,
			     'ISP', --.interface_source_code,
			     NULL, --.interface_source_line_id,
			     NULL, --.inv_transaction_id,
			     wcr_line_info.item_id,
			     wcr_line_info.item_description,
			     wcr_line_info.item_revision,
			     l_uom_code, --uom_code,
			     x_emp_id, --employee_id,
			     'DELIVER', --auto_transact_code,
			     l_shipment_header_id, --l_shipment_header_id
			     wcr_line_info.shipment_line_id,
			     wcr_line_info.ship_to_location_id,
			     wcr_line_info.primary_quantity,
			     wcr_line_info.primary_unit_of_measure,
			     'VENDOR', --.receipt_source_code,
			     wcr_line_info.vendor_id,
			     wcr_line_info.vendor_site_id,
			     NULL, --from_organization_id,
			     NULL, --from_subinventory,
			     wcr_line_info.to_organization_id,
			     NULL, --.intransit_owning_org_id,
			     wcr_line_info.routing_header_id,
			     NULL, --.routing_step_id,
			     'PO', --source_document_code,
			     NULL, --.parent_transaction_id,
			     wcr_line_info.po_header_id,
			     wcr_line_info.po_revision_num,
			     wcr_line_info.po_release_id,
			     wcr_line_info.po_line_id,
			     wcr_line_info.po_line_location_id,
			     wcr_line_info.po_unit_price,
			     wcr_line_info.currency_code,
			     wcr_line_info.currency_conversion_type,
			     l_currency_conversion_rate, --Bug #: 13924722 wcr_line_info.currency_conversion_rate
			     l_currency_conversion_date, --Bug #: 13924722 wcr_line_info.currency_conversion_date
			     wcr_line_info.po_distribution_id,
			     wcr_line_info.requisition_line_id,
			     wcr_line_info.req_distribution_id,
			     wcr_line_info.charge_account_id,
			     NULL, --.substitute_unordered_code,
			     NULL, --.receipt_exception_flag,
			     NULL, --.accrual_status_code,
			     'NOT INSPECTED' ,--.inspection_status_code,
			     NULL, --.inspection_quality_code,
			     wcr_line_info.destination_type_code,
			     wcr_line_info.deliver_to_person_id,
			     wcr_line_info.location_id,
			     wcr_line_info.deliver_to_location_id,
			     NULL, --.subinventory,
			     NULL, --.locator_id,
			     NULL, --.wip_entity_id,
			     NULL, --.wip_line_id,
			     NULL, --.department_code,
			     NULL, --.wip_repetitive_schedule_id,
			     NULL, --.wip_operation_seq_num,
			     NULL, --.wip_resource_seq_num,
			     NULL, --.bom_resource_id,
			     wcr_line_info.shipment_num,
			     wcr_line_info.freight_carrier_code,
			     wcr_line_info.bill_of_lading,
			     wcr_line_info.packing_slip,
			     wcr_line_info.shipped_date,
			     wcr_line_info.expected_receipt_date,
			     NULL, --.actual_cost,
			     NULL, --.transfer_cost,
			     NULL, --.transportation_cost,
			     NULL, --.transportation_account_id,
			     NULL, --.num_of_containers,
			     wcr_line_info.waybill_airbill_num,
			     wcr_line_info.vendor_item_num,
			     wcr_line_info.vendor_lot_num,
			     NULL,--.rma_reference,
			     wcr_line_info.comments,
			     wcr_line_info.attribute_category,
			     wcr_line_info.attribute1,
			     wcr_line_info.attribute2,
			     wcr_line_info.attribute3,
			     wcr_line_info.attribute4,
			     wcr_line_info.attribute5,
			     wcr_line_info.attribute6,
			     wcr_line_info.attribute7,
			     wcr_line_info.attribute8,
			     wcr_line_info.attribute9,
			     wcr_line_info.attribute10,
			     wcr_line_info.attribute11,
			     wcr_line_info.attribute12,
			     wcr_line_info.attribute13,
			     wcr_line_info.attribute14,
			     wcr_line_info.attribute15,
			     NULL, --.ship_head_attribute_category,
			     NULL, --.ship_head_attribute1,
			     NULL, --.ship_head_attribute2,
			     NULL, --.ship_head_attribute3,
			     NULL, --.ship_head_attribute4,
			     NULL, --.ship_head_attribute5,
			     NULL, --.ship_head_attribute6,
			     NULL, --.ship_head_attribute7,
			     NULL, --.ship_head_attribute8,
			     NULL, --.ship_head_attribute9,
			     NULL, --.ship_head_attribute10,
			     NULL, --.ship_head_attribute11,
			     NULL, --.ship_head_attribute12,
			     NULL, --.ship_head_attribute13,
			     NULL, --.ship_head_attribute14,
			     NULL, --.ship_head_attribute15,
			     NULL, --.ship_line_attribute_category,
			     NULL, --.ship_line_attribute1,
			     NULL, --.ship_line_attribute2,
			     NULL, --.ship_line_attribute3,
			     NULL, --.ship_line_attribute4,
			     NULL, --.ship_line_attribute5,
			     NULL, --.ship_line_attribute6,
			     NULL, --.ship_line_attribute7,
			     NULL, --.ship_line_attribute8,
			     NULL, --.ship_line_attribute9,
			     NULL, --.ship_line_attribute10,
			     NULL, --.ship_line_attribute11,
			     NULL, --.ship_line_attribute12,
			     NULL, --.ship_line_attribute13,
			     NULL, --.ship_line_attribute14,
			     NULL, --.ship_line_attribute15,
			     wcr_line_info.ussgl_transaction_code,
			     wcr_line_info.government_context,
			     NULL, --.reason_id,
			     wcr_line_info.destination_context,
			     wcr_line_info.source_doc_quantity,
			     wcr_line_info.source_doc_unit_of_measure,
			     NULL, --.movement_id,
			     NULL, --l_header_interface_id, --.header_interface_id,
			     NULL, --.vendor_cum_shipped_qty,
			     NULL, --.item_num,
			     wcr_line_info.document_num,
			     wcr_line_info.document_line_num,
			     NULL, --.truck_num,
			     NULL, --.ship_to_location_code,
			     NULL, --.container_num,
			     NULL, --.substitute_item_num,
			     NULL, --.notice_unit_price,
			     NULL, --.item_category,
			     NULL, --.location_code,
			     NULL, --.vendor_name,
			     NULL, --.vendor_num,
			     NULL, --.vendor_site_code,
			     NULL, --.from_organization_code,
			     NULL, --.to_organization_code,
			     NULL, --.intransit_owning_org_code,
			     NULL, --.routing_code,
			     NULL, --.routing_step,
			     NULL, --.release_num,
			     wcr_line_info.document_shipment_line_num,
			     wcr_line_info.document_distribution_num,
			     NULL, --.deliver_to_person_name,
			     NULL, --.deliver_to_location_code,
			     NULL, --.use_mtl_lot,
			     NULL, --.use_mtl_serial,
			     NULL, --.LOCATOR,
			     NULL, --.reason_name,
			     NULL, --.validation_flag,
                 NULL, --.substitute_item_id,
			     NULL, --.quantity_shipped,
			     NULL, --.quantity_invoiced,
			     NULL, --.tax_name,
			     NULL, --.tax_amount,
			     NULL, --.req_num,
			     NULL, --.req_line_num,
			     NULL, --.req_distribution_num,
			     NULL, --.wip_entity_name,
			     NULL, --.wip_line_code,
			     NULL, --.resource_code,
			     NULL, --.shipment_line_status_code,
			     NULL, --.barcode_label,
			     NULL, --.country_of_origin_code,
			     NULL, --.from_locator_id, --WMS Change
			     NULL, --.qa_collection_id,
			     NULL, --.oe_order_header_id,
			     NULL, --.oe_order_line_id,
			     NULL, --.customer_id,
			     NULL, --.customer_site_id,
			     NULL, --.customer_item_num,
			     NULL, --.create_debit_memo_flag,
			     NULL, --.put_away_rule_id,
			     NULL, --.put_away_strategy_id,
			     NULL, --.lpn_id,
			     NULL, --.transfer_lpn_id,
			     NULL, --.cost_group_id,
			     NULL, --.mobile_txn,
			     NULL, --.mmtt_temp_id,
			     NULL, --.transfer_cost_group_id,
			     NULL, --.secondary_quantity,
			     NULL, --.secondary_unit_of_measure,
			     NULL, --.secondary_uom_code,
			     NULL, --.qc_grade,
			     NULL, --.oe_order_num,
			     NULL, --.oe_order_line_num,
			     NULL, --.customer_account_number,
			     NULL, --.customer_party_name,
			     NULL, --.source_transaction_num,
			     NULL, --.parent_source_transaction_num,
			     NULL, --.parent_interface_txn_id,
			     NULL, --.customer_item_id,
			     NULL, --.interface_available_qty,
			     NULL, --.interface_transaction_qty,
			     NULL, --.from_locator,
			     NULL, --.lpn_group_id,
			     NULL, --.order_transaction_id,
			     NULL, --.license_plate_number,
			     NULL, --.transfer_license_plate_number,
			     wcr_line_info.amount,
			     wcr_line_info.job_id,
			     NULL, --.project_id,
			     NULL, --.task_id,
			     NULL, --.asn_attach_id,
			     NULL, --.timecard_id,
			     NULL, --.timecard_ovn,
			     NULL, --.interface_available_amt,
			     NULL, --.interface_transaction_amt
			     wcr_line_info.org_id,  --
			     wcr_line_info.matching_basis,
			     NULL, --wcr_line_info.amount_shipped, --amount_shipped
			     wcr_line_info.requested_amount,
			     wcr_line_info.material_stored_amount
				);
Line: 4731

							l_api_name,'After insert '  );
Line: 4745

        select min(pod.po_distribution_id)
        INTO   l_full_fund_dist_id
        from   po_distributions_all pod
        where  pod.line_location_id = wcr_line_info.po_line_location_id AND
               Nvl(pod.partial_funded_flag,'N') = 'N';
Line: 4754

              SELECT INTERFACE_TRANSACTION_ID,
                     AMOUNT
              INTO   l_int_transaction_id,
                     l_full_fund_amt
              FROM   RCV_TRANSACTIONS_INTERFACE RTI
              WHERE  PO_DISTRIBUTION_ID = l_full_fund_dist_id AND
                     GROUP_ID = l_group_id;
Line: 4765

              UPDATE RCV_TRANSACTIONS_INTERFACE RTI
              SET    AMOUNT = l_full_fund_amt
              WHERE  INTERFACE_TRANSACTION_ID = l_int_transaction_id AND
                     GROUP_ID = l_group_id;
Line: 4774

              SELECT INTERFACE_TRANSACTION_ID,
                     QUANTITY
              INTO   l_int_transaction_id,
                     l_full_fund_qty
              FROM   RCV_TRANSACTIONS_INTERFACE RTI
              WHERE  PO_DISTRIBUTION_ID = l_full_fund_dist_id AND
                     GROUP_ID = l_group_id;
Line: 4785

              UPDATE RCV_TRANSACTIONS_INTERFACE RTI
              SET    QUANTITY = l_full_fund_qty
              WHERE  INTERFACE_TRANSACTION_ID = l_int_transaction_id AND
                     GROUP_ID = l_group_id;
Line: 4819

	update rcv_shipment_headers
	set receipt_num= l_receipt_num,
	    last_update_date = sysdate,
        last_updated_by = fnd_global.user_id,
        last_update_login = fnd_global.login_id
	where shipment_header_id = l_shipment_header_id;
Line: 4828

				l_api_name,'Leave insert_into_rti '  );
Line: 4840

					l_api_name,'Exception in insert_into_rti '
					|| l_progress);
Line: 4845

END insert_into_rti;
Line: 4925

		UPDATE rcv_transactions_interface
		set transaction_status_code = 'ERROR'
		 where group_id = l_group_id;
Line: 4966

	update wf_notifications set status = 'CLOSED'
        where notification_id in (
           select ias.notification_id
             from wf_item_activity_statuses ias,
                  wf_notifications ntf
            where ias.item_type = p_itemtype
              and ias.item_key  = p_itemkey
              and ntf.notification_id  = ias.notification_id);
Line: 4985

procedure UpdateWorkflowInfo
(
p_itemtype        in varchar2,
p_itemkey         in varchar2,
p_shipment_header_id in varchar2) IS
-- pragma AUTONOMOUS_TRANSACTION;
Line: 4992

l_api_name varchar2(50) := p_itemkey || ' UpdateWorkflowInfo';
Line: 4996

	l_progress := 'POS_WCAPPROVE_PVT.UpdateWorkflowInfo: 01';
Line: 5000

                                l_api_name,'Enter in UpdateWorkflowInfo ' || l_progress);
Line: 5009

        UPDATE rcv_shipment_headers
        SET WF_ITEM_TYPE = p_itemtype,
            WF_ITEM_KEY  = p_itemkey,
            last_updated_by         = fnd_global.user_id,
            last_update_login       = fnd_global.login_id,
            last_update_date        = sysdate
        WHERE  shipment_header_id = p_shipment_header_id;
Line: 5025

                                l_api_name,'Exception in UpdateWorkflowInfo ' || l_progress);
Line: 5028

end UpdateWorkflowInfo;
Line: 5050

                        UPDATE PO_ACTION_HISTORY
                          set object_id = p_object_id,
                              object_type_code = p_object_type_code,
                              sequence_num = p_sequence_num,
                              last_update_date = sysdate,
                              last_updated_by = p_user_id,
                              creation_date = sysdate,
                              created_by = p_user_id,
                              action_code = p_action_code,
                              action_date =  sysdate,
                              employee_id = p_employee_id,
                              last_update_login = p_login_id,
                              request_id = 0,
                              program_application_id = 0,
                              program_id = 0,
                              program_update_date = '',
                              offline_code = ''
                              WHERE
                              object_id= p_object_id and
                              object_type_code = p_object_type_code and
                              sequence_num = p_sequence_num;
Line: 5084

  select org_id
  from po_headers_all
  where po_header_id = p_document_id;
Line: 5115

    select distinct full_name
    into   l_value
    from   per_all_people_f hre
    where  hre.person_id = p_approver_id
    and trunc(sysdate) BETWEEN effective_start_date
        and effective_end_date;
Line: 5144

        select max(po_header_id)
        into l_po_header_id
        from rcv_shipment_lines
        where shipment_header_id = p_shipment_header_id;
Line: 5171

		select ship_to_org_id
		into l_ship_to_org_id
		from rcv_shipment_headers
		where shipment_header_id=p_shipment_header_id;
Line: 5183

		 SELECT        (next_receipt_num + 1)
		 INTO          x_receipt_num
		 FROM          rcv_parameters
		 WHERE         organization_id = l_ship_to_org_id
		 FOR UPDATE OF next_receipt_num;
Line: 5190

		    SELECT COUNT(*)
		    INTO   l_count
		    FROM   rcv_shipment_headers
		    WHERE  receipt_num = x_receipt_num
		    AND    ship_to_org_id = l_ship_to_org_id;
Line: 5197

		       UPDATE rcv_parameters
			  SET next_receipt_num = x_receipt_num
			WHERE organization_id = l_ship_to_org_id;
Line: 5225

        POS_WC_CREATE_UPDATE_PVT.GET_PAY_ITEM_PROGRESS
                                (p_wc_id,
                                 p_wc_stage,
                                 l_progress,
                                 l_return_status,
                                 l_return_msg);
Line: 5248

	select count(*)
	into l_count
	from gms_awards_all awd,
	gms_award_distributions adl,
	po_distributions_all pod
	where adl.award_id     = awd.award_id
	and adl.adl_line_num = 1
	and adl.po_distribution_id =pod.po_distribution_id
	and adl.award_set_id = pod.award_id
	and pod.po_distribution_id = p_wc_id;
Line: 5262

		select awd.award_number
		into l_award_number
		from gms_awards_all awd,
		gms_award_distributions adl,
		po_distributions_all pod
		where adl.award_id     = awd.award_id
		and adl.adl_line_num = 1
		and adl.po_distribution_id =pod.po_distribution_id
		and adl.award_set_id = pod.award_id
		and pod.po_header_id = p_wc_id;
Line: 5284

	select count(*)
	into l_count
	from hr_locations_all_tl hl,
	po_distributions_all pod
	where pod.deliver_to_location_id = hl.location_id and
	hl.language (+) =userenv('LANG') and
	pod.po_distribution_id = p_wc_id;
Line: 5296

		select hl.location_code
		into l_deliver_to_location
		from hr_locations_all_tl hl,
		po_distributions_all pod
		where pod.deliver_to_location_id = hl.location_id and
		hl.language (+) =userenv('LANG') and
		pod.po_distribution_id = p_wc_id;
Line: 5315

	select count(*)
	into l_count
	from po_line_locations_all poll
	where poll.line_location_id = p_wc_id
	and nvl(poll.matching_basis,'QUANTITY')='AMOUNT';
Line: 5326

		select poll.amount
		into l_amount
		from po_line_locations_all poll
		where poll.line_location_id = p_wc_id
		and nvl(poll.matching_basis,'QUANTITY')='AMOUNT';
Line: 5344

	select count(*)
	into l_count
	from po_line_locations_all poll
	where poll.line_location_id = p_wc_id
	and nvl(poll.matching_basis,'QUANTITY')='QUANTITY';
Line: 5355

		select poll.quantity
		into l_quantity
		from po_line_locations_all poll
		where poll.line_location_id = p_wc_id
		and nvl(poll.matching_basis,'QUANTITY')='QUANTITY';
Line: 5373

	select count(*)
	into l_count
	from pa_projects_all pa,
	po_distributions_all pod
	where pod.project_id = pa.project_id and
	pod.po_distribution_id = p_wc_id;
Line: 5385

		select pa.name
		into l_project_name
		from pa_projects_all pa,
		po_distributions_all pod
		where pod.project_id = pa.project_id and
		pod.po_distribution_id = p_wc_id;
Line: 5403

	select count(*)
	into l_count
	from pa_tasks_expend_v pa,
	po_distributions_all pod
	where pod.task_id = pa.task_id and
	pod.po_distribution_id = p_wc_id;
Line: 5415

		select pa.task_name
		into l_task_name
		from pa_tasks_expend_v pa,
		po_distributions_all pod
		where pod.task_id = pa.task_id and
		pod.po_distribution_id = p_wc_id;
Line: 5432

	select count(*)
	into l_count
	from gl_code_combinations_kfv glc,
	po_distributions_all pod
	where pod.code_combination_id = glc.code_combination_id and
	pod.po_distribution_id = p_wc_id;
Line: 5444

		select glc.concatenated_segments
		into l_segments
		from gl_code_combinations_kfv glc,
		po_distributions_all pod
		where pod.code_combination_id = glc.code_combination_id and
		pod.po_distribution_id = p_wc_id;
Line: 5461

	select count(*)
	into l_count
	from org_organization_definitions ood,
	po_distributions_all pod
	where pod.expenditure_organization_id = ood.organization_id
	and pod.po_distribution_id = p_wc_id;
Line: 5473

		select ood.organization_name
		into l_org_name
		from org_organization_definitions ood,
		po_distributions_all pod
		where pod.expenditure_organization_id = ood.organization_id
		and pod.po_distribution_id = p_wc_id;
Line: 5485

   Added the procedure POWC_SELECTOR to set the user context properly before
   launching the concurrent request */
-------------------------------------------------------------------------------
-- Start of Comments
-- Name: POWC_SELECTOR
-- Pre-reqs: None.
-- Modifies:
--   Application user id
--   Application responsibility id
--   Application application id
-- Locks: None.
-- Function:
--   This procedure sets the correct application context when a process is
--   picked up by the workflow background engine. When called in
--   TEST_CTX mode it compares workflow attribute org id with the current
--   org id and workflow attributes user id, responsibility id and
--   application id with their corresponding profile values. It returns TRUE
--   if these values match and FALSE otherwise. When called in SET_CTX mode
--   it sets the correct apps context based on workflow parameters.
-- Parameters:
-- IN:
--   p_itemtype
--     Specifies the itemtype of the workflow process
--   p_itemkey
--     Specifies the itemkey of the workflow process
--   p_actid
--     activity id passed by the workflow
--   p_funcmode
--     Input values can be TEST_CTX or SET_CTX (RUN not implemented)
--     TEST_CTX to test if current context is correct
--     SET_CTX to set the correct context if current context is wrong
-- IN OUT:
--   p_x_result
--     For TEST_CTX a TRUE value means that the context is correct and
--     SET_CTX need not be called. A FALSE value means that current context
--     is incorrect and SET_CTX need to set correct context
-- Testing:
--   There is not script to test this procedure but the correct functioning
--   may be tested by verifying from the debug_message in table po_wf_debug
--   that if at any time the workflow process gets started with a wrong
--   context then the selector is called in TEST_CTX and SET_CTX modes and
--   correct context is set.
-- End of Comments
-------------------------------------------------------------------------------
PROCEDURE POWC_SELECTOR ( p_itemtype   IN VARCHAR2,
                          p_itemkey    IN VARCHAR2,
                          p_actid      IN NUMBER,
                          p_funcmode   IN VARCHAR2,
                          p_x_result   IN OUT NOCOPY VARCHAR2) IS

-- Declare context setting variables start
l_session_user_id         NUMBER;
Line: 5551

    fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','Inside POWC_SELECTOR procedure');
Line: 5552

    fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','p_itemtype : '||p_itemtype);
Line: 5553

    fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','p_itemkey : '||p_itemkey);
Line: 5554

    fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','p_actid : '||p_actid);
Line: 5555

    fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','p_funcmode : '||p_funcmode);
Line: 5582

    fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','l_progress1 : '||l_progress);
Line: 5640

      l_progress := '020 selection fn responder id not null';
Line: 5643

        fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','l_progress2 : '||l_progress);
Line: 5648

      l_progress :='030 selector fn : setting user id :'||l_responder_id ||' resp id '||l_resp_id_to_set||' l_appl id '||l_appl_id_to_set;
Line: 5651

        fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','l_progress3 : '||l_progress);
Line: 5665

      l_progress := '040 selector fn responder id null';
Line: 5668

        fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','l_progress4 : '||l_progress);
Line: 5673

      l_progress := '050 selector fn : set user '||l_user_id_to_set||' resp id ' ||l_resp_id_to_set||' appl id '||l_appl_id_to_set;
Line: 5676

        fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','l_progress4 : '||l_progress);
Line: 5696

    fnd_log.string(FND_LOG.LEVEL_PROCEDURE, 'pos.plsql.POS_WCAPPROVE_PVT.POWC_SELECTOR.invoked','Exception in Selector Procedure');
Line: 5699

  WF_CORE.context('POS_WCAPPROVE_PVT', 'POWC_SELECTOR', p_itemtype, p_itemkey, p_actid, p_funcmode);
Line: 5702

END POWC_SELECTOR;