Oracle-Order to Cash Cycle with Important Columns and Joins
SELECT DISTINCT
OOHA.ORDER_NUMBER,
OOLA.ORDERED_ITEM,
OOLA.ORDERED_QUANTITY,
OOLA.CUST_PO_NUMBER,
OOLA.UNIT_SELLING_PRICE,
HCA.ACCOUNT_NAME CUSTOMER_NAME,
OTTT.NAME ORDER_NAME,
OTTT.DESCRIPTION ORDER_DESC,
QLH.NAME PRICELIST_NAME,
(SELECT LAST_NAME||','||FIRST_NAME FROM PER_ALL_PEOPLE_F WHERE PERSON_ID=RSA.PERSON_ID) SALESREP,HCSUA.LOCATION,
HPS.PARTY_SITE_NAME,
HL.ADDRESS1||','||HL.CITY||','||HL.POSTAL_CODE||','||HL.STATE||','||HL.COUNTRY||','||HL.ADDRESS_KEY TOTAL_ADDRESS,
MSIB.SEGMENT1 ITEM,
MSIB.DESCRIPTION,
MSIB.INVENTORY_ITEM_STATUS_CODE,
MSIB.ITEM_TYPE,
WDD.REQUESTED_QUANTITY,
WDD.SHIPPED_QUANTITY,
WDD.DELIVERED_QUANTITY,
OOHA.FLOW_STATUS_CODE HEADERS_CODE,
OOLA.FLOW_STATUS_CODE LINES_CODE,
WDD.RELEASED_STATUS,
WND.DELIVERY_ID,
WND.NAME DELIVERY_NUMBER,
RCTA.TRX_NUMBER,
ACRA.AMOUNT,
ACRA.RECEIPT_NUMBER,
GJB.NAME BACTH_NAME,
GJB.DESCRIPTION BATCH_DESCRIPTION,
GJH.NAME JOURNAL_NAME,
GJH.STATUS JOURNAL_STATUS,
GJH.DESCRIPTION JE_DESCRIPTION
FROM
OE_ORDER_HEADERS_ALL OOHA,
OE_ORDER_LINES_ALL OOLA,
HZ_CUST_ACCOUNTS HCA,
OE_TRANSACTION_TYPES_TL OTTT,
QP_LIST_HEADERS QLH,
RA_SALESREPS_ALL RSA,
HZ_CUST_SITE_USES_ALL HCSUA,
HZ_CUST_ACCT_SITES_ALL HCASA,
HZ_PARTY_SITES HPS,
HZ_LOCATIONS HL,
MTL_SYSTEM_ITEMS_B MSIB,
WSH_DELIVERY_DETAILS WDD,
WSH_DELIVERY_ASSIGNMENTS WDA,
WSH_NEW_DELIVERIES WND,
RA_CUSTOMER_TRX_LINES_ALL RCTLA,
RA_CUSTOMER_TRX_ALL RCTA,
AR_PAYMENT_SCHEDULES_ALL APSA,
AR_RECEIVABLE_APPLICATIONS_ALL ARAA,
AR_CASH_RECEIPTS_ALL ACRA,
XLA.XLA_TRANSACTION_ENTITIES XTE,
XLA_EVENTS XE,
XLA_AE_HEADERS XAH,
XLA_AE_LINES XAL,
GL_IMPORT_REFERENCES GIR,
GL_JE_BATCHES GJB,
GL_JE_HEADERS GJH,
GL_JE_LINES GJL
WHERE
OOHA.HEADER_ID=OOLA.HEADER_ID
AND
OOHA.SOLD_TO_ORG_ID=HCA.CUST_ACCOUNT_ID
AND
OOHA.ORDER_TYPE_ID=OTTT.TRANSACTION_TYPE_ID
AND
OOHA.PRICE_LIST_ID=QLH.LIST_HEADER_ID
AND
OOHA.SALESREP_ID=RSA.SALESREP_ID
AND
OOHA.SHIP_TO_ORG_ID=HCSUA.SITE_USE_ID
AND
HCSUA.CUST_ACCT_SITE_ID=HCASA.CUST_ACCT_SITE_ID
AND
HCASA.PARTY_SITE_ID=HPS.PARTY_SITE_ID
AND
HPS.LOCATION_ID=HL.LOCATION_ID
AND
OOLA.INVENTORY_ITEM_ID=MSIB.INVENTORY_ITEM_ID
AND
OOLA.SHIP_FROM_ORG_ID=MSIB.ORGANIZATION_ID
AND
OOLA.HEADER_ID=WDD.SOURCE_HEADER_ID
AND
WDD.DELIVERY_DETAIL_ID=WDA.DELIVERY_DETAIL_ID
AND
WDA.DELIVERY_ID=WND.DELIVERY_ID
AND
RCTLA.INTERFACE_LINE_ATTRIBUTE1=TO_CHAR(OOHA.ORDER_NUMBER)
AND
RCTLA.CUSTOMER_TRX_ID=RCTA.CUSTOMER_TRX_ID
AND
RCTA.CUSTOMER_TRX_ID=APSA.CUSTOMER_TRX_ID
AND
APSA.CUSTOMER_TRX_ID=ARAA.APPLIED_CUSTOMER_TRX_ID
AND
ARAA.CASH_RECEIPT_ID=ACRA.CASH_RECEIPT_ID
AND
XTE.TRANSACTION_NUMBER=RCTA.TRX_NUMBER
AND
XTE.ENTITY_ID=XE.ENTITY_ID
AND
XE.EVENT_ID=XAH.EVENT_ID
AND
XAH.AE_HEADER_ID=XAL.AE_HEADER_ID
AND
GIR.GL_SL_LINK_ID=XAL.GL_SL_LINK_ID
AND
GIR.GL_SL_LINK_TABLE='XLAJEL'
AND
GIR.JE_BATCH_ID=GJB.JE_BATCH_ID
AND
GJB.JE_BATCH_ID=GJH.JE_BATCH_ID
AND
GJH.JE_HEADER_ID=GJH.JE_HEADER_ID
AND
OOHA.ORDER_NUMBER=5854;
No comments:
Post a Comment