Sunday 21 August 2016

Complete Order to Cash(O2C) Techno-Functional flow in R12



Order to Cash Cycle in Brief:
The Order to Cash Process flow starts with entering the order with a standard item into system. When you enter an order, the item are validated in oracle inventory, the price is calculated for the items using the pricing engine; the availability of the items are checked and may be reserved. Once all the required fields are entered on both the header and the lines, you can book the order. When you click on the Book Order button, the API OEXUBOKB.pls, checks if the order is eligible for booking. If eligible the order is booked and the order header status would change to booked. The next step is the pick release with which you move the items from the warehouse to the staging area. The next step is to ship confirm, to indicate that the items are loaded on to the carrier from the staging area. When you run Ship Confirm, the system decrements inventory and updates sales order line status. This information is then transferred through the Auto Invoice to Account Receivables for invoicing. Then you sent the invoice to your customer for the items shipped and then perform the cash management and bank reconciliations.
Order Management receives detailed item information from the Inventory application and price list information from the Pricing application. Orders and returns can be entered manually or imported through an EDI, CRM, or external source. Once in the system the order is ready to be pick released and shipped, if needed by the Shipping application. It can then proceed through the Auto Invoice program into the Oracle Receivables application to be invoiced. All of the accounting information is transferred to the General Ledger by the Inventory and Receivables applications.
The required fields to enter on the sales order header are the customer name or number and order type. Other values such as Ship-To Address, Bill-To Address, Shipping Method, and Price List default. The order number is generated based on the order type. The required fields to enter on the sales order lines are Ordered Item and Quantity. Again, based on defaulting rules and setups in Pricing, Inventory and Shipping, the other values would default on the sales order line.

Setup steps for executing the Order to Cash flow with a standard item:
·         Prior to order entry, the items should be created / defined in inventory module using the master items screen and assigned to the shipping organization. Check the blog post for the related setups
·         Add the item to the price list or create a new price list.
·         Transaction Type must be defined
·         Document Sequence must be assigned to the document category.
·         Customers must be defined
·         Salespersons must be defined
·         Shipping Roles should be granted to the user.
·         Ensure that the items are available in your shipping sub inventory or perform miscellaneous transactions to augment the same.

Following are some useful related links:
Check the blog post for tables involved in various stages of O2C
Check the blog post on queries involved in Order management
Order to Cash flow with tables involved in various stages:


Order to Cash flow with statuses at various stages:


All possible flow statuses of the order/line:
• OE_ORDER_HEADERS_ALL.flow_status_code: Order Header (Entered) àBooked Order (Booked) à Closed Order (Closed)

• OE_ORDER_LINES_ALL.flow_status_code: Order Line (Entered) à Booked Order (Awaiting Shipping) à Pick Released(Picked/Staged) à Ship Confirmed (Shipped) à INV/OM interfaced (Fulfilled)à Close Order (Closed)
1.    Enter the order header, line details and Book it:
Responsibility: Order Management Super User, Vision Operations (USA)
Navigate to Orders, Returns à Sales Orders
Open the Sales Orders Window

Order Number: 66413


  
2.    Schedule order:
·         Check if the order lines are scheduled or not. If any of the order line is in BOOKED status, it means that the order line is not yet scheduled.

·         Run the Schedule Order concurrent program to schedule the order. After the concurrent program is scheduled the order line will move to Awaiting Shipping status.

·         Still if the order lines do not go to Awaiting Shipping, check for any holds on the order line/ header. Release the holds (if any) and re-run theSchedule Order program.
·         You can even schedule the order line in the following way: Right click on the order line and progress the line to schedule it. Check the OM scheduling related setups

Order tables:
OE_ORDER_LINES_ALL.visible_demand_flag: visible_demand_flag= Yes lines will be made available as Demanded to Planning

Shipping tables: The shipping tables get populated after order scheduling.
WSH_DELIVERY_DETAILS.released_status: monitors the shipping process of the order line

