Item History Query

Hello,
Would appreciate if anyone could help me along with a query to get total Item History numbers Invoiced by past months. Something like:
Item,Month1,Month2,Month3,Month4,Total
ABC,100,200,100,200,600
Thank you in advance....
Ben

Ben,
You may remove the where clause if you running this query for whole set of items.
You may want to add the year in the where clause for each and every month to avoid getting sum total from mutiple years as shown in the last SELECT statement for TOTAL
<b>SELECT T0.ITEMCODE,
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 1 AND ITEMCODE = T0.ITEMCODE) AS 'JAN',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 2 AND ITEMCODE = T0.ITEMCODE) AS 'FEB',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 3 AND ITEMCODE = T0.ITEMCODE) AS 'MAR',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 4 AND ITEMCODE = T0.ITEMCODE) AS 'APR',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 5 AND ITEMCODE = T0.ITEMCODE) AS 'MAY',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 6 AND ITEMCODE = T0.ITEMCODE) AS 'JUN',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 7 AND ITEMCODE = T0.ITEMCODE) AS 'JUL',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 8 AND ITEMCODE = T0.ITEMCODE) AS 'AUG',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 9 AND ITEMCODE = T0.ITEMCODE) AS 'SEP',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 10 AND ITEMCODE = T0.ITEMCODE) AS 'OCT',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 11 AND ITEMCODE = T0.ITEMCODE) AS 'NOV',
(SELECT SUM(QUANTITY) FROM INV1 WHERE MONTH(DOCDATE) = 12 AND ITEMCODE = T0.ITEMCODE) AS 'DEC',
(SELECT SUM(QUANTITY) FROM INV1 WHERE <u><b>YEAR(DOCDATE) = YEAR(GETDATE()) </u></b>AND ITEMCODE = T0.ITEMCODE) AS 'TOTAL'
FROM INV1 T0
<i>WHERE T0.ITEMCODE = 'xyz'</i>
GROUP BY T0.ITEMCODE</b>
Best Wishes
Suda

