The following lines contain the word 'select', 'insert', 'update' or 'delete':
/* Determine and Update the Close Status of Purchase Order Shipments */
/* and rollup if necessary */
/* */
/* Auto Closing determines and updates the Close Status of the Shipments */
/* and rolls up to the Lines and Headers */
/* */
/* Manual Closing determines and updates the Close Status of Shipments, */
/* Lines or Headers and rolls up if required */
/* */
/* When the parameter p_auto_close is set to 'Y', Auto Closing is */
/* invoked; otherwise Manual Closing is invoked */
PO_DOCUMENT_ACTION_PVT.auto_update_close_state(
p_document_id => p_docid
, p_document_type => p_doctyp
, p_document_subtype => p_docsubtyp
, p_line_id => p_lineid
, p_shipment_id => p_shipid
, p_calling_mode => p_calling_mode
, p_called_from_conc => l_from_conc
, x_return_status => l_ret_sts
, x_exception_msg => l_exc_msg
, x_return_code => l_ret_code
);
select max(action_date)
into l_closed_date
from
( select RT.transaction_date action_date
from rcv_transactions RT
where RT.TRANSACTION_TYPE IN ('RECEIVE','ACCEPT','CORRECT','MATCH')
and RT.po_line_location_id = p_line_location_id
union
select AP.invoice_date action_date
from ap_invoice_distributions_all AD,
ap_invoices_all AP,
po_distributions_all POD
where AD.invoice_id = AP.invoice_id
and AD.po_distribution_id = POD.po_distribution_id
and POD.line_location_id = p_line_location_id
and nvl(AD.reversal_flag,'N') NOT IN ('Y')
);
select max(AP.invoice_date)
into l_closed_date
from ap_invoice_distributions_all AD,
ap_invoices_all AP,
po_distributions_all POD
where AD.invoice_id = AP.invoice_id
and AD.po_distribution_id = POD.po_distribution_id
and POD.line_location_id = p_line_location_id
and nvl(AD.reversal_flag,'N') NOT IN ('Y');
select max(RT.transaction_date)
into l_closed_date
from rcv_transactions RT
where RT.TRANSACTION_TYPE IN ('RECEIVE','ACCEPT','CORRECT','MATCH')
and RT.po_line_location_id = p_line_location_id;