WSH_DELIVERY_ASSIGNMENTS: Assigns delivery details to a delivery and/or a parent delivery detail.

Once the order is booked from the application, following changes occur in the backend
§  OE_ORDER_HEADERS_ALL (flow_status_code as BOOKED, booked_flag updated to Y)
§  OE_ORDER_LINES_ALL (flow_status_code as AWAITING_SHIPPING, booked_flag updated Y)
§  Since the order is now booked, delivery details of the order are created in WSH_DELIVERY_DETAILS table. WSH_DELIVERY_DETAILS has delivery lines and LPNs.
                           OOL.line_id = WDD.source_line_id
§  These delivery details information can been viewed form ‘Shipping Transactions Form’ and the delivery status in the application will be as ‘Ready to Release’
§  WSH_DELIVERY_DETAILS.released_status =’R’
§  WSH_DELIVERY_DETAILS.Release_Status can have any of the below valid values
§  WSH_DELIVERY_ASSIGNMENTS (WDA) assigns delivery details to a delivery and/or a parent delivery detail (LPN).

WDA.delivery_detail_id = WDD.delivery_detail_id

§  WSH_DELIVERY_ASSIGNMENTS.delivery_id will be NULL as still pick release operation is not performed as final delivery is not yet created.
§  At the same time when order is booked ‘Demand interface program’ is triggered in the background and demand of the item with specified quantity is created and these demand information is stored in MTL_DEMAND.
MTL_DEMAND.demand_source_line = OOL.line_id

3.    Pick Release the Sales Order
·         Navigate to the Shipping Transaction Form (Shipping à Transactions)
Enter the following in the Query Manager window and click Find
From Order Number = 66413 To Order Number = 66413

·         You can find the data in Shipping transaction screen (WSH shipping tables) only when order is scheduled.

·         On the Shipping Transaction Form select Launch Pick Release from the Action menu and click on GO button. 

·         If Auto Pick confirm is not selected while pick release, then we have to manually do the transact move order process. In fact pick confirm also triggers the transact move order process in which the inventory is moved from item sub inventory to staging area.

Order line status becomes ‘Picked’ on Order and ‘Staged/Pick Confirmed’ on Shipping Form.

§  MTL_MATERIAL_TRANSACTIONS_TEMP (Record gets deleted from here and gets posted to MTL_MATERIAL_TRANSACTIONS)
§  OE_ORDER_LINES_ALL.flow_status_code =’PICKED’
§  MTL_MATERIAL_TRANSACTIONS is updated with Sales Order Pick Transaction 

MMT.trx_source_line_id  = OOL.line_id

§  MTL_TRANSACTION_ACCOUNTS is updated with accounting information
§  WSH_DELIVERY_DETAILS. released_status=‘Y’ (‘Released’)
§  WSH_DELIVERY_ASSIGNMENTS, MTL_ONHAND_QUANTITIES are updated accordingly
Note: Pick Confirm step can be eliminated if ‘Auto Pick Confirm’ is selected as ‘YES’ while performed manual pick release. If Pick release is done through shipping transactions form and if you want to perform auto pick confirm then picking rules setup has to be done.
4.    Ship Confirm the Sales Order
·         Navigate to the Shipping Transaction Form (Shipping à  Transactions)

·         Enter the following in the Query Manager window and click Find
From Order Number = 66413 To Order Number = 66413

·         On the Shipping Transaction Form navigate to the Delivery Tab and select Ship Confirm from the Action menu and click on GO button. Ship confirm process triggers the Interface Trip Stops concurrent program.

o    OE_ORDER_LINES_ALL.flow_status_code =‘SHIPPED’
o    WSH_DELIVERY_DETAILS. released_status=‘C’ (‘Shipped’)
o    Data from MTL_TRANSACTIONS_INTERFACE is moved to MTL_MATERIAL_TRANACTIONS and MTL_MATERIAL_TRANSACTIONS is updated withSales Order Issue transaction.
o    Data is deleted from MTL_DEMAND, MTL_RESERVATIONS and WSH_NEW_DELIVERIES
o    Item reduced from MTL_ONHAND_QUANTITIES
MTL_TRANSACTION_ACCOUNTS is updated with accounting information.

