Showing posts with label OM. Show all posts
Showing posts with label OM. Show all posts

Thursday, 23 March 2017

Oracle Drop Ship Setups and Prerequisites

Oracle Drop Ship Setups and Prerequisites

OM Drop Ship Setups and prerequisites:
          Inventory, Order Management and Purchasing Setup.
          Seeded order type ‘Mixed’ which has workflow for drop shipments
          For customer, enter internal ship to location
          All drop ship items must be defined in the item validation organization
          User should be setup as a valid PO buyer
          Valid item assigned to a price list
          Valid customer with ship-to and bill-to locations
          Valid OM transaction type for drop ship orders

Check the blog posts:

OM Drop Ship process

Drop Shipment Overview

Oracle Drop Ship tables

 

Inventory setups:
1.    Inventory Setup (Define and Maintain The Item)
2.    The drop ship inventory organization, item and sub inventory must be setup prior to creating any drop ship orders.
3.    All drop ship sub inventory must have the Reservable box checked.
4.    Following are list of the required item attributes for a drop ship item. All of these attributes MUST be enabled unless otherwise specified.
o    Inventory Attributes:
Inventory Item, Stockable, Transactable, Reservable


o    Purchasing Attributes:
Purchased, Purchaseable, Assign a purchase price and a default buyer (Optional)


o    Costing Attributes:
Costing Enabled – this should only be checked for items that are cost enabled, Inventory.
Asset Value – this should only be checked for asset items (non-expense items)


o    Order Management Attributes:
Customer Ordered, Customer Orders Enabled, OE Transactable, Default SO Source Type: External



o    Receiving Attributes:
Receipt Routing set to Direct – this is not required, but preferred since it makes receiving process one step versus two or three.

Order Management Setups:
1.    Make sure the sales order line Source Type is External. If the source type is not External, workflow will not distinguish the line as being a drop shipment and will not insert any data into the purchasing module’s requisitions interface.
2.    Make sure that either the schedule ship date or request date is populated. If both of these are null, the requisition will not be imported into the purchasing module’s requisitions interface.
3.    Make sure there are no holds against the line. If there is a hold, the hold must be removed and then the order can be progressed or the line must be manually purchased release.
4.    Verify in HR, that the employee has an active status and has not been terminated.
PO Setups:
1.    Make sure the Import Source parameter list of values contains ORDER ENTRY. If ORDER ENTRY appears in the Import Source parameter list of values, then it means that the Workflow Background Processor successfully inserted a requisition into PO_REQUISITIONS_INTERFACE_ALL.
2.    If ORDER ENTRY is not visible in the Import Source parameter list of values, then no rows were inserted into the table. Review the setup under Order Management.
3.    Make sure the Group By parameter is actually set the user wants the requisitions grouped.

Customer setup:
Ensure you have defined the Internal Ship To Locations for your drop shipment customers (Oracle Receivables Standard Customer window, Business Purpose Details Tab).
1.    Create an Internal location for your Inventory Organization.
In the Purchasing Super User responsibility: 
Navigate to:        Setup>Organizations>Locations




2.    Assign the Internal location to the Drop ship customer
In the Accounts Receivable or Order Management Responsibility:
Navigate to: Customers Standard
The Customers - Standard form displays.
Query the Customer being setup in this form.
Navigate to the Addresses Tab and select the address that has been setup as the Ship To location.
Select the Open button.
The Customers Addresses form displays.
In the Business Purposes Tab select the Ship To Usage.
Select the Open button.
This displays the Business Purposes Detail form:


System Administrator setups:
Change to System Administrator Responsibility
1.    Verify profile option: OM: Population of Buyer Code for Dropship Lines
Navigate to Profile -> System.
§  Query up profile called OM: Population of Buyer Code for Dropship Lines
Set the profile value as follows:
§  Set value to Null to have system retrieve the buyer information from the master item
Set the value to Order Creator to let the system retrieve the buyer information from the employee id creating the sales order. Note that the sales people need to be defined as buyers in PO.


2.    Setup PO Buyer to the User name: OPERATIONS
Navigate to Security -> User -> Define.
§  Query up the user name and make sure it has an employee name assigned to it that is setup as a buyer.

Friday, 18 November 2016

Query to get the Defaulting rules defined in Order Managment

