Tuesday, 8 July 2014

Sales order header information

/* Formatted on 7/8/2014 9:35:02 AM (QP5 v5.115.810.9015) */
SELECT ooh.order_number,
       ooh.header_id hdr_id,
       DECODE (ooh.order_category_code,
          'MIXED', 'Mixed',
          'ORDER', 'Regular',
          'RETURN', 'Return',
          ooh.order_category_code)
          category,
       ott.name ord_typ,
       ooh.ordered_date,
       ooh.transactional_curr_code curr,
       os2.name sdt,
       ooh.source_document_id sdi,
       os1.name os,
       ooh.orig_sys_document_ref osdr,
       ooh.sold_to_org_id sold_to,
       ooh.invoice_to_org_id invoice_to,
       ooh.cust_po_number cust_po,
       ooh.payment_type_code pay_type,
       ooh.flow_status_code hdr_flow_status,
       ooh.open_flag,
       ooh.booked_flag,
       ooh.cancelled_flag,
       NVL (ooh.upgraded_flag, 'N') upgraded_flag
FROM oe_order_headers_all ooh,
     oe_transaction_types_tl ott,
     oe_order_sources os1,
     oe_order_sources os2
WHERE    1 = 1
      AND ooh.order_number = &order_number
      AND ooh.order_type_id = ott.transaction_type_id
      AND ooh.order_source_id = os1.order_source_id(+)
      AND ooh.source_document_type_id = os2.order_source_id(+)
      AND ott.language = (SELECT fl.language_code
                          FROM fnd_languages fl
                          WHERE fl.installed_flag = 'B');

No comments:

Post a Comment