Tuesday, December 30, 2014

GL XLA Drill Down


Oracle Applications R12: GL XLA Drill Down


Below are the queries used for Drill Down between GL(General Leder) and SLA(Sub ledger Accounting) in R12
1.select * from ap_invoices_all where invoice_num = ;
--invoice_id 158962
 Now Query for entity Id


2. select * from xla.xla_transaction_entities where source_id_int_1 = 158962
 --entity_id 603052
 Next get the events

3. select * from xla_events where entity_id=603052
 --event_id 658617 658618

4. select * from xla_ae_headers where event_id in (658617, 658618);
 --ae_header_id 1758986 1758987 1758988 1758989 1758990 1758991

5. select gl_sl_link_id from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990, 1758991);
  --gl_sl_link_id is obtained

6.select * from gl_import_references where gl_sl_link_id in (select gl_sl_link_id from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990, 1758991))
and gl_sl_link_table ='XLAJEL';

7.select * from gl_je_batches where je_batch_id in
 (select je_batch_id from gl_import_references where gl_sl_link_id in (select gl_sl_link_id from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990, 1758991))
and gl_sl_link_table ='XLAJEL');

8.select * from gl_je_headers where je_header_id in
  (select je_header_id from gl_import_references where gl_sl_link_id in (select gl_sl_link_id from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990, 1758991))
and gl_sl_link_table ='XLAJEL');

9.select * from gl_je_lines where je_header_id in
  (select je_header_id from gl_import_references where gl_sl_link_id in (select gl_sl_link_id from xla_ae_lines where ae_header_id in (1758986, 1758987, 1758988, 1758989, 1758990, 1758991))
and gl_sl_link_table ='XLAJEL');

Pls note :
steps 8 and 9 do not work after the subledger transaction posting to the GL is complete, because gl_je_lines.gl_sl_link_id and gl_sl_link_table are set to null

Reference
http://toracleapps.blogspot.com

GL Import Reference relationship with various tables

fig1
fig2

fig3
fig4
fig5
fig6
fig7
 
 
 

Friday, December 26, 2014

AR queries

Related Queries in O2C Cycle

SELECT HEADER_ID,
       ORDER_NUMBER ,
       FLOW_STATUS_CODE ,
       ORDER_CATEGORY_CODE ,
       BOOKED_FLAG ,
       ORG_ID
FROM oe_order_headers_all
WHERE order_number = 66435
-----------------------------
  SELECT HEADER_ID ,
         LINE_ID ,
         LINE_TYPE_ID ,
         FLOW_STATUS_CODE ,
         LINE_NUMBER ,
         ORDERED_ITEM ,
         ORDERED_QUANTITY ,
         UNIT_LIST_PRICE_PER_PQTY
  FROM OE_ORDER_LINES_ALL WHERE 1=1
  AND HEADER_ID = 192535
------------------------------------
  SELECT DELIVERY_DETAIL_ID ,
         SOURCE_HEADER_ID ,
         SOURCE_LINE_ID ,
         CUSTOMER_ID ,
         INVENTORY_ITEM_ID ,
         RELEASED_STATUS
  FROM WSH_DELIVERY_DETAILS WHERE 1=1
  AND SOURCE_HEADER_ID = 192535
-------------------------------------------
  SELECT *
  FROM WSH_NEW_DELIVERIES WHERE 1=1
  AND DELIVERY_ID = 3773405
ORDER BY CREATION_DATE DESC
------------------------------------
SELECT *
FROM WSH_DELIVERY_ASSIGNMENTS
WHERE 1=1
  AND DELIVERY_DETAIL_ID = 3962503