Similar Messages

  • Service line item History for Contracts with item cat - D and Acc Assg P

    Hello Gurus,
    We have a situation where we create contract with item category D (Service) and account assignment category P (Projects). And for the line items of the PO we have difference services (without a service master) and each service line item has the price and quantity and other required fields. Now it is required to change the price or the quantity or both for this service line time and again (business requirement).
    The task is to to track the price changes and the quantity changes that have happened to the serive line item from the original and we require the report to diplay the original price and the present price on the service line.
    The question is: Is there a standard report in SAP to handle this? Or which are the tables where a service line items history is stored so that it can lead to a development.
    Regards - SS

    Hi Pankaj,
    We are using a Percentage based case (Prorata case)
    For Eg : For Eg for 65% (65KAI )material Price 1000 Rs
    If the Purity percentage varies payment will be done as per the same. For eg : for 70% (70KAI ) Price 1200 Rs. (approx)
    In this case unit of measurement is KAI (kilo active ingredient) .
    Actually we are dealing with dealer price where duties are entered Inclusive of the total price and entered at the time of making GR. and the payment is made as per the same;
    we have one po for 5000 MT. where we received material at first time Qty being 1993 MT.The duties manuallyentered are as follows :BED :24,167.00
    AED : 7,076.00
    ECS : 483.00
    SECES : 242.00
    These duties are flowing correctly in MIRO
    and the MIRO has been Posted and payment is also made.
    But while the balance quantity 2982 kg we received next time and those duties are as flowing as follws:
    BED : 36160
    AED : 10587
    ECS : 723
    SECS : 362
    But here at the MIRO the following duties are flowing instead of above
    BED : 36,526.08
    AED : 10,694.18
    ECS : 730.32
    SECS : 365.66
    What might be the error at this stage.
    waiting for solution at the earliest .
    Regards,
    Girish.C.M.
    09377077122

  • Error when Displaying Item History CCM 2.0

    When I upload an updated Supplier Catalogue where I changed the Delivery Time and then I look the item History in the Master Catalogue I cannot see the Delivery Time old value but when I look in the Procurement Catalog it is displayed.
    Does anybody knows what can I do to show the Old Value in the Master Catalogue?
    THANKS IN ADVANCED!
    Message was edited by: Patricia Mussons

    Thanks once again Chris,
    We though that the changes were always displayed
    in the History option, idependently you publish the catalogue or not.
    We though that we had a problem because we could see the Old Value in the Procurement Catalgue (the one that we published) but not in the Master Catalogue (we don't published it).
    But now it's clear that we don't have a problem, as the Old Value is just displayed when the Catalogue is published.
    THANKS!!!!

  • Md63- How to clear the Item history

    Hi Folks,
    In MD63 I have got the item history which dates back to 10 years and user wants to get rid off this long history.
    Could any body susggest how to clear this history.
    Thanks,
    Sunil

    Use MD76 tcode to delete the history. enter the key date and plant material or just key date and plant and req type etc.

  • Urgent what is the programs to delete work item history and work item

    hi gurus this is very urgent ,
    what is the programs to delete work item history and work item ?

    Hi Deppak.
    There is a program ,to delete an workitem and history
    RSWWHIDE---Program to delete the history.
    RSWWWIDE--- Program to delete an workitem.

  • Customer receivable History  Query

    Dear Expert,
    if any body have customer receivable history query please help me.
    Regards
    Bharat.

    Dear Bharat.
    Please check following query may its help you.
    SELECT T0.DocNum, T0.DocDate, T0.DocDueDate, T0.CardCode,T0.DocTotal,T0.PaidToDate As ReceiptsAmount, T0.CardName, T1.DocNum As ReceiptsEntryNo, T1.DocDate, T1.DocDueDate, T1.CashSum, T1.CheckSum,T1.TrsfrSum,DATEDIFF(Day, T0.DocDueDate, T1.DocDueDate)As OverdueDays
    FROM OINV T0 LEFT OUTER JOIN ORCT T1
    ON T0.ReceiptNum = T1.DocEntry
    WHERE T0.DocDate >=[%0] AND  T0.DocDate <=[%1] AND (T0.CardName ='[%2]' or '[%2]'=' ')
    REGARDS
    MANGESH PAGDHARE.

  • LOV regions - possible to use several items as query-able criteria

    Hi,
    I have a question about LOV regions –
    Is it possible to have several items that are query-able criteria and result for a LOV region?
    Addition to the LOV–input-item itself, I’d like to have another item that will be used as one of the criteria’s to the LOV-query.
    I’ve defined the “Criteria Item” value for an additional item, which his “LOV Region Item” is query-able, but the value doesn’t appear in the search field,
    When entering the LOV-region.
    Do I have to add the additional criteria to the LOV by initializing the VO?
    Thanks in advance,
    Rona

    Seems lot of confusion with LOV. Well first thing to do is to go through the LOV section of Dev guide for more understanding.
    As for your questions, yes, you can have multiple items that are query-able criteria and result. You can use another item as the criteria to lov query, but it has to be a form element.
    If your criteria is set properly, you don't need to initialize VO manually.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Open Items List Query.

    Hi all,
    Could you please advise if itu2019s possible to run a query in SAP based on the Open Items List in the reporting area that can detail the following;
    Both AR Invoices and Credit Notes and show additional fields, taken from the AR invoice u2013 Account Manager, Item Group and Project Code?
    The  Project Code and Item Group can be taken from the Item Line however the Account Manager field is located below the item line area on the contents tab.
    Would someone have a query which might enable us to do this or at least give us a directing to go in ?
    Thank you,
    MB

    Hi Matthew,
    You can try this one.
    It will check if the document is open on document level. The query is written so that it will give a result for every line in the document so you might have a problem if there are many line per document. For the account manager I used Sales person, I am not sure if that is what you mean.
    select
    'AR Invoice'+' '+(convert(varchar (10), t0.docnum)) as 'Document',
    (select t7.slpname from oslp t7 where t7.slpcode = t0.slpcode) as 'Account Manager',
    (select itmsgrpnam from oitm t5 inner join oitb t6 on t5.itmsgrpcod = t6.itmsgrpcod
    where t5.itemcode = t1.itemcode) as 'Item Group',
    t1.project
    from
    oinv t0 inner join inv1 t1 on t0.docentry = t1.docentry
    where t0.docstatus = 'o'
    union
    select
    'AR Credit'+' '+(convert(varchar (10), t0.docnum)) as 'Document',
    (select t7.slpname from oslp t7 where t7.slpcode = t0.slpcode) as 'Account Manager',
    (select itmsgrpnam from oitm t5 inner join oitb t6 on t5.itmsgrpcod = t6.itmsgrpcod
    where t5.itemcode = t1.itemcode) as 'Item Group',
    t1.project
    from
    orin t0 inner join rin1 t1 on t0.docentry = t1.docentry
    where t0.docstatus = 'o'
    Let us know if it works out.
    Jesper

  • Unable to find Searchable Item in Query Criteria Map

    Hi ,
    Am try to personalize Advacned Search Region to Include new search Criteria in R12 iSupplier Portal->Home->Orders Tab->Advanced search.
    Am trying to create new search field in the Add another row field through personalization.
    I have created new row criteria,when am trying to create Query Criteria Map,Am unable to list the Searchable Item as it is Drop down list.
    This causing unable to query the records based on the newly created row criteria item.
    Please advise.
    Thansk<Sarath.

    Hi Jobnish,
    There is no code in this requirement.
    There is no error...Issue is unable to query data based on newly create criteria row in Advanced search.
    I can give you navigation:
    iSupplier Portal->Home->Orders Tab->Press advanced search Region
    Click on the Personalize Page(I hope you know how to enable the personalize link using profile option).
    In SupplierRN ->Advanced Search Criteria and creating custom item Criteria Row..
    We need to map this field in Advanced Query Mapping.
    However the issue is the Am unbale find the Searchable item (which is created in Criteria Row) in the drop downlist.
    I can provide screen-shot if you need.
    Thanks,Sarath.

  • Purchase Oder open item list query

    Hi experts,
    i will like to have a query for open item list for  purchase order which will show the following;
         1. the details of any particular order from a Vendor in terms of:
         a.     How much of it has been delivered
         b.     How much of it is left.
    Of any order at any particular time?
    Urgent Reply will be appreciated.
    Regards
    Justice

    hi
    try this query and update the status
    SELECT T0.[DocNum] as "PO No", T0.[NumAtCard] as "PO Ref", T0.[DocTotal] as "PO Value", T1.[ItemCode] as "Item Code", T1.[Dscription] as "Items", T1.[OpenCreQty] as "Still to be delivered" FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
    Thanks&Regards
    Andakondaramudu

  • Open item in query

    I have a request for a query that displays open customer documents :
    Selection customer number and date range 01.01.2008 to 31.12.2008
    and return in columns : sum of open items amounts on 01.01.2008, sum of open items amoutns on 02.01.2009.... sum of open items amounts on 31.12.2008....
    For a given date D this is simple : documents where postingDate <= D < clearingDate.
    But how to do it for the full range ??
    Please help !

    Hi
    Please try below query
    select
    distinct c.segment1
    from
    po_lines_all a,
    po_line_locations_all b,
    mtl_system_items_b c
    where
    a.po_line_id= b.po_line_id
    and a.item_id=c.inventory_item_id
    and b.closed_code='OPEN'
    and a.item_id in ( select 
    item_id
    from
    po_lines_all d,
    po_line_locations_all e,
    mtl_system_items_b f
    where
    d.po_line_id= e.po_line_id
    and d.item_id=f.inventory_item_id
    and e.closed_code in ('CLOSED','FINALLY CLOSED','CLOSED FOR INVOICE','CLOSED FOR RECEIVING'));

  • Return Delivery on PO Item History Screen

    Hello,
    please, does anyone know where the value of a "Return Delivery" comes from?
    I can find Confirmations values, Invoices, even if I need to bring from ECC (erp).
    But for "Return Delivery", I have searched in all the FM's and tables that I know, but these lines don't appear at all.
    SRM FM's: BBP_PD_PO_GETDETAIL, BBP_PD_CONF_GETDETAIL, BBP_PD_CONF_GETLIST, BBP_PD_GETHISTORY, BBP_PROCDOC_GETLIST_FOR_PO, BBP_PROCDOC_GETLIST, BBP_PD_PO_GETHISTORY.
    SRM Tables: BBP_PDIGP, BBP_PDBEI, BBP_PDHGP, BBP_PDVIEW_BIH, CRMD_ORDERADM_H, CRMD_ORDERADM_I.
    ECC FM's: BBP_PO_GETDETAIL
    Nothing!!
    Please, does anyone know how I can retrieve these records/values in my program??
    --> On the application (srm portal), the "Return Delivery" lines appear in the TAB "Follow-on documents" of the Purchase Order Item on the "Process Purchase Orders" screen.
    Thank you!

    Hi,
    You will get the PO History details in the FM:BBP_PD_PO_GETHISTORY in the structure E_PO_HISTORY. The return delivery is displayed as sub-type RT.
    You need to pass the PO Header GUID to this FM.
    Let me know how it goes.
    Cheers
    Akash

  • Finding duplicate items in item master query

    Hi..
    I need to find the all duplicate items with same foreign name in Item master data ....Query is needed .
    Regards,
    K.Ramasamy

    Hi Ramasamy.
    Try:
    select ItemCode, ItemName, FrgnName
    from OITM
    where FrgnName in (SELECT FrgnName FROM OITM
    group by FrgnName
    Having Count(FrgnName)>1)
    Thanks,
    Gordon

  • Doubt in PO header & item history

    Hi All,
    I have a doubt .My client has come up with requirement in PO. The header & the item level history in the PO should get updated at the time of PO creation itself with all the relevant fields getting updated. Is there any possibility to control this (technically atleast).?
    Plz let me know this as it is a crucial requirement.
    Reg
    sapmm

    hi,
    Even your question is still not clear...but pls check with the CDPOS, CDHDR and also with the table EKBE....
    I hope it will solve your problem...
    Regards
    Priyanka.P

  • Reg: PO item History

    Hi,
    Could you tell me in which table Purchase Order Line items change history will be available..
    Regards
    Reddy

    Hi Chandu,
    You can get the PO changed line item text using CDHDR and CDPOS tables.
    Use Object Class: CDHDR-OBJECTCLAS = 'EINKBELEG'
        Object Id:    CDHDR-OBJECTID ' 'Your PO number'.
        And get the value of change no with the help of the above data. CDHDR-CHANGENR will provide you the change no for this PO.
    You can find the changed line item text value from table CDPOS from the values found in above table CDHDR
    Use Object Class, Object Id, Change No found above and apart from that use the field FNAME (in CDPOS) as TXZ01, and CHNGIND as 'U'. It will provide you the changed text as well as the old text..

Maybe you are looking for

  • Calling stored procedure From Oracle BAM 11g Reports ???

    Is it possible to pass user prompt value from oracle bam11g report  to the stored procedure  as parameter and get data from database and display report on that?  Reagrds, Ravi yadav

  • OS X (10.4.11) Update

    I updated to OS X (10.4.11) and now trouble and heartache abounds. Safari is misbehaving. It will often go into the whirling beach ball mode mid-task, and I have to force quit. Force quitting will close the Safari window, but the toolbar stays. I can

  • Netctl profile works flawlessly unless called by netctl-auto

    I have four wireless profiles in /etc/netctl and all of them work just fine when used manually, i.e. netctl enable <profile> or netctl start <profile>, but when I set up netctl-auto one of them keeps failing. The three others are identical except for

  • Where are java classes stored?

    Does anyone where the java classes are physically stored? Is there any mechanism for getting them out? null

  • CS4: Can't scroll to the right past 3900 in IDE

    I've imported a large bitmap into my movie. It's over 5000 pixels wide.  I need to place some shapes over it, but Flash refuses to scroll to the right past 3900 pixels.  Is there anything I can do? I've tried positioning the bitmap at x=-2000, but I