/* Formatted on 11/18/2016 4:01:35 PM (QP5 v5.114.809.3010) */
SELECT   d.database_object_display_name,
         d.attribute_display_name,
         d.precedence,
         d.display_name,
         d.system_flag,
         d.enabled_flag,
         k.sequence_no,
         l.meaning,
         DECODE (src_type,
                 'API',
                 src_api_pkg || '.' || src_api_fn,
                 'CONSTANT',
                 src_constant_value,
                 'SYSTEM',
                 src_system_variable_expr,
                 'SEQUENCE',
                 src_sequence_name,
                 'DATABASE',
                 src_database_object_name || '.' || src_attribute_code,
                 'WAD_ATTR',
                 ' ',
                 'WAD_OBJATTR',
                 ' ',
                 src_constant_value)
            source,
         src_type,
         k.attribute_code
  FROM   oe_def_attr_condns_v d, oe_lookups l, oe_def_attr_rules_v k
 WHERE       d.database_object_name = k.database_object_name
         AND d.attr_def_condition_id = k.attr_def_condition_id
         AND d.condition_id = k.condition_id
         AND d.attribute_code = k.attribute_code
         AND k.src_type NOT IN
                  ('RELATED_RECORD', 'SAME_RECORD', 'PROFILE_OPTION')
         AND l.lookup_type = 'DEFAULTING_SOURCE_TYPE'
         AND (k.src_type = l.lookup_code
              OR (k.src_type = k.attribute_code
                  AND l.lookup_code = 'CONSTANT'))
UNION
SELECT   d.database_object_display_name,
         d.attribute_display_name,
         d.precedence,
         d.display_name,
         d.system_flag,
         d.enabled_flag,
         k.sequence_no,
         l.meaning,
         a.object_name || '.' || a.name source,
         src_type,
         k.attribute_code
  FROM   oe_def_attr_condns_v d,
         oe_lookups l,
         oe_def_attr_rules_v k,
         ak_object_attributes_vl a
 WHERE       d.database_object_name = k.database_object_name
         AND d.attr_def_condition_id = k.attr_def_condition_id
         AND d.condition_id = k.condition_id
         AND d.attribute_code = k.attribute_code
         AND a.database_object_name(+) = k.src_database_object_name
         AND a.attribute_code(+) = k.src_attribute_code
         AND l.lookup_type = 'DEFAULTING_SOURCE_TYPE'
         AND k.src_type = l.lookup_code
         AND k.src_type = 'RELATED_RECORD'
UNION
SELECT   d.database_object_display_name,
         d.attribute_display_name,
         d.precedence,
         d.display_name,
         d.system_flag,
         d.enabled_flag,
         k.sequence_no,
         l.meaning,
         a.name source,
         src_type,
         k.attribute_code
  FROM   oe_def_attr_condns_v d,
         oe_lookups l,
         oe_def_attr_rules_v k,
         ak_object_attributes_vl a
 WHERE       d.database_object_name = k.database_object_name
         AND d.attr_def_condition_id = k.attr_def_condition_id
         AND d.condition_id = k.condition_id
         AND d.attribute_code = k.attribute_code
         AND a.database_object_name(+) = k.database_object_name
         AND a.attribute_code(+) = k.src_attribute_code
         AND l.lookup_type = 'DEFAULTING_SOURCE_TYPE'
         AND k.src_type = l.lookup_code
         AND k.src_type = 'SAME_RECORD'
UNION
SELECT   d.database_object_display_name,
         d.attribute_display_name,
         d.precedence,
         d.display_name,
         d.system_flag,
         d.enabled_flag,
         k.sequence_no,
         l.meaning,
         a.user_profile_option_name source,
         src_type,
         k.attribute_code
  FROM   oe_def_attr_condns_v d,
         oe_lookups l,
         oe_def_attr_rules_v k,
         fnd_profile_options_vl a
 WHERE       d.database_object_name = k.database_object_name
         AND d.attr_def_condition_id = k.attr_def_condition_id
         AND d.condition_id = k.condition_id
         AND a.profile_option_name(+) = k.src_profile_option
         AND l.lookup_type = 'DEFAULTING_SOURCE_TYPE'
         AND k.src_type = l.lookup_code
         AND k.src_type = 'PROFILE_OPTION'

Query to get the OM Sales Order summary details:-

