Total sales and returns

Can you help, I  need a query for itemcode, description, sum(quantity) that is all items sold (inv1)  minus any of the same items returned (rin1)on a credit note, within a certain date range.  Would like to use the same query for deliveries and returns. (dln1 and rdn1). Thanks

The easy query will be like this one:
Select T0.ItemCode, T0.Dscription, SUM(T0.Quantity) AS Quantity From dbo.INV1 T0
Inner JOIN dbo.OINV T1 ON T1.DocEntry = T0.DocEntry
Where T0.Quantity > 0 AND T1.DocDate BETWEEN '[%0]' AND '[%1]'
Group By T0.ItemCode, T0.Dscription
Union All
Select T0.ItemCode, T0.Dscription, -SUM(T0.Quantity) AS Quantity From dbo.RIN1 T0
Inner JOIN dbo.ORIN T1 ON T1.DocEntry = T0.DocEntry
Where T0.Quantity > 0 AND T1.DocDate BETWEEN '[%0]' AND '[%1]'
Group By T0.ItemCode, T0.Dscription
Order By T0.ItemCode
Thanks,
Gordon

Similar Messages

  • How to get Total Sale and Total Revenue?

    Hi,
    I have received requirement to calculate Total Sale and Total Revenue.
    what is actual difference between total sales and Total revenue?
    Is there any report or query in EBS R12 from which we can find total sale and total revenue?
    Thanks,
    Kapil
    Edited by: Kapil Mistry on Aug 2, 2012 12:10 AM
    Edited by: Kapil Mistry on Aug 2, 2012 12:11 AM

    Hi,
    Can I use Receipt details to get total revenue i.e actual income from customer ?
    Please check the following query.
    SELECT code_combination_id,
    ra.applied_customer_trx_id,
    trx_number,
    SUM( NVL( line_applied, 0 )) line_receipt,
    SUM( NVL( tax_applied, 0 )) tax_receipt,
    SUM( NVL( freight_applied, 0 )) freight_receipt,
    SUM( NVL( amount_applied, 0 )) total_receipt
    FROM ar_receivable_applications_all ra,
    ra_customer_trx_all trx,
    ar_cash_receipts_all rcpt
    WHERE
    applied_customer_trx_id = trx.customer_trx_id
    AND ra.cash_receipt_id = rcpt.cash_receipt_id
    AND application_type = 'CASH'
    AND NVL(ra.confirmed_flag, 'Y' ) = 'Y'
    AND trx.complete_flag = 'Y'
    AND trx.org_id = 204
    AND trx.customer_trx_id = 51385
    GROUP BY code_combination_id,ra.applied_customer_trx_id,trx_number
    ORDER BY 3

  • How to get Total Sales and Total Revenue?

    Hi,
    I have received requirement to calculate Total Sales and Total Revenue.
    what is actual difference between total sales and Total revenue?
    Is there any report or query in EBS R12 from which we can find total sales and total revenu?
    Thanks,
    Kapil

    Hi,
    Can I use Receipt details to get total revenue i.e actual income from customer ?
    Please check the following query.
    SELECT code_combination_id,
    ra.applied_customer_trx_id,
    trx_number,
    SUM( NVL( line_applied, 0 )) line_receipt,
    SUM( NVL( tax_applied, 0 )) tax_receipt,
    SUM( NVL( freight_applied, 0 )) freight_receipt,
    SUM( NVL( amount_applied, 0 )) total_receipt
    FROM ar_receivable_applications_all ra,
    ra_customer_trx_all trx,
    ar_cash_receipts_all rcpt
    WHERE
    applied_customer_trx_id = trx.customer_trx_id
    AND ra.cash_receipt_id = rcpt.cash_receipt_id
    AND application_type = 'CASH'
    AND NVL(ra.confirmed_flag, 'Y' ) = 'Y'
    AND trx.complete_flag = 'Y'
    AND trx.org_id = 204
    AND trx.customer_trx_id = 51385
    GROUP BY code_combination_id,ra.applied_customer_trx_id,trx_number
    ORDER BY 3

  • Separate sales and return transaction for POSDM interface to ECC

    Hi experts
    We have a requirement to separate sales and return transaction movement types (251 and 252) for even the same articles.
    Currently, we are using two-step process but the aggregation will combine both sales and return transactions together.
    (For example, if i sell 2 article A and return 1 article A, the system will aggregate to selling only 1 article A with movement type 251.
    But we want to have movement type 251 posting for 2 article A, and movement type 252 posting for 1 article A.)
    Would you have any recommendation in terms of configuration?
    Thanks a lot for that.
    BR
    Dom

    Hi Rashi Gaur,
    Yes, As already explained by Vikrant, You Can create a separate task group for sales and assign that to sales item type (2001) and Create separate task group for returns and assign that to return item type (2801). This can be performed in two-step agregation process. The sales records will be in and returns will be .
    Thanks and Regards,
    Ramesh D

  • IS Retail - POS sales and return movement type issue

    Hi,
    We are facing issue whlile doing POS sales and return, when sales transaction data transfer to ECC from POS its create Idoc and material document.
    When I look the material document for sales its showing movment type 252 instead of 251, as same in return material document 251 instead of 252,
    When I look the cofiguration settings are perfect in SPRO.
    How to resolve this issue and what changes need to be done
    regards
    Satish

    Satish,
    Check following IMG settings;
    IMG - Sales and Distribution - POS interface - inbound - Aggregated Sales Control
    IMG - Sales and Distribution - POS interface - Inbound - Movement type-dependent control of sales as per receipt
    Bye - Muralidhara

  • POS sales and return movement type Issue

    Hi,
    We are facing issue whlile doing POS sales and return, when sales transaction data transfer to ECC from POS its create Idoc and material document.
    When I look the material document for sales its showing movment type 252 instead of 251, as same in return material document 251 instead of 252,
    When I look the cofiguration settings are perfect in SPRO.
    How to resolve this issue and what changes need to be done
    regards
    Satish

    Satish,
    are you sure that you applied the right logic regarding signs in the POS inbound?
    In WPUBON the Field E1WPU02-VORZMENGE must be negative so the POS inbound will consider this line item as sales and would put 251 als movement type if the sign is not minus it would put 252.
    With the WPUUMS it is the same.
    Are you using WPUBON01 or WPUUMS?
    Regards Carsten

  • Different valuation way in sales and returns of goods

    Hi all,
    we experience some problems in using, at the same time, the scenario of third-party order processing for sales to the customer and the standard flow to manage the return flow.
    As standard the goods entry (movement type 653, special stock E) of a delivery created by a sales order of type RE (return document) is valued at moving price.
    We need to valuate the movement 653 at the same value of VPRS condition in the RE order, as we have a lot of materials with a moving price that is changing in a wrong way.
    Regards,
    Antonino Musciumarra

    This is my wsdl
    <?xml version="1.0" encoding="UTF-8"?><wsdl:definitions name="testprojectMS" targetNamespace="http://abcd.org/testprojectMS" xmlns:oldtns1="http://www.xyz.net" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://abcd.org/testprojectMS" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mrm1="http://abcd.org/testprojectMS">
    <wsdl:types>
    <xsd:schema targetNamespace="http://abcd.org/testprojectMS" xmlns:mrm="http://abcd.org/testprojectMS">
    <xsd:import namespace="http://www.xyz.net" schemaLocation="testproject.xsd"/>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name="testproject_in">
    <wsdl:part element="oldtns1:testprojectIn" name="testprojectIn"/>
    </wsdl:message>
    <wsdl:message name="testproject_out">
    <wsdl:part element="oldtns1:testprojectOut" name="testprojectOut"/>
    </wsdl:message>
    <wsdl:portType name="testprojectMSPortType">
    <wsdl:operation name="testproject">
    <wsdl:input message="tns:testproject_in" name="testproject_Input"/>
    <wsdl:output message="mrm1:testproject_out" name="testproject_Output"/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="testprojectMSSOAP_HTTP_Binding" type="tns:testprojectMSPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="testproject">
    <soap:operation soapAction=""/>
    <wsdl:input name="testproject_Input">
    <soap:body parts="testprojectIn" use="literal"/>
    </wsdl:input>
    <wsdl:output name="testproject_Output">
    <soap:body parts="testprojectOut" use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="testprojectService">
    <wsdl:port binding="tns:testprojectMSSOAP_HTTP_Binding" name="testprojectPort">
    <soap:address location="http://myhost/testprojectService"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    Please let me know where it went wromg

  • Business process_CO2 cylinder sales and returns

    We have recently installed SAP Business One and as part of our operations we will be selling CO2 cylinders.  Intially the customer will buy a full CO2 cylinder. He will later return the empty CO2 cylinder (which will have a different stock item) and we will give him another full bottle but charge him for the refill.
    I would like to ask if there is a module on SAP that manages such a process or elso if someone who runs a similer process can provide me with some insight
    Thanks and kind regards,
    Paul

    Hello Paul
    You can try using Empties Management functionality,  I am not sure if SAP Business One provides for it or not.
    In your case the  empty cylinder will be a tied or untied empty and a CO2 cylinder with gas inside will be a full product.
    Untied Empties
    Untied empties are empties that are not filled or packed with material. If material is removed from reusable packaging, the reusable packaging is left as untied empties
    Tied Empties
    Tied empties are empties materials that only exist or are moved with a link to an empties-relevant material. In this context, the material flagged as tied empties assumes the packaging function.
    From pricing point of view, you always price the gas (material) but the first time you sell you add a surcharge for the cylinder. After that you just sell the gas at its own price and if you want you can maintain accounts for ownership and stocks of the empty cylinders.
    Documentation link : http://help.sap.com/erp2005_ehp_04/helpdata/EN/19/ad1d3a81a1e572e10000000a11405a/frameset.htm
    Hope this helps.

  • Query with Item info sales and purchase quantity

    Hello,
    I have an query were i want to report an total quantity of sales and purchase. But it is not working.
    SELECT T2.CardName, T0.ItemCode, T0.ItemName, T0.OnHand, T0.IsCommited AS 'Bevestigd', T0.OnOrder AS 'In Bestelling', T0.SuppCatNum AS 'Leveranciersnummer',
    SUM(T3.Quantity) 'Total Sales', SUM(T5.Quantity) 'Total Purchase'
    FROM dbo.OITM T0
    INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode
    LEFT JOIN INV1 T3 ON T3.ItemCode = T0.ItemCode
    LEFT JOIN OINV T4 ON T4.DocEntry = T3.DocEntry AND T4.CardCode = T0.CardCode
    LEFT JOIN PCH1 T5 ON T3.ItemCode = T0.ItemCode
    LEFT JOIN OPCH T6 ON T6.DocEntry = T5.DocEntry AND T6.CardCode = T0.CardCode
    WHERE T2.CardCode =[%0]
    GROUP BY T2.CardName, T0.ItemCode, T0.ItemName, T0.OnHand, T0.IsCommited, T0.OnOrder, T0.SuppCatNum
    Can somebody help me??
    Mark

    Hello Gordon,
    Changed the query like beneath.
    SELECT T2.CardName, T0.ItemCode, T0.ItemName, T0.OnHand, T0.IsCommited AS 'Bevestigd', T0.OnOrder AS 'In Bestelling', T0.SuppCatNum AS 'Leveranciersnummer', SUM(T3.Quantity) 'Total Sales', SUM(T5.Quantity) 'Total Purchase'
    FROM dbo.OITM T0
    INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode
    INNER JOIN INV1 T3 ON T3.ItemCode = T0.ItemCode
    INNER JOIN OINV T4 ON T4.DocEntry = T3.DocEntry
    INNER JOIN PCH1 T5 ON T3.ItemCode = T0.ItemCode
    INNER JOIN OPCH T6 ON T6.DocEntry = T5.DocEntry AND T6.CardCode = T0.CardCode
    WHERE T0.CardCode = '[%0]'
    GROUP BY T2.CardName, T0.ItemCode, T0.ItemName, T0.OnHand, T0.IsCommited, T0.OnOrder, T0.SuppCatNum
    Still get strange numbers in the last 2 total sales and total purchase
    kind regards
    mark

  • S_ALR_87012357 report - Advance Return for Tax on sales and purchase

    Hi Friends,
    I would like to know few things in regards the VAT report S_ALR_87012357 report - Advance Return for Tax on sales and purchase:
    (1) What information brings the S_ALR_87012357 report?
    (2) As of now this report displays tax against vendor line item and not expense line item. Is there any other report that shows all the positions lines affected to tax?
    (3) Is it possible that the tax line stays only in the expense line account and not in the vendor line account or not any intercompany line account?
    (4) Is it possible S_ALR_87012357 report shows information about the tax allocanted in expense accounts and not in vendor accounts?
    Appreciate a faster response.
    Thanks in advance.

    Please try report S_ALR_87012359. This report gives you opportunity to choose account selection.
    I am unsure how the SAP is setup in your organisation. S_ALR_87012357 should pick up expenses selection as well.
    This report entirely depends on tax code selection.

  • Grouping of Top 10 Customers by Sales and Total Sales

    Hi Guys...
    I need to design a report where I need to include both "Top 10 Customers based on Sales" and "Total Sales for remaining customers".
    Can you guys help me with a solution.
    Thanks,
    Regards,
    G

    Hi,
    You can implement this in BEx using concept of virtual characteristics and BADI which will be a little bit complex. Its better go for WAD.
    Hope it helps.
    Regards,
    Prakash

  • Total sales values by material and plant

    Hi,
    I was trying to extract the following information:
    material number, plant, total sales qty(2006), and total sales amount(2006) from sap table. So, can any one help me with the table or a report where in I can find all this information.
    Thanks
    Putta

    Hi,
    Good evening and greetings,
    You can get the info from the Table BSEG as below
    BSEG-BUKRS = Company Code and a Sales Org is attached to a Company Code
    BSEG-GJAHR = Fiscal Year
    BSEG-DMBTR = Amount in Local Currency
    BSEG-PSWBT =  GL Account Amount
    BSEG-HKONT = GL Account Number
    BSEG-MATNR = Material Code
    BSEG-WERKS = Plant
    BSEG-MENGE = Quantity
    BSEG-MEINS = Base Unit of Measure
    You have to execute the report with the following input parameters in SQVI
    Company Code
    GL Account Number = Revenue Account
    Fiscal Year
    You will get all the info from the system in the single table.
    Please reward points if found useful
    Thanking you
    With kindest regards
    Ramesh Padmanabhan

  • How to Apply YTM and MTD filter to the Query Calculating "Total Sales" Amt

    Hi,
    I got the requirement to calculate "Total Sales" amount in following format,
    1. Calculate Total Sales YTM per Country
    2. Calculate Total Sales MTD per Country
    I am done with Queries to get Country wise Total Sales amount but stuck at the point, how to apply YTM (Year to Month) and MTD (Month to Date) filter. Can anyone have idea about how to apply YTM and MTD filter to query??
    Regards,
    Priyanka

    Hi,
    I got the requirement to calculate "Total Sales" amount in following format,
    1. Calculate Total Sales YTM per Country
    2. Calculate Total Sales MTD per Country
    I am done with Queries to get Country wise Total Sales amount but stuck at the point, how to apply YTM (Year to Month) and MTD (Month to Date) filter. Can anyone have idea about how to apply YTM and MTD filter to query??
    Regards,
    Priyanka

  • Sales order and return sales order in the same field

    Hi Everybody,
        I have sales sales order and return sales order in the same field ,how can i separate these two orders in the report.
    Your suggestions are appreciated
    Warm Regards
    Shreya

    Both are sales documents and should be separated by document type....i assume that all the documents are sotrd in the same infocube and if you have tha document type characteristic you can separated them directly in a report
    Regards

  • Hello programs on sales and tax returns

    HI ,
    Can any body send sample programs of sales and tax returns of pariticular state .
    i have to use bkpf and bseg tables.
    thanks,
    aravind.

    Hi Radha
    Sales Tax is what u incur on the sales u make as in on Customers - Output Tax -
    Purchase tax is what u incur for ur vendors - Input Tax
    CIN - is specific to Country India Version
    In SAP, we first map a tax procedure to the country specifying whethere there is going to be a Jurisdiction Code or not, then we define input/output taxes in TC FTXP {in FI}; where theSD team will define a condition record mapped to an account key which they will relate to our tax code and they define condition master recd in VK11 for domestic taxes per country.
    Hope this will give u a bried idea on what u wanted to knw
    Rukshana

Maybe you are looking for