ORDER BY CREATION_DATE DESC
--------------------------------------------
SELECT *
FROM RA_INTERFACE_LINES_ALL
WHERE 1=1
  AND INTERFACE_LINE_CONTEXT = 'ORDER ENTRY'
  AND INTERFACE_LINE_ATTRIBUTE1 = 66435
  AND INTERFACE_LINE_ATTRIBUTE3 = 3773405
  SELECT CUSTOMER_TRX_ID ,
         TRX_NUMBER ,
         INTERFACE_HEADER_ATTRIBUTE1 ,
         INTERFACE_HEADER_ATTRIBUTE2 ,
         INTERFACE_HEADER_ATTRIBUTE3 ,
         INTERFACE_HEADER_CONTEXT ,
         STATUS_TRX
  FROM RA_CUSTOMER_TRX_ALL WHERE 1=1
  AND INTERFACE_HEADER_CONTEXT = 'ORDER ENTRY'
  AND INTERFACE_HEADER_ATTRIBUTE1 = '66435'
  AND INTERFACE_HEADER_ATTRIBUTE3 = 3773405
ORDER BY CREATION_DATE DESC
-----------------------------------------------
SELECT *
FROM RA_CUSTOMER_TRX_LINES_ALL
WHERE 1=1
  AND INTERFACE_LINE_CONTEXT = 'ORDER ENTRY'
  AND INTERFACE_LINE_ATTRIBUTE1 = 66435
  AND INTERFACE_LINE_ATTRIBUTE3 = 3773405
ORDER BY CREATION_DATE DESC
------------------------------------------
SELECT *
FROM AR_CASH_RECEIPTS_ALL
WHERE 1=1
  AND RECEIPT_NUMBER = 'R10037546'
ORDER BY CREATION_DATE DESC
-----------------------------------------
SELECT *
FROM AR_RECEIVABLE_APPLICATIONS_ALL
WHERE 1=1
  AND CASH_RECEIPT_ID = 113993
ORDER BY CREATION_DATE DESC
----------------------------------------
SELECT *
FROM AR_PAYMENT_SCHEDULES_ALL
WHERE 1=1
  AND CASH_RECEIPT_ID = 113993
ORDER BY CREATION_DATE DESC **************** O2C Complete Query ****************
SELECT ooha.order_number,
       ooha.org_id,
       hca.account_name,
       hp.party_name "Customer Name",
       hcasab.orig_system_reference BILL_TO_ORIG_REF,
       hpsb.status BILL_TO_STATUS,
       'ADDRESS1 - '||bill_loc.address1||','||CHR(10)|| 'ADDRESS2 - '||bill_loc.address2||','||CHR(10)|| 'ADDRESS3 - '||bill_loc.address3||','||CHR(10)|| 'CITY     - '||bill_loc.city||','||CHR(10)|| 'POSTAL CD- '||bill_loc.postal_code||','||CHR(10)|| 'COUNTRY  - '|| bill_loc.country BILL_TO_ADDRESS,
hcasas.orig_system_reference SHIP_TO_ORIG_REF,
hpss.status SHIP_TO_STATUS,
'ADDRESS1 - '||ship_loc.address1||','||CHR(10)|| 'ADDRESS2 - '||ship_loc.address2||','||CHR(10)|| 'ADDRESS3 - '||ship_loc.address3||','||CHR(10)|| 'CITY     - '||ship_loc.city||','||CHR(10)|| 'POSTAL CD- '||ship_loc.postal_code||','||CHR(10)|| 'COUNTRY  - '|| ship_loc.country SHIP_TO_ADDRESS,
oola.inventory_item_id,
oola.ordered_item,
msib.description item_description,
wnd.name delivery_number,
rct.trx_number "AR Invoice Number",
acr.receipt_number "AR Receipt Number",
gjh.ledger_id,
gjh.name
FROM oe_order_headers_all ooha,
     oe_order_lines_all oola,
     hz_parties hp,
     hz_cust_accounts hca,
     hz_party_sites hpss,
     hz_party_sites hpsb,
     hz_locations bill_loc,
     hz_locations ship_loc,
     hz_cust_acct_sites_all hcasab,
     hz_cust_acct_sites_all hcasas,
     hz_cust_site_uses_all hzsuab,
     hz_cust_site_uses_all hzsuas,
     mtl_system_items_b msib,
     wsh_delivery_details wdd,
     wsh_new_deliveries wnd,
     wsh_delivery_assignments wda,
     ra_customer_trx_all rct,
     ra_customer_trx_lines_all rctl,
     ra_cust_trx_line_gl_dist_all rctld,
     ar_cash_receipts_all acr,
     xla.xla_transaction_entities xte,
     xla_events xe,
     xla_ae_headers xah,
     xla_ae_lines xal,
     xla_distribution_links xdl,
     gl_import_references gir,
     gl_je_batches gjb,
     gl_je_headers gjh,
     gl_je_lines gjl
