The following lines contain the word 'select', 'insert', 'update' or 'delete':
Lines cursor: select only the open lines
-----------------------------------------------------------
*/
CURSOR l_line_cursor IS
SELECT orig_sys_line_ref
, orig_sys_shipment_ref
, line_id
, line_number
, shipment_number
, option_number
, ship_to_org_id
FROM oe_order_lines
WHERE header_id = l_header_rec.header_id
AND nvl(ordered_quantity, 0) > 0
ORDER BY orig_sys_line_ref, orig_sys_shipment_ref;
OE_Globals.G_OPR_INSERT)
THEN
IF nvl(l_header_rec.change_sequence, ' ') <> ' ' THEN
IF l_debug_level > 0 THEN
oe_debug_pub.add( 'CHANGE SEQUENCE NOT REQUIRED FOR NEW ORDERS... ' ) ;
ELSIF l_header_rec.operation = OE_Globals.G_OPR_DELETE THEN
IF nvl(l_header_rec.change_sequence, ' ') <> ' ' THEN
IF l_debug_level > 0 THEN
oe_debug_pub.add( 'CHANGE SEQUENCE NOT REQUIRED FOR DELETING EXISTING ORDERS... ' ) ;
ELSIF l_header_rec.operation = OE_Globals.G_OPR_UPDATE THEN
IF nvl(l_header_rec.change_sequence,' ') = ' ' THEN
IF l_debug_level > 0 THEN
oe_debug_pub.add( 'CHANGE SEQUENCE REQUIRED FOR CHANGES TO AN EXISTING ORDER... ' ) ;
SELECT change_sequence, ship_to_org_id
INTO l_change_sequence, l_header_ship_to_org_id
FROM oe_order_headers
WHERE order_source_id = l_header_rec.order_source_id
AND orig_sys_document_ref = l_header_rec.orig_sys_document_ref
AND decode(l_customer_key_profile, 'Y',
nvl(sold_to_org_id, FND_API.G_MISS_NUM), 1)
= decode(l_customer_key_profile, 'Y',
nvl(l_header_rec.sold_to_org_id, FND_API.G_MISS_NUM), 1);
IF l_header_rec.operation = OE_Globals.G_OPR_UPDATE AND -- update operation
nvl(l_header_rec.change_sequence,' ') <> ' ' AND -- new code not null
l_header_rec.ship_to_org_id <> FND_API.G_MISS_NUM AND
nvl(l_header_rec.ship_to_org_id, FND_API.G_MISS_NUM) <>
nvl(l_header_ship_to_org_id, FND_API.G_MISS_NUM) -- new code not same as old
THEN
IF l_debug_level > 0 THEN
oe_debug_pub.add( 'BEFORE READING ALL OPEN SHIPMENTS' ) ;
If l_line_tbl(I).operation = OE_Globals.G_OPR_UPDATE AND
nvl(l_line_tbl(I).ship_to_org_id, FND_API.G_MISS_NUM) <>
nvl(l_header_rec.ship_to_org_id, FND_API.G_MISS_NUM) Then
l_line_tbl(I).ship_to_org_id := l_header_rec.ship_to_org_id;
If l_line_tbl(I).operation = OE_Globals.G_OPR_UPDATE AND
nvl(l_line_tbl(I).ship_to_org_id, FND_API.G_MISS_NUM) <>
nvl(l_header_rec.ship_to_org_id, FND_API.G_MISS_NUM) Then
l_line_tbl(I).ship_to_org_id := l_header_rec.ship_to_org_id;
l_line_tbl(l_line_count).operation:= OE_Globals.G_OPR_UPDATE;