Following are the pick release status:
Table: WSH_DELIVERY_DETAILS
Column: RELEASED_STATUS
Possible Values:
B: Backordered- Line failed to be allocated in Inventory
C: Shipped -Line has been shipped
D: Cancelled -Line is Cancelled
N: Not Ready for Release -Line is not ready to be released
R: Ready to Release: Line is ready to be released
S: Released to Warehouse: Line has been released to Inventory for processing
X: Not Applicable- Line is not applicable for Pick Release
Y: Staged- Line has been picked and staged by Inventory


Check the blog post for the detailed pick release status



  
·         Verify the details on the Confirm Delivery window and click OK and close the window.  
5.    Run the Interface Trip Stop – SRS Program
·         The Interface Trip Stop (ITS) will be trigger at the time of Shipping if check box “Defer Interface” is not check. ITS can also be executed from concurrent request.

Interface Trip Stop has two main components:
1.    Update the Order Management Data (oe_order_lines_all)
2.    Trigger the Inventory Interface (to Update the Inventory tables)

·         ITS updates the following fields on oe_order_lines_all table:
·         Shipped_quantity
·         Shipping_quantity
·         Actual_shipment_date

·         Inventory Interface will be trigger only if the first part, that means related to OM has successfully completed and flag OE_INTERFACED_FLAG = ‘Y’ on WSH_DELIVERY_DETAILS.  If value of this flag is N/P then Inventory Interface will never be triggered. And even if you try to submit the Inventory Interface from SRS, delivery detail with oe_interfaced_flag =’N’ will never be picked up.

o    oe_interfaced_flag = Y -- signifies ITS has interfaced shipping data to OM
o    inv_interfaced_flag = Y -- signifies ITS has interfaced shipping data to INV

Navigate to Shipping Interfaces window (Shipping 
à Interfaces à Run)
Select the Interface Trip Stop - SRS Program from the LOVs
On the parameters window enter
Mode = All
Click on the OK button and then on the Submit button:

6.    Run the Master AutoInvoice Program
Navigate to the Run AutoInvoice window, (Interfaces à AutoInvoice)
Select the AutoInvoice Master Program from the LOV
On the parameters window enter
Invoice Source = ORDER ENTRY
Default Date = Enter Today’s Date
(Low) Sales Order Number = 66413
(High) Sales Order Number = 66413
Then click OK and Submit button.

7.    View the Transaction created by the AutoInvoice Program
·         Navigate to the Additional Line Information window, (Orders, Returns àOrder Organizer)
·         On the Find Order window, query your order number = 66413
·         On the Order Organizer window, navigate to Lines Tab and click on Actions button and select the Additional Line information and click OK.

8.    On the Additional Line Information window, navigate to Invoices / Credit Memos Tab and click on the Invoice Details button. This would open Transactions window, where you can see the invoice details.

Saturday 26 September 2015

Query to get the AR Invoice Amount, transaction type and location -- Oracle Apps

