Daily sales report with last  selling price

Dear All,
how to query daily sales record with last selling price as  following:
cust. code ,  item  , unit price, last selling price to this cust. within 3 month ,  highest  selling price of  this item with 3months
I'm new to both  SAP and SQL, Please help! Many Thanks!!
Wing

Hi,
   Try this........
SELECT P.CardCode,P.CardName,P.ItemCode,
[1] as [Jan],
[2] as [Feb],
[3] as [Mar],
  [4] as [Apr],
[5] as [May],
[6] as [Jun],
[7] as [Jul],
[8] as [Aug],
[9] as [Sep],
[10] as [Oct],
[11] as [Nov],
[12] as [Dec]
FROM (SELECT (T0.CardCode),T0.CardName,t1.ItemCode,T1.price,MONTH(T1.Docdate)as month
FROM dbo.OINV  T0
inner join INV1 T1 ON T0.DocEntry=T1.DocEntry
inner join OITM t2 on T1.ItemCode=t2.ItemCode 
WHERE T1.DocDate>='[%0]' and T1.DocDate<='[%1]' and T1.ITEMCODE='[%2]'
and T0.CardCode='[%3]'
) S
  PIVOT  (max(price) FOR [month] IN
([4],[5],[6],[7],[8],[9],[10],[11],[12],[1],[2],[3])) P
ORDER BY P.[CardCode]
Check this link for SQL tutorials.........
http://beginner-sql-tutorial.com/sql-subquery.htm
http://w3schools.com/sql/default.asp