WHERE ooha.order_number = :SalesOrderNumber
AND ooha.org_id = 204
AND hca.cust_account_id = ooha.sold_to_org_id
AND hp.party_id = hca.party_id
AND hpss.party_id = hca.party_id
AND hpsb.party_id = hca.party_id
AND bill_loc.location_id = hpss.location_id
AND ship_loc.location_id = hpsb.location_id
AND hcasas.cust_account_id = hca.cust_account_id
AND hcasab.cust_account_id = hca.cust_account_id
AND hcasas.party_site_id = hpss.party_site_id
AND hcasab.party_site_id = hpsb.party_site_id
AND hzsuas.cust_acct_site_id = hcasas.cust_acct_site_id
AND hzsuab.cust_acct_site_id = hcasab.cust_acct_site_id
AND hzsuas.site_use_id = ooha.ship_to_org_id
AND hzsuab.site_use_id = ooha.invoice_to_org_id
AND wda.delivery_id = wnd.delivery_id(+)
AND wdd.delivery_detail_id = wda.delivery_detail_id
AND wdd.source_header_id = ooha.header_id
AND wdd.source_line_id = oola.line_id
AND wdd.organization_id = msib.organization_id(+)
AND wdd.inventory_item_id =msib.inventory_item_id(+)
AND rct.interface_header_attribute1 = to_char(ooha.order_number)
AND rct.org_id = ooha.org_id
AND rctl.customer_trx_id = rct.customer_trx_id
AND rctl.sales_order = to_char(ooha.order_number)
AND rctld.customer_trx_id = rct.customer_trx_id
AND rctld.customer_trx_line_id = rctl.customer_trx_line_id
AND acr.receipt_number = 'G-1001'
AND acr.pay_from_customer = rct.sold_to_customer_id
AND acr.org_id = ooha.org_id
AND acr.customer_site_use_id = rct.bill_to_site_use_id
AND xte.transaction_number = acr.receipt_number
AND xte.entity_code = 'RECEIPTS'
AND xe.entity_id = xte.entity_id
AND xah.event_id = xe.event_id
AND xal.ae_header_id = xah.ae_header_id
AND xal.accounting_class_code = 'CASH'
AND xdl.ae_header_id = xah.ae_header_id
AND xdl.ae_line_num = xal.ae_line_num --and xdl.source_distribution_id_num_1
AND gir.reference_5 = xte.entity_id -- Entity Id
AND gir.reference_6 = to_char(xe.event_id) --Event Id
AND gir.reference_7 = to_char (xah.ae_header_id) -- AE Header Id
AND gir.gl_sl_link_id = xal.gl_sl_link_id
AND gir.created_by = 1318
AND gjb.je_batch_id = gir.je_batch_id
AND gjh.je_batch_id=gjb.je_batch_id
AND gjh.je_header_id = gir.je_header_id
AND gjl.je_header_id=gjh.je_header_id
AND gjl.je_line_num= gir.je_line_num

Order To Cash Cycle Flow with queries


SN
Process
Remarks
Query
 