/* Formatted on 11/18/2016 4:00:35 PM (QP5 v5.114.809.3010) */
  SELECT   h.transactional_curr_code Currency,
           h.conversion_rate Conversion_rate,
           h.conversion_type_code Conversion_Type_Code,
           h.transactional_curr_code use_currency,
           DECODE (SUBSTR (UPPER (:p_order_by), 1, 1), 'S', sr.name, NULL)
              Sales_Person,
           DECODE (SUBSTR (UPPER (:p_order_by), 1, 1),
                   'O', h.ordered_date,
                   NULL)
              dummy_order_date,
           DECODE (SUBSTR (UPPER (:p_order_by), 1, 1), 'A', agree.name, NULL)
              dummy_agreement,
           DECODE (SUBSTR (UPPER (:p_order_by), 1, 1),
                   'P', h.cust_po_number,
                   NULL)
              dummy_po_num,
           ot.name Order_Type,
           DECODE (SUBSTR (UPPER (:p_order_by), 1, 1),
                   'C', party.party_name,
                   NULL)
              Customer_Name1,
           h.order_number Order_Number,
           h.cust_po_number PO_Number,
           h.ordered_date Order_Date,
           party.party_name Customer_Name3,
           h.header_id Header_id,
           u.user_name created_by,
           h.flow_status_code,
           fl.meaning Order_Status,
           agree.name Agreement,
           sr.name Salesrep,
           NVL (
              SUM(DECODE (
                     l.line_category_code,
                     'RETURN',
                     (  NVL (l.unit_list_price, 0)
                      * (NVL (l.ordered_quantity, 0))
                      * (-1)),
                     (NVL (l.unit_list_price, 0)
                      * (NVL (l.ordered_quantity, 0)))
                  )),
              0
           )
              List_Value,
           NVL (
              SUM(DECODE (
                     l.line_category_code,
                     'RETURN',
                     (  NVL (l.unit_selling_price, 0)
                      * (NVL (l.ordered_quantity, 0))
                      * (-1)),
                     (NVL (l.unit_selling_price, 0)
                      * (NVL (l.ordered_quantity, 0)))
                  )),
              0
           )
              Order_Amount,
           NVL (
              SUM(DECODE (
                     l.line_category_code,
                     'RETURN',
                     (  NVL (l.unit_selling_price, 0)
                      * (NVL (l.shipped_quantity, 0))
                      * (-1)),
                     (NVL (l.unit_selling_price, 0)
                      * (NVL (l.shipped_quantity, 0)))
                  )),
              0
           )
              Ship_Value,
           l.charge_periodicity_code
    FROM   oe_order_headers_all h,
           oe_order_lines_all l,
           oe_transaction_types_tl ot,
           fnd_user u,
           fnd_lookup_values fl,
           oe_agreements_tl agree,
           HZ_CUST_SITE_USES_ALL su,
           hz_party_sites party_site,
           hz_locations loc,
           hz_cust_acct_sites_all acct_site,
           ra_salesreps sr,
           fnd_territories_vl terr,
           hz_parties party,
           hz_cust_accounts cust_acct
   WHERE       h.sold_to_org_id = cust_acct.cust_account_id
           AND cust_acct.party_id = party.party_id
           AND h.header_id = l.header_id(+)
           AND NVL (h.org_id, 0) = NVL (:p_org_id, 0)
           AND h.order_type_id = ot.transaction_type_id
           AND ot.language = USERENV ('LANG')
           AND sr.salesrep_id(+) = h.salesrep_id
           AND NVL (sr.org_id(+), NVL (:p_org_id, 0)) = NVL (:p_org_id, 0)
           AND h.agreement_id = agree.agreement_id(+)
           AND agree.language(+) = USERENV ('LANG')
           AND h.created_by = u.user_id
           AND h.ship_to_org_id = su.site_use_id(+)
           AND acct_site.party_site_id = party_site.party_site_id(+)
           AND loc.location_id(+) = party_site.location_id
           AND su.CUST_ACCT_SITE_ID = acct_site.cust_acct_site_id(+)
           AND loc.country = terr.territory_code(+)
           AND fl.lookup_type = 'FLOW_STATUS'
           AND fl.lookup_code = h.flow_status_code
           AND fl.language = USERENV ('LANG')
