wsh_carriers wc , wsh_delivery_assignments_v wda, wsh_new_deliveries wnd , oe_order_lines_all oola , oe_lookups lk1 , oe_sets os , mtl_system_items_b_kfv msik, mtl_system_items_tl msitl , oe_order_headers_all ooha , fnd_currencies f_currency , hz_cust_site_uses_all bill_su , hz_cust_acct_sites_all bill_acct_site, hz_party_sites bill_party_site , hz_locations bill_loc , hz_parties bill_party , hz_cust_accounts bill_cust_acct , fnd_territories_tl terr1 , hz_cust_site_uses_all ship_su , hz_cust_acct_sites_all ship_acct_site, hz_party_sites ship_party_site , hz_locations ship_loc , hz_parties ship_party , hz_cust_accounts ship_cust_acctWHERE msik.inventory_item_id = msitl.inventory_item_idAND msik.organization_id = msitl.organization_idAND msitl.LANGUAGE = userenv('LANG')AND wdd.carrier_id = wc.carrier_id(+)AND wdd.organization_id = :p_organization_idAND wdd.inventory_item_id = msik.inventory_item_id(+)AND wdd.organization_id = msik.organization_id(+)AND NVL(TRUNC(oola.SCHEDULE_SHIP_DATE),TRUNC(SYSDATE)) BETWEEN NVL(:P_SCHEDULE_SHIP_DATE_LOW,NVL(TRUNC(oola.SCHEDULE_SHIP_DATE),TRUNC(SYSDATE))) AND NVL(:P_SCHEDULE_SHIP_DATE_HIGH,NVL(TRUNC(oola.SCHEDULE_SHIP_DATE),TRUNC(SYSDATE)))AND wdd.delivery_detail_id = wda.delivery_detail_idAND wda.delivery_id = wnd.delivery_id(+)AND ( wnd.delivery_type IS NULLOR wnd.delivery_type = 'STANDARD' )AND wdd.source_line_id = oola.line_idAND wdd.source_header_id = oola.header_idAND wdd.source_code = 'OE'AND wdd.container_flag IN ('N', 'Y')AND wdd.ship_set_id = os.set_id(+)AND ooha.transactional_curr_code = f_currency.currency_code(+)AND ooha.header_id = wdd.source_header_idAND ooha.invoice_to_org_id = bill_su.site_use_id(+)AND bill_su.cust_acct_site_id = bill_acct_site.cust_acct_site_id(+)AND bill_acct_site.party_site_id = bill_party_site.party_site_id(+)AND bill_acct_site.cust_account_id = bill_cust_acct.cust_account_id(+)AND bill_loc.location_id(+) = bill_party_site.location_idAND bill_cust_acct.party_id = bill_party.party_idAND bill_loc.country = terr1.territory_code(+)AND terr1.language = userenv('LANG')AND NVL(ooha.deliver_to_org_id,ooha.ship_to_org_id) = ship_su.site_use_id(+)AND ship_su.cust_acct_site_id = ship_acct_site.cust_acct_site_id(+)AND ship_acct_site.party_site_id = ship_party_site.party_site_id(+)AND ship_acct_site.cust_account_id = ship_cust_acct.cust_account_id(+)AND ship_loc.location_id(+) = ship_party_site.location_idAND ship_cust_acct.party_id = ship_party.party_idAND lk1.lookup_code(+) = ooha.freight_terms_codeAND lk1.lookup_type(+) = 'FREIGHT_TERMS'AND wdd.released_status = :p_line_statusAND :P_PICK_SLIP_NUM_LOW IS NULLAND :P_PICK_SLIP_NUM_HIGH IS NULLAND DECODE (:P_MOVE_ORDER_HIGH,NULL,'1', (SELECT TO_CHAR(mtrh.request_number) FROM mtl_txn_request_headers mtrh, mtl_txn_request_lines mtrl WHERE mtrh.header_id = mtrl.header_id AND mtrl.line_id = wdd.move_order_line_id ) ) = NVL(TO_CHAR(:P_MOVE_ORDER_HIGH),'1')AND EXISTS ( ( SELECT 1 FROM dual WHERE 1 =1 AND 'All' = :p_print )UNION (SELECT 1 FROM DUAL WHERE 1 = 1 AND 'Original' = :p_print AND NVL(OOHA.ATTRIBUTE7,'N') != 'Y' )UNION (SELECT 1 FROM DUAL WHERE 1 = 1 AND 'Duplicate' = :p_print AND NVL(OOHA.ATTRIBUTE7,'N') = 'Y' ) )AND ooha.order_number = to_number(:p_order_num_low)AND ooha.ORDER_TYPE_ID = to_number(:p_order_type_id)AND 1 =1AND 1 =1AND NOT EXISTS (SELECT 1 FROM mtl_material_transactions mmt, mtl_txn_request_lines mtrl WHERE mmt.pick_slip_number IS NOT NULL AND mmt.move_order_line_id = mtrl.line_id AND WDD.MOVE_ORDER_LINE_ID = mtrl.line_id )ORDER BY PICK_SLIP_NUMBER, CF_ORDER_NUMBER , SSD , SALES_LINE_NUMBER;