1
Enter Order
Flow status :
Header: Entered
line: Entered
SELECT
HEADER_ID
,ORDER_NUMBER
,FLOW_STATUS_CODE
,ORDER_CATEGORY_CODE
,BOOKED_FLAG
,ORG_ID
FROM oe_order_headers_all
WHERE order_number = 66465
SELECT
HEADER_ID
,LINE_ID
,LINE_TYPE_ID
,FLOW_STATUS_CODE
,LINE_NUMBER
,ORDERED_ITEM
,ORDERED_QUANTITY
,UNIT_LIST_PRICE_PER_PQTY
FROM OE_ORDER_LINES_ALL
WHERE 1=1
AND HEADER_ID = 192535
2
Book Order
Header :Booked
Line: Awaiting Shipping
Record(s) will be created in the table WSH_DELIVERY_DETAILS with
RELEASED_STATUS=’R’ (Ready to Release)
Also Record(s) will be inserted into WSH_DELIVERY_ASSIGNMENTS.
SELECT * FROM WSH_DELIVERY_ASSIGNMENTS
At the same time DEMAND INTERFACE PROGRAM runs in the background and inserts into MTL_DEMAND
select * from MTL_DEMAND
BackGround Program:
Demand Interface program
SELECT
HEADER_ID
,ORDER_NUMBER
,FLOW_STATUS_CODE
,ORDER_CATEGORY_CODE
,BOOKED_FLAG
,ORG_ID
FROM oe_order_headers_all
WHERE order_number = 66465
SELECT
HEADER_ID
,LINE_ID
,LINE_TYPE_ID
,FLOW_STATUS_CODE
,LINE_NUMBER
,ORDERED_ITEM
,ORDERED_QUANTITY
,UNIT_LIST_PRICE_PER_PQTY
FROM OE_ORDER_LINES_ALL
WHERE 1=1
AND HEADER_ID = 192535
3
Pick Release
Header :Booked
Line : Pick Confirmed
If Auto create Delivery is set to ‘Yes’ then a new record is created in the table WSH_NEW_DELIVERIES
DELIVERY_ID is populated in the table WSH_DELIVERY_ASSIGNMENTS.
The RELEASED_STATUS in WSH_DELIVERY_DETAILS would be now set to ‘Y’ (Pick Confirmed) if Auto Pick Confirm is set to Yes otherwise RELEASED_STATUS is ‘S’ (Release to Warehouse).
Back Ground Program:
Pick Slip Report
Shipping Execution Report
Auto Pack Report
Line: Pick Confirmed
SELECT
DELIVERY_DETAIL_ID
,SOURCE_HEADER_ID
,SOURCE_LINE_ID
,CUSTOMER_ID
,INVENTORY_ITEM_ID
,RELEASED_STATUS
FROM WSH_DELIVERY_DETAILS
WHERE 1=1
AND SOURCE_HEADER_ID = 192535
-----------------------------------------------
SELECT * FROM WSH_NEW_DELIVERIES
WHERE 1=1
AND DELIVERY_ID = 3773405
ORDER BY CREATION_DATE DESC
--------------------------------------------------
SELECT * FROM WSH_DELIVERY_ASSIGNMENTS
WHERE 1=1
AND DELIVERY_DETAIL_ID = 3962503
ORDER BY CREATION_DATE DESC
 
4
Pick Confirm
Header: Booked
Line : Pick Confirmed
 
 
5
Ship Confirm
Header Booked
Line : Shipped

RELEASED_STATUS in WSH_DELIVERY_DETAILS would be ‘C’ (Ship Confirmed)
FLOW_STATUS_CODE in OE_ORDER_HEADERS_ALL would be “BOOKED“
FLOW_STATUS_CODE in OE_ORDER_LINES_ALL would be “SHIPPED“

Back Ground Programss:
Interface Trip Stop
Commercial Invoice
Packing Slip Report
Bill Of Lading
SELECT
HEADER_ID
,ORDER_NUMBER
,FLOW_STATUS_CODE
,ORDER_CATEGORY_CODE
,BOOKED_FLAG
,ORG_ID
FROM oe_order_headers_all
WHERE order_number = 66435
------------------------------
SELECT
HEADER_ID
,LINE_ID
,LINE_TYPE_ID
,FLOW_STATUS_CODE
,LINE_NUMBER
,ORDERED_ITEM
,ORDERED_QUANTITY
,UNIT_LIST_PRICE_PER_PQTY
FROM OE_ORDER_LINES_ALL
WHERE 1=1
AND HEADER_ID = 192535
---------------------------------
SELECT
DELIVERY_DETAIL_ID
,SOURCE_HEADER_ID
,SOURCE_LINE_ID
,CUSTOMER_ID
,INVENTORY_ITEM_ID
,RELEASED_STATUS
FROM WSH_DELIVERY_DETAILS
WHERE 1=1
AND SOURCE_HEADER_ID = 192535
 