GROUP BY   h.transactional_curr_code,
           h.conversion_rate,
           h.conversion_type_code,
           DECODE (:p_use_functional_currency,
                   'N', h.transactional_curr_code,
                   :rp_functional_currency),
           sr.name,
           cust_acct.cust_account_id,
           h.order_number,
           h.cust_po_number,
           h.ordered_date,
           party.party_name,
           ot.name,
           h.header_id,
           h.flow_status_code,
           fl.meaning,
           agree.name,
           u.user_name,
           l.charge_periodicity_code
ORDER BY   1,
           DECODE (SUBSTR (UPPER (:p_order_by), 1, 1),
                   'S', sr.name,
                   'O', h.ordered_date,
                   h.order_number),
           DECODE (SUBSTR (UPPER (:p_order_by), 1, 1),
                   'S',
                   party.party_name,
                   'O',
                   party.party_name),
           h.order_number

Retroactive billing report in oracle order management:-

/* Formatted on 11/18/2016 3:59:06 PM (QP5 v5.114.809.3010) */
SELECT   DECODE (:p_sort_by, 'O', orig_head.order_number)
            sort_by_order_number,
         DECODE (
            :p_sort_by,
            'T',
            oe_retrobill_pvt.invoice_number (orig_head.order_number,
                                             orig_lin.line_id,
                                             orig_head.order_type_id),
            NULL
         )
            sort_by_invoice_no,
         DECODE (
            SUBSTR (UPPER (:p_item_display), 1, 1),
            'P',
            NVL (orig_lin.user_item_description, item_info.item_description),
            'D',
            NVL (orig_lin.user_item_description, si_tl.description),
            'O',
            item_info.item,
            'F',
            item_info.inventory_item,
            'C',
            item_info.item || ' - '
            || NVL (orig_lin.user_item_description,
                    item_info.item_description),
            'I',
               item_info.inventory_item
            || ' - '
            || NVL (orig_lin.user_item_description, si_tl.description),
            NVL (orig_lin.user_item_description, item_info.item_description)
         )
            item_name,
         oe_order_misc_pub.get_concat_line_number (orig_lin.line_id) line_no,
         party.party_name customer_name,
         site.location invoice_to_name,
         orig_head.order_number,
         orig_head.ordered_date ordered_date,
         orig_head.transactional_curr_code currency,
         orig_lin.ordered_quantity Ordered,
         orig_lin.shipped_quantity Shipped,
         orig_lin.invoiced_quantity Invoiced,
         TO_CHAR (orig_lin.line_id) line_id,
         TO_CHAR (orig_lin.header_id) header_id,
         orig_lin.unit_selling_price orig_price,
         orig_head.order_type_id,
         orig_head.org_id,
         orig_lin.inventory_item_id
  FROM   oe_order_lines_all orig_lin,
         oe_order_lines_all retro_lin,
         hz_cust_accounts cust_info,
         hz_parties party,
         oe_items_v item_info,
         mtl_system_items_tl si_tl,
         oe_order_headers_all orig_head,
         hz_cust_site_uses_all site,
         hz_cust_acct_sites_all acct_site,
         oe_order_headers_all retro_head
 WHERE       orig_head.header_id = orig_lin.header_id
         AND NVL (orig_head.org_id, 0) = NVL (:p_organization_id, 0)
         AND retro_lin.order_source_id = 27
         AND retro_lin.orig_sys_line_ref = orig_lin.line_id
         AND retro_head.header_id = retro_lin.header_id
         AND retro_head.order_source_id = 27
         AND retro_head.orig_sys_document_ref = TO_CHAR (:p_request_id)
         AND retro_lin.retrobill_request_id = :p_request_id
         AND orig_lin.invoiced_quantity > 0
         AND cust_info.cust_account_id = orig_head.sold_to_org_id
         AND cust_info.party_id = party.party_id
         AND orig_lin.inventory_item_id = item_info.inventory_item_id
         AND NVL (orig_lin.ordered_item, '-99') =
               DECODE (orig_lin.item_identifier_type,
                       'INT', NVL (orig_lin.ordered_item, '-99'),
                       'CUST', NVL (orig_lin.ordered_item, '-99'),
                       item_info.item)
         AND NVL (orig_lin.sold_to_org_id, -99) =
               NVL (item_info.sold_to_org_id,
                    NVL (orig_lin.sold_to_org_id, -99))
         AND NVL (orig_lin.item_identifier_type, 'INT') =
               item_info.item_identifier_type
         AND NVL (orig_lin.ordered_item_id, -99) =
               NVL (item_info.item_id, -99)
         AND si_tl.inventory_item_id = item_info.inventory_item_id
         AND si_tl.organization_id = item_info.organization_id
         AND si_tl.language = USERENV ('LANG')
         AND site.site_use_code = 'BILL_TO'
         AND site.site_use_id = orig_lin.invoice_to_org_id
         AND acct_site.cust_account_id = cust_info.cust_account_id
         AND site.cust_acct_site_id = acct_site.cust_acct_site_id;

