Sales history

hi
Please any one help me to sort out my problem as i am trying to write down a sql query which can give me Sales History for last three month as i can't split into three diff. month in diff. column
following way i tried to sort out but its not giving me a correct details:
select original.identity,sum(secondlastmthsale.a) Selstmthsale
-- sum(thirdlastmth.b) thridlastmthsale
from cust_invoice_pub_due original,
(select gross_amount a,IDENTITY from cust_invoice_pub_due where Invoice_date > sysdate - 60 ) secondlastmthsale
-- ,(select gross_amount b from cust_invoice_pub_due where Invoice_date < -- sysdate - 90 ) thirdlastmth
where
original.identity = secondlastmthsale.identity
--and original.identity = thirdlastmth.identity
group by original.identity,secondlastmthsale.identity
-- ,thirdlastmth.identity,original.invoice_no
order by original.identity
thanks in advance

Hi,
If original is supposed to contain only data from within the last 30 days, then the WHERE clause of the main query should contain something like:
WHERE   invoice_date <=  SYSDATE
AND     invoice_date >  (SYSDATE - 30)
[pre]
Similarly, if secondlastmthsale is supposed to contain the data that is between 30 and 60 days old, you have to specify both limits in the in-line view that defines secondlastmthsale:
[pre]
WHERE   invoice_date <= (SYSDATE - 30)
AND     invoice_date >  (SYSDATE - 60)
[pre]
You're smart to get the query with two months working before adding the third month.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • SAP Tables  for Open Customer Orders and Sales History

    Dear Experts.
    I am looking to get SAP SD related tables for the following,
    1) SAP tables for Open Customer Orders     
    From SAP, I need to get all tables that Contain all open customer orders for products.
    2) Sales History
    From SAP, I need to get all tables that contain the previous month's sales history (shipped customer orders).
    Please Help!!

    hi
    check the following link
    http://www.erpgenie.com/abap/tables_sd.htm
    hope it will help you
    regards,
    sreelatha gullapalli

  • How do I get at Variant Configured Component Sales History

    Iu2019m in the middle of an implementation right now of R/3 (LO, SD, PP, MM) and APOs Demand Planning.  In doing so we want to be able to forecast key components straight based on their history rather then maintaining probability usage factors CBF (Characteristics Based Forecasting) in R/3.  This is based on the fact that there are 1200+ components of this type across thousands of products so managing splits isnu2019t realistic as well as the flow of the demand for the component product is very lumpy and more seasonal (Very Lumpy) so forecasting it outright has increased our accuracy by almost 15% in our legacy system.  In order to get the Sales History we tried flagging the key components for u201CSales Relevancyu201D in the BOM but this had negative impacts in other areas and would like to avoid this approach if possible. 
    Is there a way to get at Sales History for key components via the VC selections on the sales order?  This would be something similar to how flagging the item for u201CSales Relevantu201D in the BOM acts to add additional linked line items to the sales order.
    Your help is greatly appreciated and points will be given.
    David

    I did that (I think I did) however the confusion is that I get only part of the menu and not the most important menu items like "file" "edit" etc. with all the drop downs. It is so freaky - my other computers have no problem like this and I and show the menu bar or not just like you described. I really doubt anyone really understands my problem with it. I took some screen shots of the good computer version and the bad one so someone can "see" exactly what I am seeing. This may be a one of a kind gremlin issue, LOL. Anyway, without those menu items, I am very limited on the usefulness of FireFox on that computer so I have to rely more on Chrome for those features and use the FireFox with Billeo and other tools that still work. Someday it may magically fix itself, LOL.
    Of the two images, one is the good computer and the other is the bad. The bad one shows the only way to see the menu items however they disappear after I am done with the custom menu and no other time can I get the items to "appear" it is like they are there but cannot get them to show when in the normal menu bar mode.

  • Standard report for sales history.

    hi,
        i need a standard report for sales history(all sales order ) for my company code. in va05 transaction it shows only for sales area. give the tcode .
    regards
    muthuraman.d

    Hi,
    There is no standard report for sales order list on the basis of company code.u have to develop it.
    OR
    Create report with SAP Qury
    OR
    u can us VA05N tcode >>> Speciefy sales organization from - to (all sales organizations from one company code).
    Kapil

  • Downloaded Property-bee plug-in, for showing sale history on Rightmove.co.uk but Property-bee only now shows Today details as history, instead of previous months info - Please help!

    I uploaded Firefox again, so I could work with Property-bee site, to show me sale history of property when in sites like Rightmove.co.uk. It worked when I first downloaded firefox and then property-bee. After switching my laptop off, then on again later that day - when i go to rightmove.co.uk, the history provided by Property-bee is no longer valid - and shows All houses as only being advertised on Today date. Please can this be sorted as soon as possible? There must be a box ticked-or not, that will allow the correct information to show?! Please advise?!
    Thanks

    It would make more sense to ask the plug-in maker, they designed it for FF they should know what is wrong. http://www.property-bee.com/forum/

  • Sales history in MC94 is not correct.

    Hi All,
    Sales history  in MC94 ZRUCORHIST for material G10963  is not correct . On week 50 corrected sales history is 126, but I donu2019t see in MB51 such quantity.
    Plese tell me how to correct this.
    Help will be appriciated.
    With Regards,
    Pritee.

    This querry is still unanswered... Please do reply.
    With Regards,
    Pritee.

  • Sales history or any other infostructure

    Hi all
    I need to create a sandbox demo for transfering sales history to APO DP. There is hardly any history available in R/3. I  believe I can not fill up the concerned info structure/key figure without sales orders.
    I am OK to use any infostructre/key figure which can be filled with some sizable dummy data for the sake of demo right now.
    1 What are my options, what info structure /key figure I should use?
    2 What transaction I should use to fill up this key figure.
    3 Can I fill up the key figure for past periods or do I  have to fill it up in future periods only ( Worst case scenario once the data is in APO I can write a macro to copy into past periods)
    4 What is the correct info structure/key figure for sales history any way?
    Thanks in advance

    I have the same problem. (Version 22.0 for Windows) History is only showing me the last 15 lines. If I click on Show All History to see even what I did a few minutes ago, I'm taken to a Library that only wants to show me All Bookmarks - but shows absolutely no bookmarks even though I have many available through normal Bookmarks drop down and toolbar.

  • Vehicle object - Sales History & Finance Information

    Hi
    Just having a look at the Vehicle object for the first time and have noticed that the Sales History and Financial Information related information sections both have a system generated number fields (Sales Number and Finance Detail #) that are read only and longer than 15 characters (due to a hyphen used) so when I attempt to create and save a record it returns an error. Can not see how to change these as they are read only and can not changed?
    Thanks
    Gail

    Gail, I would recommend contacting customer in reference to this issue.

  • Error while pulling sales history into planning area

    Hi Folks,
    We got error while pulling the sales history data into planning area from infocube.
    We uploaded CVC into MPOS.
    Please find the below error.
    ""Combinationens of infocube are not contained in BasisPlobStru""
    Message no:/SAPAPO/MSDP_REL106
    Thanks
    Sri

    Hi,
    The issue is that The Characteristic Combination is present in MPOS as well as in the list cube.While Uploading sales from the list cube result is that for some months Sales is matching exactly where as for some months data is not showing in the planning area though sales is present in list cube for the same month.I have run Consistency checks for Time series also.
    Thanks
    sri

  • Copying sales history into new info structure

    Hi Gurus,
    We are running SAP since last two years and company is running since last 30 year but we have never used SAP S&OP. Now we want to use one. So far we have created info structure with required characteristics and key figures.
    Can you please suggest me the process of copying sales history into info structure?
    I will be really grateful to you if suggest me ASAP.
    Thank in advance.
    Kind Regards
    Raja Ram

    What the heck is S&OP?
    If you're talking about [LIS|http://help.sap.com/saphelp_470/helpdata/en/c1/37544e449a11d188fe0000e8322f96/frameset.htm], then there is some standard functonality to populate the newly created info structures with the data from existing documents.
    Path in SPRO (may differ slightly, depending on the R/3 release):
         Logistics General
         Logistics Information System (LIS)
         Logistics Data Warehouse
         Data Basis
         Tools
         Setup of Statistical Data
         Application-Specific Setup of...
         Perform Setup u2013 Sales and Distribution
    But if you need to bring in sales history from a legacy system, you'll need to write an ABAP report for that.

  • How to add sales history and purchase history without affecting inventory.

    In order to help client migrating sales and purchase history into B1.
    I checked through the Business One objects reference file. I couldn't find any object that allow adding historical record into both Sales or Purchase history, via DIAPI.
    Do I have to always depend on the Sales Invoice object to add the document and let it affect the inventory level.

    No, you can't add historical data without affecting GL and Inventory.  In SAP B1 any invoice addition thru DI API will automatically behave like the regular B1 process and it will post to GL and inventory.
    I saw in the partner edge portal SAP B1 forum a post from an SAP employee that is working on developing a process where historical data will be able to be migrated without afecting inventory and GL.  But there is no ETA on when this will be available.
    Regards,
    WB

  • Cannot create AW using AWM from Schema Sales History in Oracle 10.1.0.3.0

    Hi,
    I have installed Oracle DB Enterprise Edition and Client 10.1.0.3.0 on Linux.
    I create the schema SH using the scripts sh_main.sql, csh_v3.sql, lsh_v3.sql, psh_v3.sql and olp_v3.sql from the directory $ORACLE_HOME/demo/schema/sales_history. So far, everything is ok.
    Next, I tried to create an analytic workspace from this schema using the analytic workspace manager. An error ocurred (see AAA...), because of the string "e-mail" in the dimension attribute of CUSTOMERS_DIM. Changing "e-mail" to "email" solved this problem.
    During the next try, an error occured because of the PERIOD_END_DATE attribute (see BBB...). Can somebody find a solution to this problem?
    Best regards,
    Ralph
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    Creating analytic workspace...
    Processing cube SALES_CUBE
    Processing Creating Dimension : CHANNELS_DIM
    Processing Creating Dimension : CUSTOMERS_DIM
    Error Message from Server = ___AW_REFRESH_DIMENSION
    E-MAIL is not allowed to contain non-standard form characters SH_AW.MYAW
    Problem getting Attributes for:
    SH
    CUSTOMERS_DIM
    You provided extra input starting at '$'.
    In SYS.AWXML!__XML_VAL_PREFIX PROGRAM:
    exists = exists(name)
    Problem creating dimension:
    CUSTOMERS_DIM
    You provided extra input starting at '$'.
    In SYS.AWXML!__XML_VAL_PREFIX PROGRAM:
    exists = exists(name)
    SqlException = ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "OLAPSYS.DBMS_AWM", line 975
    ORA-06512: at line 1
    Error Code = 6510
    Sql State = 65000
    BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
    Creating analytic workspace...
    Processing cube SALES_CUBE
    Processing Creating Dimension : CHANNELS_DIM
    Processing Creating Dimension : CUSTOMERS_DIM
    Processing Creating Dimension : PRODUCTS_DIM
    Processing Creating Dimension : PROMOTIONS_DIM
    Processing Creating Dimension : TIMES_DIM
    Processing Defining Load for Dimension: CHANNELS_DIM
    Processing Refreshing Dimension : CHANNELS_DIM
    Processing Defining Load for Dimension: CUSTOMERS_DIM
    Processing Refreshing Dimension : CUSTOMERS_DIM
    Processing Defining Load for Dimension: PRODUCTS_DIM
    Processing Refreshing Dimension : PRODUCTS_DIM
    Processing Defining Load for Dimension: PROMOTIONS_DIM
    Processing Refreshing Dimension : PROMOTIONS_DIM
    Processing Defining Load for Dimension: TIMES_DIM
    Processing Refreshing Dimension : TIMES_DIM
    Error Message from Server = Problem refreshing dimension:
    TIMES_DIM
    TIMES_DIM.PERIOD_END_DATE.ATTRIBUTE is not a Valid Attribute.
    (AW$XML) AW$XML
    In SYS.AWXML!__XML_HANDLE_ERROR PROGRAM:
    then signal 'AW$XML' 'AW$XML'
    SqlException = ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "OLAPSYS.DBMS_AWM", line 1012
    ORA-06512: at line 1
    Error Code = 6510
    Sql State = 65000

    Please apply the OLAP 10.1.0.3.0A or OLAP 10.1.0.3.0B patch to both the Database Server and Database Client. Do not run Oracle OLAP on the RDMBS 10.1.0.3 patch set without either one of these OLAP specific patches:
    OLAP 10.1.0.3.0A patch (PS #3769360 on MetaLink)
    OLAP 10.1.0.3.0B patch (PS #4045047 on MetaLink)
    The B patch contains all the fixes found in the A patch, plus additional fixes. Therefore, I would recommend B over A.

  • Getting 'Paint' and 'Sales History' to run at the same time

    Hi,
    Is this a matter of setting up a port for Paint and another for SH? Is there a limit to the number of OBI repositories that can be running at the same time?
    Thanks!

    Thanks.
    Can two or more repositories exist in the same rpd file? Can Paint and SH be in the same rpd file and be used by seperate groups that access completely different data sources?
    In our case, the dimensions and facts for glass used in a car are very different from the dimensions and facts for a car's transmission. There are similarities, true, but they are still very different.
    So, in one rdp file can there be seperate presentation folders for Glass, Tires, Transmissions, Seats, Axil, Engine, Steering Wheels, Head Lights, and etc...
    Each presentation folder would be used by different people. Each presentation folder would access different tables. The Glass Parts business will use the Glass presentation folder, the Axil Parts Guys will only use the Axil Presentation Folder, etc..
    As always, thanks!

  • Sales Order History

    Hi,
    I have created a report for Sales History in which i need to display all records from inquiry to payment.
    My problem is i cannot display those records which directly start from sales order not from inquiry.
    I am displaying quotation based on inquiry and sales order based on quotation.
    How to display directly sales order without quotation number??
    Can u help me with the logic??
    Thanks,
    Mrudula
    FORM DATA_RETRIEVAL.
    *&----------------------CUSTOMER NO----------------------------------------------*
    select  KUNNR
           " VBELN
           into corresponding fields of table IT_SALES from
            VBAK
           where BUKRS_VF IN S_BUKRS AND ERDAT in S_ERDAT AND KUNNR IN S_KUNNR AND VKORG IN S_VKORG.
           "AND VBTYP = 'A'.
    *&----------------------INVOICE NO----------------------------------------------*
    LOOP AT IT_SALES INTO IT_ITAB.
        SELECT VBELN
           FROM  VBAK INTO
          (IT_ITAB-VBELN)
        WHERE
          VBTYP = 'A' AND
          KUNNR = IT_ITAB-KUNNR.
          MODIFY IT_SALES INDEX sy-tabix FROM IT_ITAB
                TRANSPORTING VBELN.
          ENDSELECT.
    ENDLOOP.
    *&---------------------QUOTATION NO-----------------------------------------------*
      LOOP AT IT_SALES INTO IT_ITAB.
        SELECT VBELN
           FROM  VBAK INTO
          (IT_ITAB-VBELN1)
        WHERE
           VGBEL = IT_ITAB-VBELN and
          VBTYP = 'B' AND KUNNR = IT_ITAB-KUNNR.
          MODIFY IT_SALES INDEX sy-tabix FROM IT_ITAB
                TRANSPORTING VBELN1.
          ENDSELECT.
    ENDLOOP.
    *&----------------------SALES ORDER NO----------------------------------------------*
    LOOP AT it_SALES INTO IT_ITAB.
    SELECT VBELN
            FROM  vbaK   INTO
          (iT_ITAB-VBELN2)
        WHERE
          VKORG IN S_VKORG and KUNNR = IT_ITAB-KUNNR AND VGBEL = IT_ITAB-VBELN1  AND
          vBtyp = 'C'.
         MODIFY it_SALES INDEX sy-tabix FROM IT_ITAB
                TRANSPORTING VBELN2.
    ENDSELECT.
    ENDLOOP.

    I might consider starting with sales order documents, then retrieving any prior documents based upon the prior (originating and reference) document entries in VBAP (and NEVER by reading VBFA backward).  But I would almost never start a sales report from VBAK; that's the wrong place.  Read SAP NOTE 185530 on how to do efficient SD reporting.

  • History sales

    good morrning Expert,
    I have a problem about the sales history, I want to know the customer who had taken the goods I sell
    but I want to reduce the goods had returned customers how to make these queries to be combined into one
    SELECT  T0.[U_NewDesc] as 'Description',T1.[CardName], T0.[PriceBefDi],T0.[unitMsr], T0.[Quantity],
    case when GETDATE() - T0.DocDate <= 21 THEN T0.DocDate ELSE NULL END [Active],
    case when GETDATE() - T0.DocDate > 21 THEN T0.DocDate ELSE NULL END [NOT Active],
    T1.[Comments] AS'REMARK'
    FROM INV1 T0 INNER JOIN OINV T1 ON T0.DocEntry = T1.DocEntry
    WHERE
    Month(T0.DocDate) >= Month(GetDate()) -3 AND Year(T0.DocDate) = Year(GetDate()) and
    T1.[CardName] =[%0] and T0.[DocDate] >=[%1] and T0.[DocDate]<=[%2]
    ORDER BY T1.[DocDate]  Asc
    Thx

    Good Morrning Expert,
    Hai Gordon, Thank you have answered my question.
    I have tried your query and does not work
    SELECT T0.U_NewDesc as 'Description',T1.CardName, T0.PriceBefDi,T0.unitMsr, T0.Quantity,
    case when GETDATE() - T0.DocDate <= 21 THEN T0.DocDate ELSE NULL END 'Active',
    case when GETDATE() - T0.DocDate > 21 THEN T0.DocDate ELSE NULL END 'NOT Active',
    T1.Comments AS 'REMARK'
    FROM INV1 T0 INNER JOIN OINV T1 ON T0.DocEntry = T1.DocEntry
    WHERE Month(T0.DocDate) >= Month(GetDate()) -3 AND Year(T0.DocDate) = Year(GetDate()) and
    T0.[DocDate] >= '20091130' and
    T1.CardName =[%0] and T0.DocDate Between [%1] and [%2]
    UNION ALL
    SELECT T0.U_NewDesc as 'Description',T1.CardName, -T0.PriceBefDi,T0.unitMsr, -T0.Quantity,
    case when GETDATE() - T0.DocDate <= 21 THEN T0.DocDate ELSE NULL END 'Active',
    case when GETDATE() - T0.DocDate > 21 THEN T0.DocDate ELSE NULL END 'NOT Active',
    T1.Comments AS 'REMARK'
    FROM RIN1 T0 INNER JOIN ORIN T1 ON T0.DocEntry = T1.DocEntry
    WHERE Month(T0.DocDate) >= Month(GetDate()) -3 AND Year(T0.DocDate) = Year(GetDate()) and
    T1.CardName =[%0] and T0.DocDate Between [%1] and [%2]
    ORDER BY T1.DocDate
    have error:
    1). [Microsoft] [SQL Native Client] [SQL Server] ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or except operator. 2). [Microsoft] [SQL Native Client] [SQL Server] Statement 'User-Defined Values' (CSHS) (s) could no
    Thanks
    Rachelhel

Maybe you are looking for

  • How do I create a ringtone in iTunes 10.2.2?

    I have found an article that shows how to create a ringtone in iTunes 9.2 and it does not seem to apply to iTunes 10.2.2 Can I safely download 9.2, create a ringtone in the iTunes Store and not affect my current application? Thanks for the help, eAL

  • Export mixdown of several stereo tracks as one mono track

    How can I select a few stereo tracks in STP and export them as a single mono track? either back to FCP or as a standalone file? Thanks! Processor  2 x 2.8 GHz Quad-Core Intel Xeon Memory  32 GB 800 MHz DDR2 FB-DIMM Graphics  NVIDIA GeForce 8800 GT 51

  • Error in Java Console Window

    Hi All When i run form using webutil in forms10g(9.0.4),java console window shows:::::: I signed jacob.jar,webutil.jar successfully I changed formsweb.cfg Oracle JInitiator: Version 1.3.1.17 Using JRE version 1.3.1.17-internal Java HotSpot(TM) Client

  • Third Party iMovie 11 trailer themes?

    Are there third party themes that can be downloaded and added into iMovie 11? I tried Googling for "iMovie 11 themes", but all that comes up are reviews of the built-in ones.

  • ReferenceUSA

    Has anybody managed to access ReferenceUSA using Safari and starting from their county library's web site? Entering your library card number on the library site is supposed to redirect you with authorization to access ReferenceUSA databases. It is su