6
Invoice
Header :closed
lines: Closed
INTERFACE_LINE_CONTEXT     =     ’ORDER ENTRY’
INTERFACE_LINE_ATTRIBUTE1=     Order_number
INTERFACE_LINE_ATTRIBUTE3=     Delivery_id
RA_CUSTOMER_TRX_ALL will have the Invoice header information. The column INTERFACE_HEADER_ATTRIBUTE1 will have the Order Number.
RA_CUSTOMER_TRX_LINES_ALL will have the Invoice lines information. The column INTERFACE_LINE_ATTRIBUTE1 will have the Order Number.

Background Programs:
Auto Invoice Master Programs
Auto Invoice Import Programs
SELECT * FROM RA_INTERFACE_LINES_ALL
WHERE 1=1
AND INTERFACE_LINE_CONTEXT = 'ORDER ENTRY'
AND INTERFACE_LINE_ATTRIBUTE1 = 66435
AND INTERFACE_LINE_ATTRIBUTE3 = 3773405
------------------------------------
SELECT
CUSTOMER_TRX_ID
,TRX_NUMBER
,INTERFACE_HEADER_ATTRIBUTE1
,INTERFACE_HEADER_ATTRIBUTE2
,INTERFACE_HEADER_ATTRIBUTE3
,INTERFACE_HEADER_CONTEXT
,STATUS_TRX
FROM RA_CUSTOMER_TRX_ALL
WHERE 1=1
AND INTERFACE_HEADER_CONTEXT = 'ORDER ENTRY'
AND INTERFACE_HEADER_ATTRIBUTE1 = '66435'
AND INTERFACE_HEADER_ATTRIBUTE3 = 3773405
ORDER BY CREATION_DATE DESC
------------------------------------------------------------------
SELECT * FROM RA_CUSTOMER_TRX_LINES_ALL
WHERE 1=1
AND TRX_NUMBER = ’10037546’
AND INTERFACE_LINE_CONTEXT = 'ORDER ENTRY'
AND INTERFACE_LINE_ATTRIBUTE1 = 66435
AND INTERFACE_LINE_ATTRIBUTE3 = 3773405
ORDER BY CREATION_DATE DESC
 
7
Receipt
 
Underlying tables:
SELECT * FROM AR_CASH_RECEIPTS_ALL
WHERE 1=1
AND RECEIPT_NUMBER = 'R10037546'
ORDER BY CREATION_DATE DESC
--------------------------------
SELECT * FROM AR_RECEIVABLE_APPLICATIONS_ALL
WHERE 1=1
AND CASH_RECEIPT_ID = 113993
ORDER BY CREATION_DATE DESC
--------------------------------
SELECT * FROM AR_PAYMENT_SCHEDULES_ALL
WHERE 1=1
AND CASH_RECEIPT_ID = 113993
ORDER BY CREATION_DATE DESC
 
8
Transfer To GL
 
 
 
9
Journal Import
 
 
 
10
Posting
 
 
 

Oracle Apps Order TO Cash Cycle Revised


Now lets talk about O2C cycle.Order to cash cycle is something which is related to something related to selling product and receiving payments.So in day to scenario ,what we might refer to is selling your old ipod to your friend who wants to own it after you.
So as previous example in P2P cycle ; you want to sell your old gadget now.
In this scenario , you are seller and one buying your old stuff becomes buyer or customer.
In practical scenario :

1 You decide how many/or what  gadget you want to sell..
2 When some one from another places order or inquiry , you do negotiation for price, then tell buyer about your product, payment method , shipping terms ie wether you or buyer pay for shipping.
3 Once negotiation is made  you pack your gadget , place shipping information of buyer ,and approach FEDEX for delivery