Query to get the outstanding holds on an order (Open holds)

/* Formatted on 11/18/2016 3:56:56 PM (QP5 v5.114.809.3010) */
  SELECT   org.name customer_name,
           ho.name hold_name,
           hs.hold_until_date,
           hs.hold_comment,
           h.order_number,
           h.ordered_date order_date,
           h.transactional_curr_code currency_code,
           NVL (l.ordered_quantity, 0) * NVL (l.unit_selling_price, 0) amount,
           oh.header_id,
           oh.line_id,
           oh.order_hold_id,
           l.item_identifier_type,
           l.inventory_item_id,
           l.ordered_item_id,
           l.ordered_item
    FROM   oe_sold_to_orgs_v org,
           mtl_system_items_vl si,
           oe_order_holds_all oh,
           oe_order_lines_all l,
           oe_order_headers h,
           oe_hold_definitions ho,
           oe_hold_sources_all hs
   WHERE       oh.header_id = h.header_id
           AND h.sold_to_org_id = org.organization_id
           AND (h.cancelled_flag IS NULL OR h.cancelled_flag = 'N')
           AND h.open_flag = 'Y'
           AND oh.hold_source_id = hs.hold_source_id
           AND hs.hold_id = ho.hold_id
           AND h.header_id = l.header_id(+)
           AND l.open_flag = 'Y'
           AND l.line_id = NVL (oh.line_id, l.line_id)
           AND l.inventory_item_id = si.inventory_item_id
           AND oh.hold_release_id IS NULL
           AND NVL (si.organization_id, 0) = :c_master_org
           AND NVL (h.org_id, 0) = NVL (:p_org_id, 0)
           AND NVL (l.org_id, 0) = NVL (:p_org_id, 0)
           AND h.order_number = <>
ORDER BY   org.name,
           ho.name,
           h.order_number,
           si.description

Query to get the discrepancy between the sales orders and purchase orders in Drop ship orders