SELECT
RCT.CUSTOMER_TRX_ID,
RCT.TRX_NUMBER,
RCT.TRX_DATE,
RCG.GL_DATE,
RCT.PURCHASE_ORDER,
OOD.ORGANIZATION_ID,
OOD.ORGANIZATION_NAME,
HCSUA.SITE_USE_ID,
HCSUA.LOCATION,
RCL.DESCRIPTION,
HCA.ACCOUNT_NUMBER,
HP.PARTY_NAME,
RTT.NAME TRANSACTION_NAME,
DECODE(RTT.TYPE,'INV','INVOICE','CM','Credit Memo','DM','Debit Memo') TRANSACTION_TYPE,
DECODE(RCL.LINE_TYPE,'LINE','LINE_TOTAL','TAX','TOTAL_TAX') LINE_TYPE,
sum((DECODE(RCT.INVOICE_CURRENCY_CODE,'INR',RCG.AMOUNT*1,RCG.AMOUNT*RCT.EXCHANGE_RATE))) TOTAL_INV_AMOUNT,  
FU.USER_ID,FU.USER_NAME
FROM
RA_CUSTOMER_TRX_ALL RCT,
RA_CUSTOMER_TRX_LINES_ALL RCL,
RA_CUST_TRX_LINE_GL_DIST_ALL RCG,
ORG_ORGANIZATION_DEFINITIONS OOD,
HZ_CUST_ACCOUNTS HCA,
HZ_PARTIES HP,
RA_CUST_TRX_TYPES_ALL RTT,
FND_USER FU
--,HZ_CUST_ACCT_SITES_ALL HCASA,
,HZ_CUST_SITE_USES_ALL HCSUA
WHERE
RCT.CUSTOMER_TRX_ID = RCL.CUSTOMER_TRX_ID
AND RCL.CUSTOMER_TRX_LINE_ID = RCG.CUSTOMER_TRX_LINE_ID
AND RCT.BILL_TO_CUSTOMER_ID = HCA.CUST_ACCOUNT_ID
AND HCA.ACCOUNT_NUMBER = 'XXRAM001'
AND HCA.PARTY_ID = HP.PARTY_ID
AND RCT.LAST_UPDATED_BY = FU.USER_ID
AND RCT.CUST_TRX_TYPE_ID = RTT.CUST_TRX_TYPE_ID
AND TO_NUMBER(RCT.INTERFACE_HEADER_ATTRIBUTE10) = OOD.ORGANIZATION_ID (+)
--AND HCASA.CUST_ACCOUNT_ID=HCA.CUST_ACCOUNT_ID
--AND HCASA.CUST_ACCT_SITE_ID=HCSUA.CUST_ACCT_SITE_ID
AND RCT.BILL_TO_SITE_USE_ID=HCSUA.SITE_USE_ID
AND RCT.TRX_DATE BETWEEN :PFROM AND :PTO
GROUP BY
RCT.CUSTOMER_TRX_ID,RCT.TRX_NUMBER,
RCT.CUST_TRX_TYPE_ID,RCT.TRX_DATE,RCG.GL_DATE,
RCT.CUSTOMER_TRX_ID,RCT.PURCHASE_ORDER,OOD.ORGANIZATION_NAME,
RCL.DESCRIPTION,
HCA.ACCOUNT_NUMBER,OOD.ORGANIZATION_ID,
HP.PARTY_NAME,
HCSUA.SITE_USE_ID,HCSUA.LOCATION,
FU.USER_ID,FU.USER_NAME,
RTT.NAME,RTT.TYPE,RCL.LINE_TYPE
ORDER BY RCT.TRX_DATE DESC

Query to get Receipt data with tax details -- Oracle Apps

