Friday, 31 October 2025

Query to get return Sales Order in Oracle APPS R12

Query to get Return Sales Order(RMA: Return Material Authorization) in Oracle APPS R12

SELECT ooha.order_number "SALES ORDER",
       ac.customer_name,
       ooha.order_category_code,
       oola.ordered_item,
       oola.ordered_quantity,
       rsl.quantity_shipped,
       rsl. quantity_received,
       oola.subinventory,
       shipment_num,
       rsh.receipt_num,
       rsh.attribute_category,
       rsl.unit_of_measure,
       rsl.item_description,
       rsl.shipment_line_status_code,
       rsl.source_document_code,
       RCT.trx_number    trx_number
FROM   apps.oe_order_headers_all ooha,
       apps.oe_order_lines_all oola,
       ra_customer_trx_all RCT,
       apps.rcv_shipment_headers rsh,
       apps.ar_customers ac,
       apps.rcv_shipment_lines rsl,
       apps.hz_cust_accounts hca
WHERE  1 = 1
       AND ooha.header_id = oola.header_id
       AND RCT.interface_header_context = 'ORDER ENTRY'
       AND RCT.interface_header_attribute1 = To_char (ooha.order_number)
       AND ooha.header_id = rsl.oe_order_header_id
       AND rsh.shipment_header_id = rsl.shipment_header_id
       AND rsl.oe_order_line_id = oola.line_id
       AND ooha.order_number = :P_ORDR_NUMBER
       AND ooha.sold_to_org_id = hca.cust_account_id
       AND rsl.source_document_code = 'RMA'
       AND hca.cust_account_id = ac.customer_id; 

No comments:

Post a Comment