The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT count(PLL.line_location_id)
INTO X_number_shipments
FROM po_line_locations PLL
WHERE PLL.po_line_id = X_po_line_id
AND PLL.shipment_type = X_shipment_type;
SELECT nvl(PLL.approved_flag,'N'),
nvl(PLL.encumbered_flag,'N'),
nvl(PLL.closed_code,'OPEN'),
nvl(PLL.cancel_flag,'N')
FROM po_line_locations PLL
WHERE PLL.line_location_id = X_line_location_id
AND PLL.shipment_type = X_shipment_type;
FUNCTION NAME: update_shipment_qty
===========================================================================*/
FUNCTION update_shipment_qty
(X_line_location_id IN NUMBER,
X_shipment_type IN VARCHAR2,
X_line_quantity IN NUMBER) RETURN BOOLEAN IS
X_progress VARCHAR2(3) := '';
X_last_updated_by NUMBER := '';
X_last_updated_by := fnd_global.user_id;
po_debug.put_line('Before update statement');
** Update the purchase order shipment quantity to the lines qty.
*/
UPDATE PO_LINE_LOCATIONS
SET quantity = X_line_quantity,
approved_flag = decode(approved_flag, 'N', 'N', 'R'),
last_update_date = sysdate,
last_updated_by = X_last_updated_by,
last_update_login = X_login_id
WHERE line_location_id = X_line_location_id
AND shipment_type = X_shipment_type;
po_debug.put_line('In UPDATE exception');
po_message_s.sql_error('update_shipment_qty', X_progress, sqlcode);
END update_shipment_qty;
Issues: Should you be able to update the quantity
on a shipment if is finally closed?
DEBUG.
===========================================================================*/
FUNCTION val_ship_qty
(X_po_line_id IN NUMBER,
X_shipment_type IN VARCHAR2,
X_line_quantity IN NUMBER) RETURN BOOLEAN IS
X_progress VARCHAR2(3) := '';
** with checks. Otherwise, we should not update the price.
*/
IF (X_shipment_type = 'STANDARD' OR X_shipment_type = 'PLANNED') THEN
null;
** we should not update the quantity on the shipment.
*/
IF (X_number_shipments = 1) THEN
X_line_location_id := po_shipments_sv3.get_line_location_id(X_po_line_id,
X_shipment_type);
** Allow the quantity to be updated if the shipment is
** not encumbered, cancelled or finally closed..
*/
IF ( (X_encumbered_flag = 'N') AND
(X_cancelled_flag = 'N') AND
(X_closed_code <> 'FINALLY CLOSED') ) THEN
IF po_shipments_sv2.update_shipment_qty (X_line_location_id,
X_shipment_type,
X_line_quantity) THEN
RETURN(TRUE);
** with checks. Otherwise, we should not update the price.
*/
IF (X_shipment_type = 'STANDARD' OR X_shipment_type = 'PLANNED') THEN
null;
IF po_shipments_sv2.update_shipment_price (X_po_line_id,
X_shipment_type,
X_unit_price) THEN
IF (g_po_pdoi_write_to_file = 'Y') THEN
po_debug.put_line('Returned TRUE');
FUNCTION NAME: update_shipment_price
DEBUG: Should we allow you to update the price
on a finally closed shipment?
===========================================================================*/
FUNCTION update_shipment_price
(X_po_line_id IN NUMBER,
X_shipment_type IN VARCHAR2,
X_unit_price IN NUMBER) RETURN BOOLEAN IS
X_progress VARCHAR2(3) := '';
X_last_updated_by NUMBER := '';
X_last_updated_by := fnd_global.user_id;
po_debug.put_line('Before update statement');
** Update the purchase order shipment price to the lines unit
** price for all shipments that are not cancelled.
*/
UPDATE PO_LINE_LOCATIONS
SET price_override = X_unit_price,
approved_flag = decode(approved_flag, 'N', 'N', 'R'),
last_update_date = sysdate,
last_updated_by = X_last_updated_by,
last_update_login = X_login_id
WHERE po_line_id = X_po_line_id
AND nvl(cancel_flag,'N') = 'N'
AND nvl(closed_code,'OPEN') <> 'FINALLY CLOSED'
AND shipment_type in ('STANDARD','PLANNED');
po_debug.put_line('In UPDATE exception');
po_message_s.sql_error('update_shipment_price', X_progress, sqlcode);
END update_shipment_price;
SELECT (substrb(rtrim(address1)||'-'||rtrim(city),1,20)) ship_to_location_code
INTO x_ship_to_location_code
FROM hz_locations
WHERE location_id = x_ship_to_location_id;