SELECT
VENDOR_CODE,
VENDOR_NAME,
CATEGORY,
VENDOR_SITE_CODE,
ADDRESESS1,
ADDRESESS2,
CITY,
STATE,
COUNTRY,
CONTACT,
CONTACT_EMAIL, --CURRENCY_CODE,
SUM(NVL("BASE_VALUE",0)+NVL("SALES TAX",0)+NVL("EXCISE",0)+NVL("INSURANCE",0)+NVL("OTHERS",0)+NVL("FREIGHT",0))TOTAL
FROM
(
SELECT DISTINCT C.SEGMENT1 VENDOR_CODE,
                 C.VENDOR_NAME,
C.VENDOR_TYPE_LOOKUP_CODE Category,
E.VENDOR_SITE_CODE,
E.ADDRESS_LINE1 ADDRESESS1,
E.ADDRESS_LINE2 ADDRESESS2,
E.CITY,
                 E.STATE,
UPPER(PC.NAME) COUNTRY,
E.PHONE CONTACT,
E.ATTRIBUTE11 CONTACT_EMAIL,H.CURRENCY_CODE,A.RECEIPT_NUM,D.SHIPMENT_LINE_ID,
                NVL(DECODE (H.CURRENCY_CODE,
                            'INR',
                             P.ACT_QTY * H.PO_UNIT_PRICE,
                             P.ACT_QTY * H.PO_UNIT_PRICE * H.CURRENCY_CONVERSION_RATE
                            ),0) "BASE_VALUE",
                NVL(DECODE (H.CURRENCY_CODE,
                          'INR',
                           NULL,
                           P.ACT_QTY * H.PO_UNIT_PRICE
                           )
                     + ROUND (DECODE (H.CURRENCY_CODE,
                            'INR',
                             NULL,
                             I.TAX_AMOUNT / H.CURRENCY_CONVERSION_RATE
                                )
                        ),0) "GRN DOLLER VAL",
                ROUND ((I.TAX_AMOUNT / I.QTY_RECEIVED) * P.ACT_QTY ) "TOTAL_LINE_AMT",
                ST.TAX_TYPE,
            NVL((ST.SALESTAX * P.ACT_QTY / H.QUANTITY),0) "SALES TAX",
              ETAX.TAX_TYPE ETAX_TYPE,    
              ETAX.SALESTAX * P.ACT_QTY / H.QUANTITY "ENTRY TAX",
              NVL((ET.EXCISE * P.ACT_QTY / H.QUANTITY),0) "EXCISE",
              NVL((INS.INSURANCE * P.ACT_QTY / H.QUANTITY),0) "INSURANCE",
              NVL((Freight.Freight * P.ACT_QTY / H.QUANTITY),0) "FREIGHT",
              NVL((OTHES.OTHERS * P.ACT_QTY / H.QUANTITY),0) "OTHERS",
              DECODE (A.RECEIPT_SOURCE_CODE,
                        'VENDOR',
                         C.VENDOR_NAME,
                        'CUSTOMER',
                         NULL,
                        ORG.ORGANIZATION_NAME ) "VENDOR_NAME1"
           FROM
            PO.RCV_SHIPMENT_HEADERS A,
            PO.PO_HEADERS_ALL B,
   APPS.AP_SUPPLIERS C,
            PO.RCV_SHIPMENT_LINES D,
            APPS.AP_SUPPLIER_SITES_ALL E,  
            INV.MTL_SYSTEM_ITEMS_B F,
            PO.RCV_TRANSACTIONS H,
   APPS.JAI_RCV_LINES  I,
   APPS.JAI_RCV_LINE_TAXES RCV,
            INV.MTL_CATEGORIES_B J,
            GL.GL_CODE_COMBINATIONS K,
   PA_COUNTRY_V PC,
            APPS.JAI_CMN_VENDOR_SITES L,
            APPS.AP_TERMS M,
              (SELECT
                  TRIM (A.FLEX_VALUE) AS FLEXID,
                        B.DESCRIPTION AS PRODUCT
FROM
                   APPS.FND_FLEX_VALUES A,
                   APPS.FND_FLEX_VALUES_TL B
WHERE
                   A.FLEX_VALUE_ID = B.FLEX_VALUE_ID
                   AND A.FLEX_VALUE_SET_ID =
  (SELECT FLEX_VALUE_SET_ID
                      FROM APPS.FND_ID_FLEX_SEGMENTS
     WHERE APPLICATION_COLUMN_NAME = 'SEGMENT6'
AND ID_FLEX_CODE = 'GL#')) FLEX,
   (SELECT   SHIPMENT_HEADER_ID, SHIPMENT_LINE_ID,
                          SUM (QUANTITY) ACT_QTY
                     FROM PO.RCV_TRANSACTIONS
                    WHERE TRANSACTION_TYPE = 'DELIVER'
                 GROUP BY SHIPMENT_HEADER_ID, SHIPMENT_LINE_ID) P,
                (SELECT   SHIPMENT_HEADER_ID, SHIPMENT_LINE_ID,
                          SUM (QUANTITY) RJT_QTY
                     FROM PO.RCV_TRANSACTIONS
                    WHERE UPPER(TRANSACTION_TYPE) = 'REJECT'
                 GROUP BY SHIPMENT_HEADER_ID, SHIPMENT_LINE_ID) Q,
                (SELECT   SHIPMENT_HEADER_ID, SHIPMENT_LINE_ID,
                          SUM (QUANTITY) RTN_QTY
                     FROM PO.RCV_TRANSACTIONS
                    WHERE UPPER(TRANSACTION_TYPE) = 'RETURN TO VENDOR'
                 GROUP BY SHIPMENT_HEADER_ID, SHIPMENT_LINE_ID) R,
                (SELECT   SUM (TAX_AMOUNT) SALESTAX, SHIPMENT_LINE_ID,
                          SHIPMENT_HEADER_ID,TAX_TYPE
                     FROM
     APPS.JAI_RCV_LINE_TAXES
                    WHERE UPPER(TAX_TYPE) IN ('SALES TAX', 'CST', 'LST')
       AND UPPER(TAX_NAME) NOT LIKE '%ENTRY%'
                 GROUP BY SHIPMENT_LINE_ID, SHIPMENT_HEADER_ID,TAX_TYPE
                ) ST,
                (SELECT   SUM (TAX_AMOUNT) SALESTAX, SHIPMENT_LINE_ID,
                          SHIPMENT_HEADER_ID,TAX_TYPE
                     FROM
APPS.JAI_RCV_LINE_TAXES
                    WHERE UPPER(TAX_TYPE) IN ('SALES TAX', 'CST', 'LST')
AND UPPER(TAX_NAME) LIKE '%ENTRY%'
                 GROUP BY SHIPMENT_LINE_ID, SHIPMENT_HEADER_ID,TAX_TYPE
) ETAX,
                (SELECT   SUM (TAX_AMOUNT) EXCISE, SHIPMENT_LINE_ID,
                          SHIPMENT_HEADER_ID
                     FROM
APPS.JAI_RCV_LINE_TAXES
                    WHERE UPPER(TAX_TYPE) IN ('EXCISE', 'CUSTOMS', 'CVD')
                 GROUP BY SHIPMENT_LINE_ID, SHIPMENT_HEADER_ID) ET,
                (SELECT   SUM (TAX_AMOUNT) INSURANCE, SHIPMENT_LINE_ID,
                          SHIPMENT_HEADER_ID
                     FROM
APPS.JAI_RCV_LINE_TAXES
                    WHERE UPPER(TAX_TYPE) IN ('INSURANCE')
                 GROUP BY SHIPMENT_LINE_ID, SHIPMENT_HEADER_ID) INS,
                 (SELECT   SUM (TAX_AMOUNT) FREIGHT, SHIPMENT_LINE_ID,
                          SHIPMENT_HEADER_ID
                     FROM
APPS.JAI_RCV_LINE_TAXES
                    WHERE UPPER(TAX_TYPE) IN ('FREIGHT')
                 GROUP BY SHIPMENT_LINE_ID, SHIPMENT_HEADER_ID) Freight,
                (SELECT   SUM (TAX_AMOUNT) OTHERS, SHIPMENT_LINE_ID,
                          SHIPMENT_HEADER_ID
                     FROM
APPS.JAI_RCV_LINE_TAXES
                    WHERE UPPER(TAX_TYPE) NOT IN
                             ('EXCISE',
                              'CUSTOMS',
                              'CVD',
                              'SALES TAX',
                              'CST',
                              'LST',
                              'INSURANCE' ,
                              'FREIGHT'
                             )
                 GROUP BY SHIPMENT_LINE_ID, SHIPMENT_HEADER_ID) OTHES,
                APPS.ORG_ORGANIZATION_DEFINITIONS ORG
--              AP.AP_INVOICES_ALL AP,
--              (SELECT * FROM AP.AP_INVOICE_DISTRIBUTIONS_ALL WHERE REVERSAL_FLAG IS NULL) APID
          WHERE D.PO_HEADER_ID = B.PO_HEADER_ID(+)
            AND A.SHIPMENT_HEADER_ID = D.SHIPMENT_HEADER_ID
            AND A.VENDOR_ID = C.VENDOR_ID(+)
            AND A.VENDOR_SITE_ID = E.VENDOR_SITE_ID(+)
            AND D.TO_ORGANIZATION_ID = F.ORGANIZATION_ID
            AND D.ITEM_ID = F.INVENTORY_ITEM_ID
            AND D.SHIPMENT_HEADER_ID = H.SHIPMENT_HEADER_ID
            AND D.SHIPMENT_LINE_ID = H.SHIPMENT_LINE_ID
            AND H.TRANSACTION_TYPE = 'RECEIVE'
            AND D.CATEGORY_ID = J.CATEGORY_ID
            AND F.COST_OF_SALES_ACCOUNT = K.CODE_COMBINATION_ID
            AND H.SHIPMENT_HEADER_ID = I.SHIPMENT_HEADER_ID(+)
            AND H.SHIPMENT_LINE_ID = I.SHIPMENT_LINE_ID(+)
            AND H.SHIPMENT_HEADER_ID = P.SHIPMENT_HEADER_ID(+)
            AND H.SHIPMENT_LINE_ID = P.SHIPMENT_LINE_ID(+)
            AND H.SHIPMENT_HEADER_ID = Q.SHIPMENT_HEADER_ID(+)
            AND H.SHIPMENT_LINE_ID = Q.SHIPMENT_LINE_ID(+)
            AND H.SHIPMENT_HEADER_ID = R.SHIPMENT_HEADER_ID(+)
            AND H.SHIPMENT_LINE_ID = R.SHIPMENT_LINE_ID(+)
            AND RCV.SHIPMENT_HEADER_ID = ST.SHIPMENT_HEADER_ID(+)
            AND RCV.SHIPMENT_LINE_ID = ST.SHIPMENT_LINE_ID(+)
            AND RCV.SHIPMENT_LINE_ID = ET.SHIPMENT_LINE_ID(+)
            AND RCV.SHIPMENT_HEADER_ID = ET.SHIPMENT_HEADER_ID(+)
            AND RCV.SHIPMENT_LINE_ID = INS.SHIPMENT_LINE_ID(+)
            AND RCV.SHIPMENT_HEADER_ID = INS.SHIPMENT_HEADER_ID(+)
            AND RCV.SHIPMENT_HEADER_ID = OTHES.SHIPMENT_HEADER_ID(+)
            AND RCV.SHIPMENT_LINE_ID = OTHES.SHIPMENT_LINE_ID(+)
            AND RCV.SHIPMENT_HEADER_ID(+) = H.SHIPMENT_HEADER_ID
            AND RCV.SHIPMENT_LINE_ID(+) = H.SHIPMENT_LINE_ID
            AND ORG.ORGANIZATION_ID(+) = A.ORGANIZATION_ID
--           AND APID.INVOICE_ID = AP.INVOICE_ID(+)
--           AND H.TRANSACTION_ID = APID.RCV_TRANSACTION_ID(+)
            AND C.VENDOR_ID IS NOT NULL
---         AND F.COST_OF_SALES_ACCOUNT = K.CODE_COMBINATION_ID
            AND FLEX.FLEXID = K.SEGMENT6
             AND E.VENDOR_ID = L.VENDOR_ID(+)
             AND E.VENDOR_SITE_ID  =  L.VENDOR_SITE_ID(+)
     AND B.TERMS_ID=M.TERM_ID  
AND PC.COUNTRY_CODE=E.COUNTRY
AND RCV.SHIPMENT_HEADER_ID = ETAX.SHIPMENT_HEADER_ID(+)
            AND RCV.SHIPMENT_LINE_ID = ETAX.SHIPMENT_LINE_ID(+)
AND RCV.SHIPMENT_HEADER_ID = Freight.SHIPMENT_HEADER_ID(+)
            AND RCV.SHIPMENT_LINE_ID = Freight.SHIPMENT_LINE_ID(+)
AND H.CURRENCY_CODE  IN ('INR')
AND TRUNC(H.TRANSACTION_DATE) BETWEEN :PFROM AND :PTO
)
GROUP BY
VENDOR_CODE,
VENDOR_NAME,
CATEGORY,
VENDOR_SITE_CODE,
ADDRESESS1,
ADDRESESS2,
CITY,
STATE,
COUNTRY,
CONTACT,
CONTACT_EMAIL
ORDER BY
VENDOR_CODE

