Total sales to date per item

Hello folks i need some help with SQL code i think. I need to get a report showing our best selling items, but the sales analysis is only showing recent stock (even if i specify 01.01.07 - 02.06.08).
in theory this is a simple report. i just need ItemCode, ItemName and Total Sales.
What is the table that contains total sales?

Thanks Petr I have used the slightly amended code below:
select coalesce((select sum(quantity) from inv1 where itemcode = oitm.itemcode
group by itemcode), 0)
+
coalesce((select sum(quantity) from ige1 where itemcode = oitm.itemcode
group by itemcode),0), itemcode, itemname
from oitm
but when i export this to excel the first column (quantity) becomes invisible. How do we make it appear, for example, as 'Total Sold TD'?
thanks

Similar Messages

  • How to get the max total sale by date on every store

    I am trying to write a query in Oracle which will return both the store_id and the maximum total sale by date

    Hi,
    Whenever you have a question, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002
    Hjava wrote:
    I am trying to write a query in Oracle which will return both the store_id and the maximum total sale by date
    Do you mean you want to see the store_id that had the maximum total sale?
    In general, this can be done with a Top-N Query, using an analytic function such as RANK.  For an example, see http://forums.oracle.com/forums/thread.jspa?messageID=3739610
    If you only want the date, the maximum total from that date, and 1 column from the same row with the maximum (e.g. store_id), then you might be able to use the aggregate LAST function instead.
    What results do you want in case of a tie?  (That is, if 2 or mote store_ids have the same total sale on a given date, and no other store_id has a higher total.)

  • Sales Analysis query per item group summarized per BP Group

    Dear experts,
    My client is requiring me to create a query that when i select a certain item group it returns a sum/total of sold items in that group per BP group
    format:
    parameter: Item Group A
    BP Group A    1,000
    BP Group B    2,000
    BP Group C   1,000
    I have managed to get total sales per BP Group but i cant seem to figure how to break it down per Item Group
    here is my query:
    SELECT T2.[GroupCode], SUM(ISNULL(T0.Debit,0) - ISNULL(T0.Credit,0)) as "Amount(LC)" FROM JDT1 T0  INNER JOIN OJDT T1 ON T0.TransId = T1.TransId and T0.TransType IN (13,14)
    INNER JOIN OCRD T2 ON T2.CardCode = T0.ShortName
    WHERE T1.[RefDate]  BETWEEN [%0] and [%1]
    GROUP BY T2.[GroupCode]
    how can I link Item Groups to JDT1?

    Hi Carlo
    Try This
    SELECT t5.ItmsGrpNam AS ItemGroup,
       t7.GroupName AS BPGroup,
       SUM(ISNULL(T0.Debit,0) - ISNULL(T0.Credit,0)) AS "Amount(LC)"
    FROM JDT1 T0
    INNER  JOIN OINV T1 ON T0.transid = T1.transid
    LEFT OUTER JOIN INV1 T3 ON T1.docentry = T3.docentry
    LEFT OUTER JOIN oitm T4 ON t4.itemcode = T3.itemcode
    LEFT OUTER JOIN oitb T5 ON T4.ItmsGrpCod = T5.ItmsGrpCod
    INNER  JOIN ocrd T6 ON T0.ShortName = T6.CardCode
    INNER JOIN OCRG T7 ON t7.GroupCode=t6.GroupCode
    WHERE T1.DocDate BETWEEN [%0] AND [%1]
    GROUP BY t5.ItmsGrpNam,
       t7.GroupName
    Rgds

  • Partial delivery per item in sales order and ATP - schedule lines

    Hi,
    I've problem regarding ATP- schedule lines and partial delivery flag.
    In sales order there is flag Partial delivery per item B / 1 . That means create only one delivery even with quant 0. That comes from customer master or customer info-record and it is OK.
    Please look at next example.
    Customer requires:
    10 PCS of materail A on date X. Only 5 PCS are available on date X.
    10 PCS of material B on date X 0 PCS are available on date X, 10 PCS are available on date Y.
    So if we create outbound delivery on date X it will contain only 5 PCS of material  A. No successive deliveries will be created for material A because of the flag B/1. That item is closed.
    Problem is with material B.
    The sales order will be open because of material B and on date Y we can easily create another delivery with 10 PCS of mat B.
    That is wrong. Agreement with customer is only one delivery for ALL items in sales order. If we create delivery on date X it should contain only materials which are available on date X and sales order should close.
    Do you know how to fix this problem?

    Hi,
    I've think you didn't understand my requirement. I allways get schedule lines but they are confirmed on different dates.
    Example in same sales order we have:
    Schedule line for item A:
    DATE X confirmed quantity 10
    Schedule line for an item B.
    DATE X confirmed quanitity 0 (zeroe)
    DATE Y confirmed quantity 10.
    I would like to create outbond delivery on date X with:
    item A quantity 10
    item B quantity 0.
    And if that hapens than B/0 rule will work or reference customzing that you suggested before. So order will be closed because all items are processed or referenced once.
    Do you know how to do that?
    Regards

  • Storing and calculating sales per item

    The case: We have a item, on that item we have a fee. If the item has sold more than 1000 copies, the fee will drop. Therefor i need to have a place that calculates/stores total sales per item. This can then be used to set the fee when i run my stored procedure
    for sales etc. 
    Database explained shortly: 
    The sales database looks like this: 
    ItemID, SalesDate, Quantity, Name.
    Example: 
    1399, 2014-01-01, 2, Fompa.
    1081, 2014-01-01, 13, Asddd. 
    1399, 2014-01-03, 1, Fompa. 
    Etc. 
    The item database looks like this: 
    ItemID, Name, Author, etc
    Now my boss asked me if i maybe should add total sales to the item database, but how is that possible? 
    I have also tried to gather all items and show the total sales, but something goes wrong, the itemID are not grouping together..
    here is the query: select ItemID, QUANTITY from BOOK_SALES group by ItemID, QUANTITY order by MAX(quantity) DESC
    If i get this query right, is it possible to store the query within a database table? 

    Hey, thanks for a fast answer. 
    I modified your query a little, 
    select
    itemid, sum(quantity) from book_sales group by
    itemid order by MAX(quantity) DESC
    but still, all of the itemIDs are not being grouped together. 
    Results show something like this: 
    1399, 981
    1081, 344
    1399, 199
    etc..

  • Is there a list of open items at key date per customer?

    Hello,
    In FBL5N you can get a list of open items for a customer at some specific date.
    I'm looking for a summarized list that would give me a list of sums  of open items for some customer per day, so I would see for example for one month what was the sum of open items for this customer on each day.
    Is there already some similar report in SAP?
    Thanks and best regards,
    David

    Hi,
    I still don't think we understand each other.
    If I run FBL5N I have option to select:
    - Items that are or were open at the key date are displayed on one date
    - All items posted on the posting date specified fromde date1 to date2.
    - Items that were cleared at the clearing date specified
    I would like a list of all items from option 1 (Items that are or were open at the key date are displayed on one date) so items that are or were STILL open and not yet cleared on one date, but not just for one date but for more days.
    If I use your suggestion I get what items opened or cleared on one day not how many items were still open on particular day.
    So a list of how many opened items were there at the day, and notjust items that were opened on that day but also all previous items that were not yet cleared at that day.

  • BAPI or FM for geting  all sales master data, header data , item data etc

    Hi experts,
          In my requirement  i need a BAPI  (or) Function module for getting all "Sales information" data means header data , item
    data, scheduled data  etc    .
    Thank you,
    Dinesh Reddy.

    Hi,
    check BAPI_SALESORDER_GETLIST
    I hope it helps you....
    Regards,
    NaPPy

  • BTE 1650 LINE ITEM DISPLAY: Add to data per line - possible solution

    Hello,
    I would like to populate field payment order (Pymt.order) in custom transaction FBL5N
    I have read that it should be doable using BTE 1650 LINE ITEM DISPLAY: Add to data per line but I am not sure if 1650 is correct one and if its proper solution for this purpose.
    Could you please advice?
    Thank you in advance!
    Michal

    i have the same problem , i used BTE and the fields appear but without data . which table or code i will use to in FM to display data in transaction.
    thanks all for help

  • Need total consumption quantity year to date for item in inventory

    Hi All,
    I have a requirement as below.
    I need to find the total consumption quantity for a item year to date in inventory i.e i need to find out total issued quantity from year to date for a item.
    so i need following details.
    Consumption 1st year
    Consumption 2nd year
    Consumption 3rd year
    we are following fiscal year JAN-DEC.
    I am looking for a query to find out the above details, please help me out
    Thanks

    Hi Prashant,
    I will try this out. If I remember correctly this did not work especially since we are using the same base condition across the board. I may have to try copying this standard condition and re-assigning it accordingly.
    Thanks for the suggestion
    Anirudh

  • Sales per item report

    hello experts
    i have made the following query but i dont want to display double and triple times values per itemcode
    i actually want to display the sum the quantity and the sum of the linetotal per item
    SELECT
    --T0.CardName
    -- T0.ShipToCode
    -- T0.DocDate
    T1.ItemCode
    , T1.Dscription
    , sum(T1.Quantity)
    , T1.LineTotal AS 'u0391u03BEu03AFu03B1 u03C0u03CEu03BBu03B7u03C3u03B7u03C2'
    --, T2.CardCode
    FROM OINV T0 
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OSLP T3 ON T0.SLPCODE=T3.SLPCODE
    WHERE
    --(T0.CardName >= [%0] or [%0] = ' ')
    --and (T0.CardName<= [%1] or [%1] = ' ')
    --and (T0.ShipToCode >= [%2] or [%2] = ' ')
    --and (T0.ShipToCode <= [%3] or [%3] = ' ')
    (T2.CardCode = '80503')
    --and (T2.CardCode = [%4] or [%4] = ' ')
    AND (T0.DOCDATE BETWEEN '2011-10-01' AND '2011-10-25')
    --AND (T0.DOCDATE BETWEEN '[%5]' AND '[%6]')
    --and (T0.CANCELED= 'N')
    --and ((T3.SLPNAME BETWEEN '[%7]'AND '[%8]') OR ('[%7]'=' ' AND  '[%8]'=' '))
    group by T0.CardName,  T0.DocDate, T1.ItemCode, T1.Dscription, T1.Quantity, T1.LineTotal, T2.CardCode
    order by T1.ItemCode
    60344     test item1      1.000000     0.880000
    60360     test item2      1.000000     1.500000
    60360     test item2      1.000000     1.500000
    60360     test item2             2.000000     3.010000
    60361     test item3             2.000000     3.010000
    do you have any idea?
    thanks in advance for your time!

    HI
    try this:
    SELECT
    --T0.CardName
    -- T0.ShipToCode
    -- T0.DocDate
    T1.ItemCode
    , T1.Dscription
    , sum(T1.Quantity)
    , T1.LineTotal AS 'u0391u03BEu03AFu03B1 u03C0u03CEu03BBu03B7u03C3u03B7u03C2'
    --, T2.CardCode
    FROM OINV T0 
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
    INNER JOIN OSLP T3 ON T0.SLPCODE=T3.SLPCODE
    WHERE
    --(T0.CardName >= [%0] or [%0] = ' ')
    --and (T0.CardName<= [%1] or [%1] = ' ')
    --and (T0.ShipToCode >= [%2] or [%2] = ' ')
    --and (T0.ShipToCode <= [%3] or [%3] = ' ')
    (T2.CardCode = '80503')
    --and (T2.CardCode = [%4] or [%4] = ' ')
    AND (T0.DOCDATE BETWEEN '2011-10-01' AND '2011-10-25')
    --AND (T0.DOCDATE BETWEEN '[%5]' AND '[%6]')
    --and (T0.CANCELED= 'N')
    --and ((T3.SLPNAME BETWEEN '[%7]'AND '[%8]') OR ('[%7]'=' ' AND  '[%8]'=' '))
    group by T0.CardName,  T0.DocDate, T1.ItemCode, T1.Dscription, T1.LineTotal, T2.CardCode
    order by T1.ItemCode

  • Report on open sales order ,total sales

    Hello Gurus
    I am developing a report line item wise of sales order in which i need to get
    Suppose a sales order is created on 01.12.2009 for 1000 quantity
    billed quantity in december 600
    billed quantity in january     200
    1) total sales done against this SO line item wise.
    2) sales in this month againt this SO
    3)open order qty as 01.01.2010
    4)last day sales i.e from 01.01.2010 to 20.01.2010 the date of last sales against this SO
    so my output should be
    total sales = 800
    sales in this month =200
    open order qty as on 01.01.2010= 400
    please tell me the logic
    regards
    sphoorthi
    Moderator message - Please do not post your requirements and ask the forum to do your work for you - post locked
    Edited by: Rob Burbank on Jan 20, 2010 10:47 AM

    Hi,
    I gather from your thread that the question is not to build a report on a MP yes/no but more on which MP.
    Depending on the reporting needs and on how well you are able to combine the 2 cubes in the new MP I would say go for the latter option so you have more control on this one MP (for example if you need to add something that is already available in cubes).
    However, when (future!) reporting needs could mean that characteristics need to be added to the report(s) and filtered on that are not in both cubes you will have major problems getting the data properly from new MP and you would be better off using the individuals MP's and combine the data in a workbook or in a web template giving more flexibility.
    So you need to really analyze the requirements and decide on the way forward. Keep in mind possible future requirements because for now it could seem these few fields could be enough but new requirements could directly give a problem.
    Hope this helps
    C.

  • Calculation of sales tax for free item

    Dear SAP B1 Experts
    I have query regarding sales tax calculation for free item .
    For EG.  I have two item for sales (A = 1000,  B = 100)   Sales tax is VAT4%
    But when i am doing sales, i am selling B for free of cost with A for Rs 1000/- 
    here my tax calculation is (1000 *4%)  = 1040/-
    but as per the govt sales tax rule, we are liable to pay the tax for free item as well
    So I this case, In SAP B1 how we will calculate the tax 4% for free item  .
    Please help me.
    Thanks

    i have checked, its working okay, but
    in Invoice print out unit price and line total is showing for free item.  How i make the unite price 0 .
    Tax only calculation is based on the Line total and the line total is based on the unit price.
    in that case when i give the invoice to the customer.
    It should show like this
    Item A       100   * 10         1000
      "    B           0   * 1              00
                                             1000
    4% tax                               44
    Doc Total             =           1044
    thanks
    Regards

  • I recently (Jan 2012) acquired a MacBook Pro (MBP) running 10.7.4 and an AirPort Express.  I also have an old PPC G4 tower (Digital Audio model) running 10.4.11.  The OS software on both machines is totally up to date.  AirPort Utility on the G4 is 5.4.2

    I recently (Jan 2012) acquired a MacBook Pro (MBP) running 10.7.4 and an AirPort Express.  I also have an old PPC G4 tower (Digital Audio model) running 10.4.11.  The OS software on both machines is totally up to date.  AirPort Utility on the G4 is 5.4.2 and on 6.0 on the MBP.  I bought a used AirPort card for the G4, I believe it is 802.11b compatible, and the wireless data rate is specified at 11 Mbps.  Being a newbie to wireless, it took me many days to get these two machines to link up.  This network is not connected to the internet, and there no other networks in the vicinity.
    My last problem to solve is the very slow file transfer speeds between the two machines. The transfer time seems to vary depending on which machine I use to initiate the transfer, and which direction the transfer is going.  For example: If I initiate the transfer from the G4 and send a 5.4MB file to the MBP it takes 1:32 (min:sec), while the same file going from the MBP to the G4 takes 27 seconds.  On the other hand if the transfer is initiated on the MBP, going from the MBP to the G4 takes 2:56, while going from the G4 to the MBP takes 1:59.  I realize that these times are not actual wireless transfer times but includes the entire transfer process.
    Both machines and the AirPort Express are within a 4-foot radius.  Both machines are set to radio channel 2.  The AirPort Express is set for 802.11n(802.11b/g compatible) with WPA/WPA2 Personal wireless security.
    Any help would be appreciated.
    CEU2

    BDAqua,
    Thanks for the response.
    Apple has used the term "Digital Audio" to identify this machine.  System Profiler has the following information:
    Machine Name:          Power Mac G4
      Machine Model:          PowerMac3,5
      CPU Type:          PowerPC G4  (2.1)
      Number Of CPUs:          1
      CPU Speed:          800 MHz
      L2 Cache (per CPU):          256 KB
      Memory:          768 MB
      Bus Speed:          133 MHz
      Boot ROM Version:          4.3.3f2
      Serial Number:          XBxxxxxMK9
      Sales Order Number:
    Yes, I could connect them by ethernet if all I wanted to do was transfer files, but I would like to network them so I could use wireless internet.  The machines are not always so close together, I did that to simplify the testing.  With the very slow transfer speeds I am reluctant to move ahead with the internet step. 
    <Edited By Host>

  • Total amount of all the items of invoice at document level to present ....

    We have two cubes one is sales document count cube (header data) and other one is sales transation cube (item level data) . Invoice net val is there in sales document count cube and profit center, principal and item category is ther in sales transation cube.
    our requirement is ,total amount of all the items of invoice at document level to present along with principal, profit center & item category.
    This has to be done in the document count cube and not the transaction cube.
    note: multi provider is not solution. There any solution at query level?

    hi
    If your using 2 ODS one for header and one for Item to 2 Cubes.....
    Then just create a update rule between Item data ODS to Document CUbe mapping the new keyfigure ( Net value of total of all items in sales order )
    If not tel me how the cubes and ODS are fed the data
    Assign points if useful
    Regards
    N Ganesh

  • Free form partner function field in Sales document header and item..

    Hello Experts,
    Is there anyway we can use the partner functions functionality in Sales document header and item level, so that we can enter a free form number in the Partner field? I mean is it possible to be able to enter a free form number WITHOUT getting validated against corresponding master data like Customer or Vendor master, Contact person, Personnel or User master records?

    Hi,
    It is not possible.
    Because partner function will be determined in the sales document header and item as per the configuration you have done in the partner determination.
    It is not possible to enter a number wihich is not created and assigned.
    Regards,
    Mullairaja

Maybe you are looking for

  • I dont have TV SHOWS on my itunes store tool bar - any help ?

    I dont have TV SHOWS on my itunes store tool bar - any help ?

  • How to set up and use to Java fax machine

    How to setup and use the fax utilies on the c410a allin one smakphoto printer.

  • Webutil_file package

    Hello, I'm facing problems with the webutil_file package The copy_file function works ok. The rename_file and delete_file do not work. They return false. Any suggestions? Regards Erik

  • JDBC connections using resource file

    I have heard that a resource file can be used to assign an URL and DB2 driver to establish a connection. What is a resource file and how can this be done? We have several URL and DB2 drivers to assign depending on what server we are processing on. th

  • MOV to MPG or export to MPG

    I have saved my audio and video to a MOV file as well as have the original files in FCP. I want to either convert the MOV to an MPG or export the project files from FCP an MPG. In either case, I want both the audio and video in the one MPG file. I ha