1234: INTO x_different
1235: from sys.dual
1236: where exists(
1237: select null
1238: FROM PO_LINE_LOCATIONS POLL,
1239: PO_LINE_LOCATIONS_ARCHIVE POLLA
1240: WHERE POLL.po_header_id = p_doc_id
1241: AND POLL.po_release_id is null -- Bug 3876235
1242: AND (p_line_id IS NULL OR POLL.po_line_id = p_line_id) --
1235: from sys.dual
1236: where exists(
1237: select null
1238: FROM PO_LINE_LOCATIONS POLL,
1239: PO_LINE_LOCATIONS_ARCHIVE POLLA
1240: WHERE POLL.po_header_id = p_doc_id
1241: AND POLL.po_release_id is null -- Bug 3876235
1242: AND (p_line_id IS NULL OR POLL.po_line_id = p_line_id) --
1243: AND (p_line_location_id IS NULL OR POLL.line_location_id = p_line_location_id) --
1325: INTO x_different
1326: from sys.dual
1327: where exists(
1328: select null
1329: FROM PO_LINE_LOCATIONS POLL,
1330: PO_LINE_LOCATIONS_ARCHIVE POLLA
1331: WHERE POLL.po_header_id = p_doc_id
1332: AND POLL.po_release_id is null -- Bug 3876235
1333: AND (p_line_id IS NULL OR POLL.po_line_id = p_line_id) --
1326: from sys.dual
1327: where exists(
1328: select null
1329: FROM PO_LINE_LOCATIONS POLL,
1330: PO_LINE_LOCATIONS_ARCHIVE POLLA
1331: WHERE POLL.po_header_id = p_doc_id
1332: AND POLL.po_release_id is null -- Bug 3876235
1333: AND (p_line_id IS NULL OR POLL.po_line_id = p_line_id) --
1334: AND (p_line_location_id IS NULL OR POLL.line_location_id = p_line_location_id) --
1412: SELECT 'Y'
1413: INTO x_different
1414: FROM po_price_differentials pdf,
1415: po_price_differentials_archive pdfa,
1416: po_line_locations_all poll
1417: WHERE poll.po_header_id = p_doc_id
1418: AND poll.line_location_id = pdf.entity_id
1419: AND pdf.entity_type = 'PRICE BREAK'
1420: AND pdf.price_differential_id = pdfa.price_differential_id (+)
1450: where exists(
1451: select null
1452: FROM PO_DISTRIBUTIONS POD,
1453: PO_DISTRIBUTIONS_ARCHIVE PODA,
1454: PO_LINE_LOCATIONS POLL --Bug 13960467
1455: WHERE POD.po_header_id = p_doc_id
1456: AND (POD.line_location_id = POLL.line_location_id) --Bug 13960467
1457: AND (p_line_id IS NULL OR POD.po_line_id = p_line_id) --
1458: AND (p_line_location_id IS NULL OR POD.line_location_id = p_line_location_id) --
1588: INTO x_different
1589: from sys.dual
1590: where exists(
1591: select null
1592: FROM PO_LINE_LOCATIONS POLL,
1593: PO_LINE_LOCATIONS_ARCHIVE POLLA
1594: WHERE POLL.po_release_id = p_doc_id
1595: AND (p_line_location_id IS NULL OR POLL.line_location_id = p_line_location_id) --
1596: AND POLL.line_location_id = POLLA.line_location_id (+)
1589: from sys.dual
1590: where exists(
1591: select null
1592: FROM PO_LINE_LOCATIONS POLL,
1593: PO_LINE_LOCATIONS_ARCHIVE POLLA
1594: WHERE POLL.po_release_id = p_doc_id
1595: AND (p_line_location_id IS NULL OR POLL.line_location_id = p_line_location_id) --
1596: AND POLL.line_location_id = POLLA.line_location_id (+)
1597: AND POLLA.latest_external_flag (+) = 'Y'
2185: x_token_name_tbl(5),
2186: x_token_value_tbl(5)
2187:
2188: FROM
2189: po_line_locations_archive_all poall,
2190: po_line_locations_all poll,
2191: po_headers_all poh,
2192: po_lines_all pol,
2193: po_distributions_all pod ---
2186: x_token_value_tbl(5)
2187:
2188: FROM
2189: po_line_locations_archive_all poall,
2190: po_line_locations_all poll,
2191: po_headers_all poh,
2192: po_lines_all pol,
2193: po_distributions_all pod ---
2194: WHERE
2207: OR Nvl(poll.promised_date,sysdate) <> Nvl(poall.promised_date,sysdate)
2208: OR Nvl(poll.need_by_date,sysdate) <> Nvl(poall.need_by_date,sysdate))
2209: AND poll.line_location_id IN
2210: ( SELECT line_location_id
2211: FROM po_line_locations_all
2212: WHERE line_location_id = p_line_location_id
2213: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_SHIPMENT
2214: AND 0= (SELECT Count(1)
2215: FROM po_distributions_all pod
2218: FROM po_distributions_archive_all poad
2219: WHERE pod.po_distribution_id=poad.po_distribution_id))
2220: UNION ALL
2221: SELECT line_location_id
2222: FROM po_line_locations_all
2223: WHERE po_line_id = p_line_id
2224: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_LINE
2225: AND 0= (SELECT Count(1)
2226: FROM po_line_locations_all poll
2222: FROM po_line_locations_all
2223: WHERE po_line_id = p_line_id
2224: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_LINE
2225: AND 0= (SELECT Count(1)
2226: FROM po_line_locations_all poll
2227: WHERE po_line_id=p_line_id
2228: AND NOT EXISTS (SELECT line_location_id
2229: FROM po_line_locations_archive_all poall
2230: WHERE poll.line_location_id=poall.line_location_id))
2225: AND 0= (SELECT Count(1)
2226: FROM po_line_locations_all poll
2227: WHERE po_line_id=p_line_id
2228: AND NOT EXISTS (SELECT line_location_id
2229: FROM po_line_locations_archive_all poall
2230: WHERE poll.line_location_id=poall.line_location_id))
2231: AND 0= (SELECT Count(1)
2232: FROM po_distributions_all pod
2233: WHERE pod.po_line_id=p_line_id
2237:
2238:
2239: UNION ALL
2240: SELECT line_location_id
2241: FROM po_line_locations_all
2242: WHERE po_header_id = p_doc_id
2243: AND p_doc_type <> PO_DOCUMENT_CANCEL_PVT.c_doc_type_RELEASE
2244: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_HEADER
2245: AND 0= (SELECT Count(1)
2242: WHERE po_header_id = p_doc_id
2243: AND p_doc_type <> PO_DOCUMENT_CANCEL_PVT.c_doc_type_RELEASE
2244: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_HEADER
2245: AND 0= (SELECT Count(1)
2246: FROM po_line_locations_all poll
2247: WHERE po_header_id = p_doc_id
2248: AND NOT EXISTS (SELECT line_location_id
2249: FROM po_line_locations_archive_all poall
2250: WHERE poll.line_location_id=poall.line_location_id))
2245: AND 0= (SELECT Count(1)
2246: FROM po_line_locations_all poll
2247: WHERE po_header_id = p_doc_id
2248: AND NOT EXISTS (SELECT line_location_id
2249: FROM po_line_locations_archive_all poall
2250: WHERE poll.line_location_id=poall.line_location_id))
2251: AND 0= (SELECT Count(1)
2252: FROM po_distributions_all pod
2253: WHERE pod.po_header_id=p_doc_id
2258:
2259:
2260: UNION ALL
2261: SELECT line_location_id
2262: FROM po_line_locations_all
2263: WHERE po_release_id = p_doc_id
2264: AND p_doc_type = PO_DOCUMENT_CANCEL_PVT.c_doc_type_RELEASE
2265: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_HEADER
2266: AND 0= (SELECT Count(1)
2263: WHERE po_release_id = p_doc_id
2264: AND p_doc_type = PO_DOCUMENT_CANCEL_PVT.c_doc_type_RELEASE
2265: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_HEADER
2266: AND 0= (SELECT Count(1)
2267: FROM po_line_locations_all poll
2268: WHERE po_release_id = p_doc_id
2269: AND NOT EXISTS (SELECT line_location_id
2270: FROM po_line_locations_archive_all poall
2271: WHERE poll.line_location_id=poall.line_location_id))
2266: AND 0= (SELECT Count(1)
2267: FROM po_line_locations_all poll
2268: WHERE po_release_id = p_doc_id
2269: AND NOT EXISTS (SELECT line_location_id
2270: FROM po_line_locations_archive_all poall
2271: WHERE poll.line_location_id=poall.line_location_id))
2272: AND 0= (SELECT Count(1)
2273: FROM po_distributions_all pod
2274: WHERE pod.po_release_id=p_doc_id
2298: -- Or if the encumbrance is On and any of the enc. related field is modified
2299: -- then do not allow cancel action , ask user to undo the changes
2300: SELECT 'PO_CHANGED_CANT_CANCEL'
2301: INTO x_msg_name
2302: FROM po_line_locations_all poll,
2303: po_distributions_all pod ---
2304: WHERE poll.line_location_id = pod.line_location_id
2305: AND (l_po_encumbrance_flag = 'Y' AND pod.encumbered_flag = 'N')
2306: ---
2305: AND (l_po_encumbrance_flag = 'Y' AND pod.encumbered_flag = 'N')
2306: ---
2307: AND Nvl(poll.approved_flag,'N') <>'Y'
2308: AND ((NOT EXISTS (SELECT 'Archive Exists'
2309: FROM po_line_locations_archive_all poall
2310: WHERE poll.line_location_id=poall.line_location_id)
2311: OR (0 <> (SELECT Count(1)
2312: FROM po_distributions_all pod
2313: WHERE pod.line_location_id=poll.line_location_id
2318: ))
2319:
2320: OR(l_po_encumbrance_flag = 'Y'
2321: AND (EXISTS (SELECT 'Enc Columns Changed'
2322: FROM po_line_locations_archive_all poall
2323: WHERE poll.line_location_id=poall.line_location_id
2324: AND poall.latest_external_flag ='Y'
2325: AND (nvl(poll.price_override,0) <> Nvl(poall.price_override,0)
2326: OR Nvl(poll.quantity,0) <> Nvl(poall.quantity,0)
2342: )
2343: AND ROWNUM<2
2344: AND poll.line_location_id IN
2345: ( SELECT line_location_id
2346: FROM po_line_locations_all
2347: WHERE line_location_id = p_line_location_id
2348: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_SHIPMENT
2349: UNION ALL
2350: SELECT line_location_id
2347: WHERE line_location_id = p_line_location_id
2348: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_SHIPMENT
2349: UNION ALL
2350: SELECT line_location_id
2351: FROM po_line_locations_all
2352: WHERE po_line_id = p_line_id
2353: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_LINE
2354: UNION ALL
2355: SELECT line_location_id
2352: WHERE po_line_id = p_line_id
2353: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_LINE
2354: UNION ALL
2355: SELECT line_location_id
2356: FROM po_line_locations_all
2357: WHERE po_header_id = p_doc_id
2358: AND p_doc_type <> PO_DOCUMENT_CANCEL_PVT.c_doc_type_RELEASE
2359: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_HEADER
2360: UNION ALL
2358: AND p_doc_type <> PO_DOCUMENT_CANCEL_PVT.c_doc_type_RELEASE
2359: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_HEADER
2360: UNION ALL
2361: SELECT line_location_id
2362: FROM po_line_locations_all
2363: WHERE po_release_id = p_doc_id
2364: AND p_doc_type = PO_DOCUMENT_CANCEL_PVT.c_doc_type_RELEASE
2365: AND p_action_level = PO_DOCUMENT_CANCEL_PVT.c_entity_level_HEADER);
2366: x_msg_type :='E';