Query for Sales Order and AR Invoice Information

Hi,
I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
Sales Order columns reqd:
OPERATING_UNIT     
ORDER_NUMBER     
CUSTOMER_NUM     
CUSTOMER_NAME     
ORDERED_DATE     
FLOW_STATUS_CODE     
TOTAL_ORDER_AMOUNT
AR invoice columns reqd for the sales orders:
Invoice number,
Invoice date,
Invoice Total.
Can anyone help me out with this?
Thanks,
Ash

Hi Ash,
Table RA_CUSTOMER_TRX_ALL can be joined to RA_CUSTOMER_TRX_LINES_ALL table through CUSTOMER_TRX_ID column. The table RA_CUSTOMER_TRX_LINES_ALL.INTERFACE_LINE_ATTRIBUTE6 = OE_ORDER_LINES_ALL.LINE_ID. And from the LineId, you can get the HeaderId os the OE_ORDER_HEADERS_ALL table.
You must have visualized the query by now.
Thanks
Sumit

Similar Messages

  • Query for Sales order and corr.AR Invoice Info

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT
    ORDER_NUMBER
    CUSTOMER_NUM
    CUSTOMER_NAME
    ORDERED_DATE
    FLOW_STATUS_CODE
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    There are some issues that must be defined before you have the exact query.
    Do you have freight charges or non-inclusive tax? If you have, freight charges and tax amounts must be included?
    Depending on you grouping rule, you can have lines from more than one order in a single invoice. In this case, as invoice amount you want the sum of all lines, or only the lines from that order?
    Below is an example using two views. It assumes that grouping rules split lines from different order into different invoices.
    Hope it helps,
    Ketter Ohnes
    create or replace view order_summary as
    select oh.org_id,
    oh.ORDER_NUMBER,
    oh.header_id,
    ott.name tt_name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code,
    sum(ol.ordered_quantity*ol.unit_selling_price) total,
    sum(ol.tax_value) tax,
    (select sum(operand)
    from OE_PRICE_ADJUSTMENTS_v x
    where x.header_id = oh.header_id
    and x.adjustment_type_code='FREIGHT_CHARGE') freight_charge
    from oe_order_headers_all oh,
    oe_order_lines_all ol,
    hz_cust_accounts ca,
    hz_parties p,
    oe_transaction_types_tl ott
    where ol.header_id=oh.header_id
    and oh.sold_to_org_id = ca.cust_account_id
    and ca.party_id = p.party_id
    and oh.order_type_id = ott.transaction_type_id
    and ott.language =
    (select language_code
    from fnd_languages
    where installed_flag = 'B')
    group by oh.org_id,
    oh.header_id,
    oh.ORDER_NUMBER ,
    ott.name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code;
    create or replace view invoice_summary as
    select a.interface_header_context,
    a.trx_date,
    a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2 tt_name,
    a.customer_trx_id,
    sum(b.extended_amount) invoice_total
    from ra_customer_trx_all a,
    ra_customer_trx_lines_all b
    where a.customer_trx_id = b.customer_trx_id
    and b.interface_line_context = 'ORDER ENTRY'
    and b.line_type in ('LINE','FREIGHT')
    group by a.interface_header_context,
    a.trx_date, a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2,
    a.customer_trx_id;
    select *
    from order_summary o,
    invoice_summary i
    where o.order_number between :1 and :2
    and o.order_number = i.interface_line_attribute1
    and o.tt_name = i.tt_name;

  • Table For Open Sales Order And Customer Invoices

    Dear Gurus,
    Are there any table to know open Sales orders and pending invoices for Customers?
    Wishes,
    Abhishek

    Hi,
    Go to T code VA05 and select open sales order radio button. Put other input parameters like date range or sold to . Execute you shal get list of all open sales order.
    For pending invoices go to T code VL04 and you get list of all billing not yet created even though GI is done.
    These are standard SAP functionality and can be used rather than looking in a table level.
    Regards
    Vivek

  • Query for Sales Order Analysis

    Dear Experts
    I have written a Query for Sales Order Analysis and would like to have help on this.
    The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum] ORDER BY T0.[DocNum]
    where U_Total_GP is a UDF for storing the GP of each order.
    After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. However, the query does not calculate column total for total amount and total GP. Although I know the total for each column can be displayed by pressing "Ctrl" + Click on the column title, it would have to be done from time to time.
    Therefore, I would like to modify my query in order to calculate the column totals when executed. Are there any suggestions for this?
    Thank you
    Regards
    Elton

    Hi Elton,
    Try this:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]
    ORDER BY T0.[DocNum]
    Thanks,
    Gordon

  • How to make the connection between a sale order and an invoice in SDK

    Hi,
    Im trying to make the connection between a sales order and an invoice using the SDK.
    Here is how i create each of them:
    Invoice:
    public int SalesInvoiceInternalSave(string buisnesspartnerCardCode, DateTime dueDate, double discountPercent, string id, IList<InternalItem> items, ref int invoiceId)
          int res = 0;
          SAPbobsCOM.Documents invoice_entry = (SAPbobsCOM.Documents)Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);     
          invoice_entry.CardCode = buisnesspartnerCardCode;
          invoice_entry.DocDueDate = dueDate;
          invoice_entry.DiscountPercent = discountPercent;
          invoice_entry.Reference2 = id;
          foreach (InternalItem item in items)
            invoice_entry.Lines.WarehouseCode = item.Shopid;
            invoice_entry.Lines.ItemCode = item.Code;
            invoice_entry.Lines.ItemDescription = item.Name;
            invoice_entry.Lines.Quantity = item.Quantity;
            invoice_entry.Lines.UnitPrice = item.Price;
            invoice_entry.Lines.Add();
          res = invoice_entry.Add();
          return res;
    Sales order:
        public Boolean SalesOrderInternalSave(string orderId, string buisnesspartnerCardCode, DateTime dueDate, IList<InternalItem> items)
          SAPbobsCOM.Documents order_entry = (SAPbobsCOM.Documents)Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
          order_entry.CardCode = buisnesspartnerCardCode;
          order_entry.DocDueDate = dueDate;
          foreach (InternalItem item in items)
            order_entry.Lines.WarehouseCode = item.Shopid;
            order_entry.Lines.ItemCode = item.Code;
            order_entry.Lines.ItemDescription = item.Name;
            order_entry.Lines.Quantity = item.Quantity;
            order_entry.Lines.UnitPrice = item.Price;
            order_entry.Lines.Add();      
          int res = order_entry.Add();
          return res == 0;
    What do i need to change to get the connection between the two of them?
    And how do you insert a amount (not percent) discount into an invoice?
    Regards,
    Torben

    Hi,
    Add the sale order, then add the invoice. and while adding the invoice please add the following details to the invoce documen
    invoice_entry.Lines.BaseEntry = 'Doc entry of the newly created SO
    invoice_entry.Lines.BaseLine = 'Line No of the SO
    invoice_entry.Lines.BaseType = 17 'For sales order document type.
    Hope it helps,
    Vasu Natari.

  • CRM - R-3 integration for sales order and billing

    Hi All,,
    Please could you help me to set up the connectivity between CRM and R-3.
    This will be for Sales order and billing.
    Regards,
    Piyush

    Hi All,
    Thanks for your information.
    I have created a site, subscription, connectivity is established between R-3 and CRM through RFC destination.
    What else do i need to do, Could you please share <b>step by step</b> information for the whole scenario 'Sales order in CRM to R-3 and Billing info from R-3 to CRM ?
    This will help me a lot to do things.
    If you have documents for this please mail me at [email protected]
    Regards,
    Piyush

  • VD05 - Customer master record blocked for sales orders and billing

    Hi,
    I have a scenario whereby I have blocked a customer master record for sales orders and billing using transaction VD05, but it still allows you to create sales orders and post billing documents.
    What is the reason for this?
    Regards
    Gandi

    Hi,
    Block the customer for the sales order, delivery and Billing for the specific sales area in vd05
    and try out,
    Regards
    Pradeep BV.

  • Sales Orders And Downpayment Invoices

    Hi,
    I am trying to get a link between the Sales Order and the Downpayment Invoices.
    As I open a Sales Order I cannot directly figure out weather it has a down payment
    invoice or not. (DP Invoices will not show on Target Document Button on the tool bar)
    Is there a way to Find it out??
    When I am going through the ORDR Table I have noticed DpmDrawn, DpmPrcnt, DpmAmnt, DpmAmntFC, DpmAmntSC, Columns.
    DpmDrawn Shows Values 'Y' or 'N' but rest of the fields are just showing default values (null or 0.00)  for every Sales order.
    Is there any setting I have to set up to fill those fields?
    or is there a better way to check that Sales Order has a Downpayment Invoice??
    Thank you very much for your help.

    Hi Suda,
    Thanks for the quick answer. True, that is the way I use to find the DP invoices.
    Problem is no one check it before they generate a new DP invoice for the Sales Order.
    We end up creating few DP invoices for the same Sales order.
    I just want to stop that. Thats why i am trying find out a link between sales order and the
    DP invoice and show it with the Sales order or give a rule.
    Thank you very much for the help.
    Kind Regards
    Sanjaya

  • Generating sales order and reserve invoice in a row

    Hi all,
    i'm using B1iSN PL14 with sap B1 8.8.
    I need to build the following scenario :
    I receive an xml file representing a sales order, i have to create :
    - a sales order
    - a reserve invoice based on the sales order
    I've create two BIUs that currently work.
    But now i'd like to chain the two BIUs and execute the the invoice creation only if a sales order has been created.
    What is the best way to do tha kind of thing ?
    thanks !

    I found it difficult in a similar situation & unfortunately didn't get much response from here.
    My workaround solution was:
    - I removed the filter for the B1i user; it's explained in the extensibility guide I think. Basically B1i ignores any events created by itself, but I removed that so B1i received all events including ones created by B1i itself.
    - When creating my first document (for the example lets say it was a Sales Order), I entered a specific text in the remarks field - you could also use a UDF
    - Then my BIU for the second document then had the following conditions
    Document = Sales Order
    User = B1i
    Remarks = CreatedWithB1i (for example)
    So using this, any time my first BIU completed succesfully, it triggered the second one... it's clearly a workaround solution, but it worked for me.

  • Update KOMV-KBETR field for sales order and billing

    I would like to update the KOMV-KBETR (condition amount or percentage) under condition tab for both Sales order and billing.
    example:There are two condition types ZA00 and ZB00 and need to get the KBETR value from ZA00 and add it to KBETR value of ZB00 and update the sum in KBER value of ZB00.
    1. creation of sales order & billing.
    2. Change of sales order & billing.
    3. For single & multiple line items in both sales order & billing.
    4. during updation of price in the change mode of sales order & billing.
    5.When user click on Update button in the condition tab(i.e., when clicked on Carryout new pricing)
    I tried with the VOFM routine but as the routine is triggering multiple times the sum is calculated again and again.For that I set flags also.It is working for sales orders but for billing creation the field XKOMV-KBETR is cleared after this routine.
    So I would like to know are there any EXITS for this scenario or any one entountered the similiar issue which I am facing.

    Hi Brad,
       It is an Client requirement.So need to do the addition of that condition types.
    Can you please let me know the configuration point where we can do it and the condition type which we need to update the Rate/Amount value.ie., KOMV-KBETR is and Price list value and not the subtotal one.
    Thanks,
    Srilakshmi Lagisetty.

  • BDC Program for Sales order and Enquiry

    Hi All,
    Pls can you help me.
    To create sales order and enquiry I have bapis .
    BAPI_SALESORDER_CREATEFROMDAT2
    BAPI_INQUIRY_CREATEFROMDATA2
    but i want BDC Programs for that bapis
    pls can you help me
    thanks
    mars

    Hi Krishna ,
    Please check the below links .
    [http://www.sap-basis-abap.com/abap/bapi-sample-to-upload-data-from-flat-file-to-va01.htm]
    [http://abapreports.blogspot.com/2008/06/bapi-sample-code-for.html] -- > Select and Copy from this one.

  • Authority check for sales order and stock transport order

    In my code i have a requirement to enter sales order and Stock transport order. However i want that a WM resource should not be allowed to enter sales order and an SD resouce should not be allowed to enter stock tranpsort order. Please suggest.

    Hi,
    Another way to solve this is create a Z table with field user name and Resource type and compare the user id ( sy-uname) with the Z table and allow accordingly.
    In production environment controlling authorization in this approch is much easier.
    Hope this helps.
    Regards
    Bikas

  • Best Datasources to use for Sales Orders and Invoiced Quantities

    Hello Experts,
    Just wanted to ask if anyone has experience and can recommended the ECC Datasources to use to extract:
    1. Invoiced Qty = Sales History
    2. Open Sales Orders
    3. Shipped Qty= Goods issued but not yet invoiced
    So far in my research I have down the following datasources:
    1. 2LIS_13_VDITM Billing Document Item Data  for Invoiced Quantities
    2. 2LIS_11_SSL, or 2LIS_11_SCL or 2LIS_11_VASCL for Open Sales Orders
    3. 2LIS_12_VCITM, 2LIS_11_V_SSL for Shipped Quantities
    Any suggestions?
    Thanks alot
    Victoria

    Hi Victoria:
    Plese take a look at SAP Best Practices (Scenario Documentation and Building Blocks)
       Open this URL: http://help.sap.com/bp_bw370/html/index.htm
    Click "Preconfigured Scenarios" link
    Click on the Links to navigate on the different available scenarios and to see the documents you can download (Technical Documentation > Configuration Guide)
    *Customer Relationship Management
    -- Sales Analysis
    -- Cross-Functional Analysis: Financial and Sales Data
    -- Booking Billing Backlog Analysis
    -- Sales Planning
    -- Scheduling Agreements Analysis
    -- CRM Analytics
    Edited by: Francisco Milan on Jun 3, 2010 6:23 PM

  • Different  Pricing Procedure for Sale order and Billing Document

    Hello Experts
    As per scenario,we create Excise Invoice (T-Code J1IIN) on Basis of Proforma Invoice.Proforma Invoice and Excise Invoice follow Pricing from Sale Order.AS per pricing Some excise condition types are get update in Proforma and excise Invoice.
    AS Per Customer Payment Confirmation we Create Export Billing Invoice (T-code VF01) on basis of Outbound delivery.
    Issue -: AS per export Billing Rule we don't want to update Excise Condition type in Export Billing Document,and at same time it should not create any accounting entries for same condition type. we Dont want excise Duity in Export Billing Document as Export Billing Doccumnet aslo Follow Pricing procedure of Sale order
    Should i create new Pricing procedure or what other things to solve above issue.
    Please help me out
    Thanks and Regards
    Pash@SD

    Hello,
    The key to your requirement can be maintenance of Excise condition type with proper access sequence and accordingly maintain condition record for them.
    You create an access sequence with following access:
    - Country / Plant / PlntRegion / Region / Price grp / Mat.pr.grp / Materia
    - Country / Plant / PlntRegion / Region / Price grp / Mat.pr.grp
    - Country / Plant / PlntRegion / Region / TaxCl1Cust / Mat.pr.grp
    - Country / Plant / PlntRegion / TaxCl1Cust / Mat.pr.grp
    For export maintain condition record based on any key combination, say for
    Country / Plant / PlntRegion / TaxCl1Cust / Mat.pr.grp - Tax % - Tax Code
    FR / 1000 / KR / 03 (EXPORT) / 04 / 0% / V1
    I hope this can assist you.
    Thanks & Regards
    JP

  • Query For Sales Order Amendments

    Hi,
    Does anyone have a query that lists the amendments to a Sales Order?
    I basically want to create an alert that runs this query once a day and shows me the sales orders that have been amended that particular day.
    Any help on this would be gratefully received.
    Regards
    David

    Hi..
    Try These Query in Alert you will get your req. fulfill
    SELECT T0.[DocNum], T0.[DocStatus], T0.[DocDate], T0.[DocDueDate], T0.[CardCode], T0.[CardName] FROM ADOC T0 WHERE T0.[ObjType] = 17 AND  T0.[UpdateDate] = GETDATE()
    Regards,
    Bhavank
    Edited by: Bhavank on Sep 28, 2010 5:50 PM

Maybe you are looking for

  • How Can I Use a Gmail Account with Multiple Email Addresses in iPhone Mail?

    So I have a Gmail account with 4 POP accounts that it checks...  Is there a way to get "Reply From" from multiple addresses? I've tried the following sites...  No luck with iOS 5... http://email.about.com/od/iphonemailtips/qt/gmail_multiaddr.htm http

  • Usb 6009 freeze

    Hi all, When using the USB 6009 interface for reading out two sensors (temperature and pressure, using the Voltage they generate) and sending signals to valves, my program keeps working. But after a while the USB module crashes. Most of the time both

  • 5th gen iPod Touch crashes spontaneously

    Hi there My 5th Gen iPod Touch crashes at random times, usually when on wifi.  When it does this, it resets my clock by ten or twenty or thirty minutes and I have to fix the time because it does not automatically restore via the Internet.  I tried re

  • Using "." in folder names

    Users on Windows 7 and 8 machines want to use dots "." in folder names--for example, "apple.orange.blue". I know this is legal but are there disadvantages with this in terms of search or possible use in the future in some form of document management

  • Raw formats not opening in Camera Raw

    Only got the software yesterday, got off to a good start, I can open Jpeg files in Camera Raw but I am not getting the same options for raw files. Camera is a nikon D90, shots download okay but appear small in the preview and I can't make them larger