Similar Messages

  • Daily Sales reports - $0 price items

    In the daily sales reports, I'm getting some rows showing $0 customer price and royalty price. These are for paid, not free apps. It shows a product type identifier of 7 (instead of the usual 1).
    What does this mean ?
    Anyone else getting these ?

    Never mind.
    I just realized that these are the no-charge update numbers.

  • Queries Report For Last Purchased Price

    Dear All,
    Can someone helps me to get queries report for last purchased price vs new purchase price that recently being enter on purchased order.
    Trigger by purchased order document posting and we can choose % variance
    Report by order :
    No. Document PO ; Vendor code ; Vendor Name ; Doc Posting Date ; Item code ; Item Name : New Purchased price ; Last Purchased Price; Variance; Buyer Name
    i will used it on alert management.. each time there % variance automaticaly sending an email with those report.
    Thanks

    So.. is it the right query if i join it?:
    SELECT T0.DocEntry, T1.CardCode, T1.CardName, T1.DocDate, T0.ItemCode, T0.Dscription, T0.PriceBefDi, T2.LastPurPrc, (T0.PriceBefDi - T2.LastPurPrc) AS Variance, ((T0.PriceBefDi - T2.LastPurPrc)/T0.PriceBefDi) AS 'Variance%', T3.SlpName FROM POR1 T0 INNER JOIN OPOR T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode
    select * from opor where month(docdate) = MONTH(GETDATE()) and Year(docdate) = YEAR(GETDATE())
    But i still find document with last month posting include on the report adn the report became different too

  • Std profit center report to campare daily sales report from BW

    Hi
    daily sales report (filtred throgh BW using Profit cneters and account groups) need to compare
    with sap  R/3 DATA . kindly update me where i will extract it ( like any s_alr_87..... reports in profit center ?)
    let me clarify my query:
    daily sales report is getting on the basis of profit centers through BW (revenue element and profit center wise)
    where could we compare it with R/3
    thanks in advance
    Edited by: barnabasjh on Jul 1, 2010 7:23 PM

    You can use following:
    1. KE5Z (profit center actual line item report)
    2. S_ALR_87009712 (profit center actual/plan report)
    3. KE5Y (profit center plan line item report)
    Thanks.
    Rahul

  • Daily Production Report with Variance or receipt of Production

    Hi All..
    my one of the clients want the Daily Production Report with Variance or receipt of Product?
    Please let me know what does it mean and how can I fetch this report
    Thanks
    Rahul

    Hi Rahul,
    Try This
    Daily Receipt From Production report
    SELECT T1.[BaseRef] as 'Production Order No', T0.[DocNum] as 'Receipt No', T0.[DocDate] as 'Receipt Date', T0.[CardCode] as'Customer/Vendore Code', T0.[CardName], T2.[ItemCode], T2.[ItemName], T1.[Quantity] as 'Receipt Qty', T1.[OpenQty] as 'Open Qty against Pro Order' FROM OIGN T0  INNER JOIN IGN1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode WHERE T0.[DocDate] >=[%0] and  T0.[DocDate] <=[%1] and
    T1.[BaseRef] IS NOT NULL
    Summary Report For Production Order
    SELECT T0.[DocNum] as 'Production Order No', T0.[PostDate], T0.[DueDate], T0.[RlsDate], T0.[CloseDate], T2.[ItemCode], T2.[ItemName], T3.[CardCode], T3.[CardName], T0.[PlannedQty], T0.[CmpltQty], T0.[RjctQty] , (T0.[PlannedQty]-T0.[CmpltQty]-T0.[RjctQty] ) as 'Open Qty' FROM OWOR T0  INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry LEFT OUTER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode LEFT OUTER JOIN OCRD T3 ON T0.CardCode = T3.CardCode WHERE T0.[PostDate] >=[%0] and  T0.[PostDate] <=[%1]
    Thanks,
    Srujal Patel

  • Please help to get onhand stock report with last purchase and billed date warehouse and item wise

    please help to get onhand stock report with last purchase and billed date warehouse and item wise

    Hi Rajeesh Ambadi...
    Try This
    SELECT distinct T0.ITEMCODE , t1.ItemName, T0.ONHAND as 'Total Qty',  
      T1.LASTPURDAT ,t1.LastPurPrc
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD left join ibt1 t3 on t3.itemcode = t0.itemcode and t3.whscode = t0.whscode
    WHERE
    T0.ONHAND>0
    AND T0.WhsCode ='[%0]'
    Hope Helpful
    Regards
    Kennedy

  • Please any one provide crystal report for  Location wise sales report with GP

    Please any one provide crystal report for  Location wise sales report with GP.Please its urgent

    A report writer tool like Crystal reports is not available due to the cost involved in its licenses.Do you think that Oracle Reports is free then? It's $$$$.
    You can download and test it for free, but if you want to use it in production you have to buy a license.

  • ORBO - Daily sales report includes Order Init Transaction?

    Hi All,
    Can you please any one guide me in ORBO application,the daily sales report includes the Order init transaction details?
    Appreciate your help.
    Hari.

    Oracle Retail application doesn't consider Sale of Item which has not been moved out from the store and in other words all the orders , layaway ,special orders Initiated considers will not be accounted as sale amount despite of retailer has received amount in advance( Item inventory get reserved for those transaction ) .Transaction amount of those transaction will be added in sale of the particular day when those transaction will get completed i.e. Item inventory ( SOH) get down .
    I hope i have answered your question. Please let me know if further information required
    Thanks
    Himanshu Lohani
    [email protected]

  • Create a listing of reports with last run date and # of times run

    Hi All,
    I want to create a listing of reports with last run date and number of times report is run in the past 18 months.
    If anybody can please help me with the query for the same.
    Regards,
    Sk
    Edited by: user10989244 on Aug 18, 2009 7:12 AM

    Hi Sk
    Assuming you have the collection of statistics enabled, which it is out of the box, you can get the information you need from the EUL5_QPP_STATS table. This script will help:
    SELECT
    QPP.QS_DOC_OWNER WORKBOOK_OWNER,
    QPP.QS_DOC_NAME WORKBOOK_NAME,
    QPP.QS_DOC_DETAILS WORKSHEET_NAME,
    QPP.QS_CREATED_BY RUN_BY,
    TRUNC(MAX(QPP.QS_CREATED_DATE)) LAST_USED_DATE,
    COUNT(QPP.QS_ID) TIMES_USED
    FROM
    EUL5_QPP_STATS QPP
    WHERE
    QPP.QS_CREATED_DATE >= ADD_MONTHS(SYSDATE, -18)
    GROUP BY
    QPP.QS_DOC_OWNER,
    QPP.QS_DOC_NAME,
    QPP.QS_CREATED_BY,
    QPP.QS_DOC_DETAILS
    ORDER BY 1,2,3;
    Best wishes
    Michael

  • Sales Reports with Partial Shipments

    Hello,
    I need to write a sales report for open orders. If the order has been partially shipped, I just need to pull what remains to be shipped and display this total.
    If the order has not been partially shipped, I need to pull the doc total.
    How do I specify if an order has been partially shipped or not? Is there any way to say, "If a line in RDR1 has been shipped or partially shipped, sum the totals of OpenCreQty * Price, else pull DocTotal"?
    I need to display the report in 1 line per sales order.
    Thanks in advance,
    Chris

    Hi Christine, 
    Without knowing the exact fields you are using you should be doing something like: 
    If {TABLE.OpenCreQty} NOT EQUAL {TABLE.Quantity} Then
         0
    Else {TABLE.Quantity};
    NOTE: WHERE IT SAYS NOT EQUAL TO should be LESS THAN and GREATER THAN symbols. They don't show up in here.
    So the If is checking what was shipped with the order's quantity.  If they are not equal then show 0 otherwise show the order's quantity. 
    Now you can do a summary and sum this formula and you should get the proper numbers. 
    Good luck,
    Brian

  • Report with difference of prices from Inventory Valuation

    Hello!
    I need report with result from Inventory Valuation: Difference of prices= New price - Current Cost. Report can show last 7 documents and i should choose item code.
    Can u help me?
    Greetings from Poland

    Hi,
    Please check This
    Select A.DocNum,A.DocDate,B.ItemCode,B.Dscription,
    B.Price as NewPrice,B.RActPrice as CurrentCost,B.Price-isnull(B.RActPrice,'0') as Difference
    From OMRV A INNER JOIN MRV1 B ON A.DocEntry=B.DocEntry
    Where  (B.ItemCode='[%3]' or '[%3]'='') Having (B.Price-isnull(B.RActPrice,'0'))='0'
    Thanks,
    Nithi

  • Sales Report with Sales Group Field

    Hi Experts,
    Do you know some reports that will display also the sales group value?
    Thanks a lot!

    Hi
    You can create a Z report with the  logic of Fetching VBELN form Table VBKD with customer account assignment group KDGRP.
    Your selection query "Select VBELN from VBKD where KDGRP = '02' ".
    try and revert.

  • Costing of product with last purchase price

    Hi
    how would be possible to get the Costing through CO with the last purchase price of the Product .
    suppose one product is having nos of SFG & RM.
    Rgds
    Pankaj Agarwal

    hi
    Is it that the the system has to pick up the last purchase price cost for standard costing run or while executing the production order, if it is while production order  update material price as planned price in material master using Z program and use planned price as strategy for valuation variant in actual costing variant.  But this is little bit cumbersome every time you have to run the z program for every purchase order for that raw material and if the prices are highly volatile  input price variance will be very high
    krishna

  • Daily sales report

    Dear All ,
    From the Month Start date to till date item wise customer wise sales qty required ?
    Pl guide with the reports & option need to enter ?

    Hi,
    You can get all the standard SAP report in SAP1 t-code. For yuour requirement you can use MC(A.
    Thanks,
    Raja

  • Sales Report with Crystal Report

    Dear experts,
    I have a client who wants a report which shows the following on sales analysis:
    Sale Employee Name, Customer Group Name, cardcode, cardname , ItemsGroup Name,
    itemcode, itemname, weight, quantity, Row Total Value.
    Thank you.

    Hi Tendayi
    Not sure what the question is. Do you need help with the query, with writing the Crystal Report? What are the selection criteria, date, customer, etc.?
    Here is a query to help you with the structure:
    SELECT T2.SlpName, T4.GroupName, T0.CardCode, T0.CardName, T6.ItmsGrpNam,
    T1.ItemCode, T1.Dscription, T5.SWeight1, T1.Quantity, T1.LineTotal
    FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OSLP T2 ON T1.SlpCode = T2.SlpCode
    INNER JOIN OCRD T3 ON T3.CardCode = T0.CardCode
    INNER JOIN OCRG T4 ON T4.GroupCode = T3.GroupCode
    INNER JOIN OITM T5 ON T1.Itemcode = T5.ItemCode
    INNER JOIN OITB T6 ON T5.ItmsGrpCod = T6.ItmsGrpCod
    WHERE T0.DocDate >= '[%0]' AND T0.DocDate <= '[%1]'
    UNION ALL
    SELECT T2.SlpName, T4.GroupName, T0.CardCode, T0.CardName, T6.ItmsGrpNam,
    T1.ItemCode, T1.Dscription, T5.SWeight1, T1.Quantity, T1.LineTotal
    FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OSLP T2 ON T1.SlpCode = T2.SlpCode
    INNER JOIN OCRD T3 ON T3.CardCode = T0.CardCode
    INNER JOIN OCRG T4 ON T4.GroupCode = T3.GroupCode
    INNER JOIN OITM T5 ON T1.Itemcode = T5.ItemCode
    INNER JOIN OITB T6 ON T5.ItmsGrpCod = T6.ItmsGrpCod
    WHERE T0.DocDate >= '[%0]' AND T0.DocDate <= '[%1]'
    ORDER BY T0.DocNum, T1.LineNum
    You can run this direct in SAP query wizard to see if it is what you need before you write the Crystal Report.
    Kind regards
    Peter Juby

Maybe you are looking for

  • Wich fan reference for a Lenovo 3000 N200 ?

    (excuse me for bad english, I'm not english speaking people) Hi, I have a Laptop Lenovo 3000 N200 0769-A44 (S/N xxxxxxx 07/11). I have an important noise from the CPU fan. I want change the CPU fan but I don't find the good reference. In the system p

  • Seek help on If - then - else structure.

    I am not good at PL/SQL and need some advice on this stored procudure. This SP is usded to refresh materialized views. In the first block, check how many mvs in the user_mviews table and select it into v_2. IF v_2 = 25, go to 2nd block to run package

  • TS1398 iPad 2 not sending email

    I have tried everything, reboots, reinstall email account, it seams / feels like a corrupt & stuck email. All email account setting are correct and confirmed, but it still says "sender address was rejected by the server". Is it possible to be a send

  • Importing Avid Project into Premiere Pro CC 2014?

    Hi all, I'm a director editing a feature film with an editor. My editor is editing via Avid Media Composer version 7.  I also have Avid 8 on my computer.  Long story short, I'm not avid proficient and would love to import sequences, bins of synced fo

  • Low output when using Akai MPK49 controller

    I'm completely new to Logic so I appreciate your taking the time to read this. When ever I add a software instrument track and use my Akai MPK49 controller to control the instrument, the meters show that I have plenty of signal coming in, but the out