4 Once buyer receives good you are notified by Fedex about delivery of good.
5 You receive payment via paypal or bank ; then you would like to sum up the money for your next gadget purchase ….

6 Invoice / or Receipt might not be generated as you are selling old gadget personally.
Hence in business scenario , if you are manufacturer or supplier of certain goods or sevices.. things get these way too…but with little extra steps . You might be noticing these steps while ordering online :

Hence O2C cycle revolves in following process:

1 Enter order :  This is something the way to collect interested customer information on our product.Since we are selling product  we will need certain details about buyer/customer.Hence attributes like sipt to, bill to ,item ordered,quantity, unit of measurement are entered in this process.

2 Book Order:This is done after  costumer orders is finalized. Hence we start processing order like preparing invoice for the product , demanding inventory of the goods etc.

3 Pick Release: Effects the process in inventory level

4  Pick Confirm: The Pick Confirm transaction executes the subinventory transfer, moving the material from it’s source location to it’s destination staging location. Only 1 staging subinventory is supported per picking batch.The high level reservations are replaced with detail reservations
5 Ship Confirm Its  likely that shipping has been confirmed.

6 Invoice Invoice generation process
7 Receipt Receipt generation process

8 Transfer To GL process
9 Journal Import process

10 Posting effect on gl balances.

O2C details

SN
Process
Tables
Remarks
Entered info
1
Enter Order
OE_ORDER_HEADERS_ALL
OE_ORDER_LINES_ALL
Flow status :
Header: Entered
line: Entered
order management>Order Returns>Sales Order
Enter Header and Line Information (ship to,Bill to UOM etc)
2
Book Order
OE_ORDER_HEADERS_ALL
OE_ORDER_LINES_ALL
WSH_DELIVERY_ASSIGNMENT
WSH_DELIVARY_DETAILS
Header :Booked
Line: Awaiting Shipping

BackGround Program:
Demand Interface program
order management>Order Returns>Sales Order
Select Sales Order and click on Book Order Button
3
Pick Release
WSH_DELIVARY_ASSIGNMENTS
WSH_NEW_DELIVIRIES
WSH_DELIVARY_DETAILS
Header :Booked
Line : Pick Confirmed

Back Ground Program:
Pick Slip Report
Shipping Execution Report
Auto Pack Report
Line: Pick Confirmed
Order Management>Shipping>Release Sales Order>auto create delivery ,pick confirm,pack delivery to yes

Also enter shipping and inventory tab information
4
Pick Confirm
WSH_DELIVARY_DETAILS
Header: Booked
Line : Pick Confirmed
Inventory>move Order>Transact Move Order

In pick release if auto pick confirm is set to no, then
follow the path enter batch number,click find,
click on transacti button
5
Ship Confirm
OE_ORDER_HEADERS_ALL
OE_ORDER_LINES_ALL
WSH_DELIVARY_DETAILS
Header Booked
Line : Shipped

Back Ground Programss:
Interface Trip Stop
Commercial Invoice
Packing Slip Report
Bill Of Lading
Order management>shipping>transaction
Qury the order number,go to delivery tab and click
on ship confirm
6
Invoice
RA_CUSTOMER_TRX_ALL
RA_CUSTOMER_TRX_LINES_ALL
Header :closed
lines: Closed
Background Programs:
Auto Invoice Master Programs
Auto Invoice Import Programs
Order management>view>Requests
Run workflow background process
7
Receipt
AR_CASH_RECEIPTS_ALL
 
Receivable>Receipts>receipts
Enter payment method,Receipt type,amount,bank name
branch,account etc;
Click On apply button
8
Transfer To GL
GL_INTERFACE
 
Receivable>view reques
Transfer Receivable Accounting Information To GL
using gl transfer program
9
Journal Import
GL_JE_BATCHES
GL_JE_LINES
GL_JE_HEADERS
 
General ledger>journal>import>run
10
Posting
GL_BALANCES
 
General ledger>journals>post