/* Formatted on 11/18/2016 3:55:24 PM (QP5 v5.114.809.3010) */
  SELECT   osto.name oe_customer_name,
           osto.customer_number oe_customer_number,
           oeh.header_id oe_header_id,
           oeh.order_number oe_number,
           OTYPE.name oe_type,
           oeh.ordered_date oe_order_date,
           oel.line_id oe_line_id,
           oel.line_number
           || DECODE (oel.shipment_number,
                      NULL, NULL,
                      '.' || oel.shipment_number)
           || DECODE (oel.option_number, NULL, NULL, '.' || oel.option_number)
              line_shipment_option_number,
           oel.item_identifier_type,
           OEL.INVENTORY_ITEM_ID,
           OEL.ORDERED_ITEM_ID,
           OEL.ORDERED_ITEM,
           poh.segment1 po_number,
           pol.line_num po_line_number,
           porel.release_num po_release_number,
           poll.shipment_num po_shipment_number,
           porh.segment1 requisition_number,
           porl.line_num requisition_line_number,
           msi1.description po_item_description,
           msi2.description rq_item_description,
           DECODE (
              oel.line_set_id,
              NULL,
              (SELECT   ordered_quantity
                 FROM   oe_order_lines_all
                WHERE       line_id = oel.line_id
                        AND line_set_id IS NULL
                        AND NVL (org_id, 0) = NVL (oel.org_id, 0)),
              (SELECT   ordered_quantity
                 FROM   oe_order_lines_all
                WHERE       line_set_id = oel.line_set_id
                        AND line_id = oel.line_id
                        AND line_set_id IS NOT NULL
                        AND NVL (org_id, 0) = NVL (oel.org_id, 0))
           )
              oe_quantity,
           poll.quantity - NVL (poll.quantity_cancelled, 0)
              po_shipment_quantity,
           porl.quantity - NVL (porl.quantity_cancelled, 0) rq_quantity,
           oel.order_quantity_uom oe_unit,
           muom1.uom_code po_unit,
           muom2.uom_code rq_unit,
           oel.schedule_ship_date oe_schedule_date,
           poll.need_by_date po_needby_date,
           porl.need_by_date rq_needby_date,
           zloc_oe.address1 oe_ship_to_location,
           NVL (rloc_po.location_CODE, zloc_po.address1) po_ship_to_location,
           NVL (rloc_rq.location_code, zloc_rq.address1) rq_ship_to_location,
           DECODE (poh.user_hold_flag, 'Y', 'Y', pol.user_hold_flag) po_hold
    FROM   mtl_system_items_vl msi,
           mtl_system_items_vl msi1,
           mtl_system_items_vl msi2,
           mtl_units_of_measure muom1,
           mtl_units_of_measure muom2,
           po_line_locations_all poll,
           po_releases porel,
           po_lines_all pol,
           po_headers_all poh,
           po_requisition_lines_all porl,
           po_requisition_headers_all porh,
           oe_order_lines_all oel,
           OE_TRANSACTION_TYPES_TL OTYPE,
           oe_order_headers oeh,
           oe_drop_ship_sources oes,
           oe_sold_to_orgs_v osto,
           HR_LOCATIONS rloc_po,
           HR_LOCATIONS rloc_rq,
           HZ_LOCATIONS zloc_oe,
           HZ_LOCATIONS zloc_po,
           HZ_LOCATIONS zloc_rq,
           HZ_PARTY_SITES party,
           HZ_CUST_ACCT_SITES_ALL acct,
           HZ_CUST_SITE_USES_ALL cust
   WHERE   OEH.HEADER_ID = OES.HEADER_ID
           AND NVL (oeh.org_id, 0) = NVL (:p_organization_id, 0)
           AND NVL (oel.org_id, NVL (:p_organization_id, 0)) =
                 NVL (:p_organization_id, 0)
           AND oeh.sold_to_org_id = osto.customer_id(+)
           AND OTYPE.TRANSACTION_TYPE_ID = OEH.ORDER_TYPE_ID
           AND OTYPE.language = USERENV ('lang')
           AND oes.line_id = oel.line_id(+)
           AND MSI.INVENTORY_ITEM_ID = PORL.ITEM_ID
           AND NVL (msi.organization_id, 0) = :c_master_org
           AND poh.po_header_id(+) = oes.po_header_id
           AND pol.po_line_id(+) = oes.po_line_id
           AND msi1.inventory_item_id(+) = pol.item_id
           AND NVL (msi1.organization_id, NVL (:c_master_org, 0)) =
                 :c_master_org
           AND msi2.inventory_item_id(+) = porl.item_id
           AND NVL (msi2.organization_id, 0) = :c_master_org
           AND poll.line_location_id(+) = oes.line_location_id
           AND porh.requisition_header_id(+) = oes.requisition_header_id
           AND porl.requisition_line_id(+) = oes.requisition_line_id
           AND porel.po_release_id(+) = poll.po_release_id
           AND muom1.unit_of_measure(+) = pol.unit_meas_lookup_code
           AND muom2.unit_of_measure(+) = porl.unit_meas_lookup_code
           AND rloc_po.location_id(+) = poll.ship_to_location_id
           AND rloc_rq.location_id(+) = porl.deliver_to_location_id
           AND zloc_po.location_id(+) = poll.ship_to_location_id
           AND zloc_rq.location_id(+) = porl.deliver_to_location_
           AND CUST.SITE_USE_ID(+) = oel.ship_to_org_id
           AND NVL (CUST.STATUS, 'A') = 'A'
           AND NVL (CUST.SITE_USE_CODE, 'SHIP_TO') = 'SHIP_TO'
           AND ACCT.CUST_ACCT_SITE_ID(+) = CUST.CUST_ACCT_SITE_ID
           AND PARTY.PARTY_SITE_ID(+) = ACCT.PARTY_SITE_ID
           AND zloc_oe.location_id(+) = PARTY.location_id
           AND (oes.po_header_id IS NOT NULL
                AND (pol.item_id != oel.inventory_item_id
                     OR TRUNC (poll.need_by_date) !=
                          TRUNC (oel.schedule_ship_date)
                     OR poll.ship_to_location_id != PARTY.LOCATION_ID
                     OR muom1.uom_code != oel.order_quantity_uom
                     OR DECODE (
                          0,
                          0,
                          (SELECT   SUM (ordered_quantity)
                             FROM   oe_order_lines_all
                            WHERE       line_set_id = oel.line_set_id
                                    AND line_set_id IS NOT NULL
                                    AND NVL (org_id, 0) = NVL (oel.org_id, 0))
                       ) NOT IN
                             (SELECT   SUM (quantity)
                                FROM   po_line_locations_all poll2,
                                       oe_drop_ship_sources oes2
                               WHERE   poll2.line_location_id =
                                          oes2.line_location_id
                                       AND oes2.line_id = oel.line_id)
                     OR DECODE (
                          0,
                          0,
                          (SELECT   ordered_quantity
                             FROM   oe_order_lines_all
                            WHERE       line_id = oel.line_id
                                    AND line_set_id IS NULL
                                    AND NVL (org_id, 0) = NVL (oel.org_id, 0))
                       ) NOT IN
                             (SELECT   SUM (quantity)
                                FROM   po_line_locations_all poll2,
                                       oe_drop_ship_sources oes2
                               WHERE   poll2.line_location_id =
                                          oes2.line_location_id
                                       AND oes2.line_id = oel.line_id)
                     OR DECODE (poh.user_hold_flag,
                                'Y', 1,
                                DECODE (pol.user_hold_flag, 'Y', 1, 0)) NOT IN
                             (SELECT   DECODE (COUNT (order_hold_id), 0, 0, 1)
                                FROM   oe_order_holds_all orh,
                                       oe_hold_sources_all ohs,
                                       oe_hold_definitions ohd
                               WHERE   orh.header_id = oel.header_id
                                       AND orh.hold_release_id IS NULL
                                       AND orh.hold_source_id =
                                             ohs.hold_source_id
                                       AND ohs.hold_id = ohd.hold_id
                                       AND ohd.item_type IS NULL
                                       AND ohd.activity_name IS NULL
                                       AND (orh.line_id = oel.line_id
                                            OR orh.line_id IS NULL)))
                OR (oes.po_header_id IS NULL
                    AND oes.requisition_header_id IS NOT NULL
                    AND (DECODE (oel.inventory_item_id,
                                 NULL, -98,
                                 porl.item_id) !=
                            NVL (oel.inventory_item_id, -99)
                         OR TRUNC(DECODE (oel.schedule_ship_date,
                                          NULL, SYSDATE,
                                          porl.need_by_date)) !=
                              TRUNC (NVL (oel.schedule_ship_date, SYSDATE - 1))
                         OR NVL (oel.ship_to_org_id, -98) !=
                              NVL (oel.ship_to_org_id, -99)
                         OR porl.deliver_to_location_id != PARTY.LOCATION_ID
                         OR muom2.uom_code != oel.order_quantity_uom
                         OR porl.quantity !=
                              DECODE (
                                 0,
                                 0,
                                 (SELECT   SUM (ordered_quantity)
                                    FROM   oe_order_lines_all
                                   WHERE   line_set_id = oel.line_set_id
                                           AND line_set_id IS NOT NULL
                                           AND NVL (org_id, 0) =
                                                 NVL (oel.org_id, 0))
                              )
                         OR porl.quantity !=
                              DECODE (
                                 0,
                                 0,
                                 (SELECT   ordered_quantity
                                    FROM   oe_order_lines_all
                                   WHERE   line_id = oel.line_id
                                           AND line_set_id IS NULL
                                           AND NVL (org_id, 0) =
                                                 NVL (oel.org_id, 0))
                              )
                         OR 0 NOT IN
                                 (SELECT   DECODE (COUNT (order_hold_id),
                                                   0, 0,
                                                   1)
                                    FROM   oe_order_holds_all orh,
                                           oe_hold_sources_all ohs,
                                           oe_hold_definitions ohd
                                   WHERE   orh.header_id = oel.header_id
                                           AND orh.hold_source_id =
                                                 ohs.hold_source_id
                                           AND ohs.hold_id = ohd.hold_id
                                           AND ohd.item_type IS NULL
                                           AND ohd.activity_name IS NULL
                                           AND orh.hold_release_id IS NULL
                                           AND (orh.line_id = oel.line_id
                                                OR orh.line_id IS NULL))))
                OR oel.line_id IS NULL)
ORDER BY   oeh.order_number