Query to find the AP SUPPLIERS and HZ Parties -- Oracle Apps

SELECT
asp.vendor_id ,
asp.segment1 "Supplier Num" ,
asp.vendor_name "Supplier Name" ,
ass.vendor_site_code "site name" ,
hou.name "Operating Unit Name" ,
ass.address_line1 ,
ass.city ,
ass.state ,
ass.zip ,
ass.country ,
ass.phone ,
person.person_first_name ,
person.person_last_name ,
pty_rel.primary_phone_number ,
pty_rel.email_address
FROM
ap_suppliers asp ,
ap_supplier_sites_all ass ,
APPS.ap_supplier_contacts apsc ,
hz_parties person ,
hz_parties pty_rel,
hr_operating_units hou
WHERE
ass.vendor_id = asp.vendor_id
AND apsc.per_party_id = person.party_id
AND apsc.rel_party_id = pty_rel.party_id
AND ass.org_id = hou.organization_id
AND apsc.org_party_site_id = ass.party_site_id


Query to find the record count of table -- Oracle Apps

create or replace
function get_records( p_tname in varchar2 ) return number
as
    l_colval  number default NULL;
begin
    execute immediate
       'select count(*)
          from ' || p_tname INTO l_colval;

    return l_colval;
end;


Ex: 1. select
user, table_name,
       get_records(table_name) cnt
  from
user_tables
 
2. select
user, TNAME,
       get_records(TNAME) cnt
  from
R12_TABLES

Join between MTL tables -- Oracle Apps

SELECT
mta.organization_id org_id,
OOD.ORGANIZATION_NAME,
mta.inventory_item_id inv_id,
MSIB.SEGMENT1,
MSIB.DESCRIPTION,
mtt.transaction_type_name,
mta.transaction_date,
(mta.PRIMARY_QUANTITY*-1) AS PRIMQTY,
(mta.base_transaction_value*-1) AS Base_Val
FROM
APPS.mtl_parameters mtp,
APPS.mtl_transaction_accounts mta,
APPS.mtl_material_transactions  mmt,
APPS.mtl_transaction_types mtt,
ORG_ORGANIZATION_DEFINITIONS OOD,
MTL_SYSTEM_ITEMS_B MSIB
WHERE
mta.transaction_id = mmt.transaction_id
AND mmt.transaction_type_id = mtt.transaction_type_id
AND mtp.material_account = mta.reference_account
AND mtp.organization_id = mta.organization_id
AND mta.organization_id = OOD.organization_id
AND MSIB.ORGANIZATION_ID = OOD.ORGANIZATION_ID
AND MSIB.INVENTORY_ITEM_ID = MTA.INVENTORY_ITEM_ID
AND mta.primary_quantity <= 0
AND TRUNC (mta.transaction_date) BETWEEN :SDATE AND  :EDATE

Query to find the Active User list -- Oracle Apps

select
*
from
fnd_user
where
END_DATE <sysdate