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

Similar Messages

  • Reg purchase order history & Sales order history

    Hi ALL,
    In purchase order history we can see the document flow from purchase order to Invoice receipt.If i raised debit memo against purchase order this request also u can see in purtchase order history.But if u make payment to vendor against this it is not showing in purchase order history.What tratment i have to give to see.
    For each debit memo initially  request will be raised by purchase department, against debit memo request  Accounts department will make payment.so i want to see the payment in purchasde order history.
    Kindly advise me how to view the above thing.
    THX
    YSR

    Hi,
    You can try these FM to update info record.
    ME_DB_UPDATE_INFORECORDS
    ME_UPDATE_INFORECORD
    ME_UPDATE_INFORECORD_COND
    ME_UPDATE_INFORECORD_PD
    Are you sure to update info record from changing PO net price?
    Regards,
    Ferry Lianto

  • Demantra - history period to be considered for forecast ???

    In the current system I have 5 years of history sales data - but for my forecast I need to consider data only for the last 3 years.
    Are "history length" and "start date" are the only parameters which decide the history length or is there any other parameter also considered in deciding the length of history to be considered for forecast generation.
    Appreciate your response.
    thx and rgds,
    Pankaj

    Hi,
    Check whether the following parameters fulfill your requirement.
    StartAverage
    AverageHorizon
    PromotionStartDate
    last_date
    Tks
    M J

  • SOP to DM to MRP

    Hello Gurus ,
    Please can anyone of help me in understand the technical details i need to adopt to get the below process implemented. Tips and tricks would be really helpful.
    1. We dont have any SAP BW and so how can i get the Sales Forecast based on the Previous Sales History(Sales Document with the Billing Documents ). Do we need to write a report or any report is available in standard SAP R/3 ..Any inputs on this would be really helpful.
    2.  Once we get the Sales Forecast how can i transfer this data to the Demand Management through MC74 automatically . Because it shows only one material for that particular plant. How can i feed the total data of the sales forecast on a weekly basis to the MC74 transaction automatically?
    Looking forward for the reply.
    Thanks
    Balaji

    Hi Balaji,
    So things are like this:
    Without BW and APO, your demand planning tool remains erp-SOP.
    In SOP you can use either standard SOP, where you can forecast based on consumption (from stock movements, not sales documents), or create your own planning environment using SOP-Flexible Planning functionality. There you can bring actual historical data from SD documents, and subsequently use that for forecasting.
    Then, both forecasting and transfer to DM can be done EN MASS, using the mass processing functions (transactions MC8*).
    Regards,
    Mario

  • Functionality of Plng Books

    hi 2all sap experts
    iwant to know what the functionality of plng books and the cubes and also other issue is how we have to explain in interview about our business process with these two issues:
    eg : we have sales cube and we load data in plng books,pls anybody helpme and expln how to give presentation.
    suppose we have these plang books
    1)Monthly plng book and monthly data view
    2) WeeklyBook and Weekly data view
    3) Sales Planning Book
    4) Marketing Plng Book
    from where we get the data to these.
    what the functionality of these cubes:
    Sales order Infocube, Sales order delivery cube, Billing Document Infocube and Planning area backup infocube .
    please kindly answer for my issue and aslo let me the interview process.
    Thanking u in advance
    ronald
    Edited by: ronald wens on May 13, 2008 10:23 AM
    Edited by: ronald wens on May 13, 2008 10:23 AM

    HI Ronald,
    Main objective of   DP is generating accurate forecast using several planning activities.
    Forecasts are always done based on historical data...
    Infocube, what you mentioned is used to store historical data.
    we maintain different cubes to store diff data like history(sales orders), taking the backup for some Keyfigure values..etc.
    PLanning books , in simple terms refer to the roles in an organization and Dataviews refer to Tasks.
    A role can have different tasks..like this a planning book can have more than one data view.
    eg: planning book for sales manager.
    Sales manager is a role here..
    he can have multiple tasks like, forecasting sales in weeks and months..
    So, here sales in weeks is one dataview and sales in months is another dataview..
    likewise he can have some more dataviews for promotions, dollarization..etc
    Pls go thru this link for further understanding on planning areas, transfer of data from cubes to planning areas and the planning functions in DP..

  • DP BOM Explosion

    Hi,
    Here is the business scenario in short . We have sales orders for A ( eg. Car ) and also we have sales orders for B ( eg . Tires of Car) .
    We are just using APO-DP . We want to explode (using DP BOM)  the sales orders of Car (A) to get the sales of tires . Once explosion is complete add it with sales of tires . Once we have total sales history of tires (B), forecast at tire level .
    We have DP PPMs in place in APO and we have created " BOM Relevant POS " . Also have 9ABOMI,9ABOMIO, 9APPMNAME information in CVCs .
    We have created 3 keys figures one for Historical sales (To look at Cars and Tires ), one for Indpendent Demand 401 (for cars) and one for Dependent Demand 501 (for tires) .
    Here is the problem . we don't want to DP BOM forecasting . DP BOM forecasting is working fine . It is forecasting the car information in Independent Demand Key figure and also exploding the Dependent Demand of Tires in Dependent Demand Key figure .
    What we want to do is just DP BOM explosion . It should take the history of tires from History Sales keyfigure and explode it . We should be able to see the history of Tires after exploding , when we select the tires in selection criteria in the same History sales key figure .
    As of now we cannot see the explosion of sales history from Cars to Tires in the planning book .
    Any help on how to just explode DP BOM for the sales history will be truely appreciated .

    Hi,
    When you say DP PPM I assume you talking of 2 split windows in the data view (if this is not the design then ignore this reply)
    The lower one for header (BOM) and the upper one for the the Key figures that you would like to release to SNP/PPDS (dependent demand or independent demand or sum total or some macro). Doesnt this meet the purpose
    Regards,
    Loknath

  • CRM 2007 Call Centre Fact Sheet Modification

    Hi Gurus
    The CRM 2007 CIC Fact Sheet is preconfigired with 6 views:
    Installed Base
    Service Ticket History
    Sales Order History
    Generic History View
    Service Order History
    Complaint History
    Is it possible to configure different componient views to be visible as like the BP Account Fact Sheet.
    I have reviewed: Maintain Fact Sheet function and it doesn't appear to do what I  need.
    Many Thanks in  advance
    Panduranga

    Hi Panduranga
    Do you want to add other order types to BP Account Fact Sheet?
    or Do you want other Component views to look like BP Account Fact Sheet?
    regards
    Rupesh

  • Time based KPI Calculation

    Hi All,
    I need to define a report where I need to calculate Supply - Demand for the complete horizon.
    Following is the example: -
    Week #                                     1               2               3                4             5                 6             7
    Sales Orders                                                            100                           150                             120
    Supply                                    500                                                                                400
    Projected Supply                     500             500        400               400        250                650          130
    How to calculate the value of ''Projected Supply'?
    Projected Supply = Projected Supply from Previous Week + Supply From Current Week - Sales Orders from Current Week
    Appreciate help on how to calculate this time dependent KPI.
    Regards,

    Hi Rajesh,
    I am working on SNC Customer collaboration scenario similar to your scenario.
    I am facing a small problem. The history sales data is imported and stored in VMIW1 time series data area. But while releasing the forecast to short term forecast screen though the forecast is dis-aggregated to daily form but the sales history is not visible here. I assume this is a standard SNC function to display the weekly sales history from sales forecast planing area to short term forecast screen, but unfortunately it's not showing. So I think I am missing something.
    Can you tell me whether I need to define another planning area for short term forecast again or is there any other standard configurations needed for it.
    Thanks & Regards
    Praty

  • Time series objects and order objects on what condtion we need to use

    Dear Experts ,
    I have question regarding Time series objects and order objects
    from my understanding
    TIme series objects the data is stored in time buckets without
    reference to orders.
    Order objects the data is stored as orders. Key figure data is
    then saved as orders if semantic 000 is entered in the detail view of the key
    figures in the planning area.
    my question is when to use the option 1 and when should not use
    same for option 2
    Many thanks
    Regards
    Raj

    Hi,
    This depends on the requirement you have also the application you are using.Like DP key figures are generally time series since in DP you do not need order numbers for example for history sales the requirement is the quantity period wise but not the order numbers.
    Again in SNP the distribution and planned quantities are required order wisecoz you need the order numbers you execute the same in ECC system or for Pegging purposes.
    Now the safety stock requirement can not be at order series since this is with relevent to some periods.
    So overall i can say this depends on the requirement of the kay figure.
    Hope this can help.
    regards,
    kaushik

  • Report for Sales Order Change History   CDPOS and CDHDR

    How to take a report of the data for the Sales Order Change history for a particular period of time. It is required to take a report of all the Sales Orders for which the basic price has been changed. Please let me know the procedure. I could not get the data from the table CDPOS and CDHDR
    Helpful answer would be rewarded.
    Regards
    Praveen

    Dear Praveen Kumar
    Have you tried with VBAP where sale order details at item level would be stored.
    Moreover, to my knowledge, there won't be any changes as for as pricing is concerned at sale order level but there is at billing level.  Normally, any price increase / decrease would reflect in billing.  So why dont you to table join through SQVI VBAP (for sale order details) and VBRP (for billing details) so that you can compare the selling price in sale order with billing. 
    Thanks
    G. Lakshmipathi

  • Help me on sales order history,

    hi all,
    i need to develop a report on sales order history,
    please help me, what are the related tables to get sales order history

    the SAPGUII cannot help you on this.
    you should refer to the ERP-SD forum at SAP ERP Sales and Distribution (SAP SD)

  • Sale order Billing invoice history.

    Hi,
    I am an ABAPer. I have to create a report that displays the invoice billing history of a sales order for a particular period of time.
    My final table should contain the following fields.
    Invoice Date
    Document Type
    Currency
    Invoice Amount (in DC)
    Invoice Amount (in LC)
    Invoice Amount (in USD)
    Invoice Period
    Post.Date
    Doc.Date
    SOW No
    SOW Description
    PO No
    Account Manager
    Project Manger
    Project Code
    WBS Element
    City
    Business Area
    G/L Account
    Special G/L ind.
    Spl. GL Text
    I need to the know the tables i need to fetch these information.
    Please help!

    Did you already find tables VBAP/VBAK, VBFA, VBRP/VBRK, BSEG/BKPF during your search or anlyzing FM SD_DOCUMENT_FLOW_GET ?
    Nevertheless I suggest you read first note 185530 - Performance: Customer developments in SD, then post where you get a problem.
    Regards,
    Raymond

  • 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.

  • 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

Maybe you are looking for

  • OPEN LDAP service error

    We rebooted our dev server and are getting the below error when we are trying to bring up the OpenLDAP services. Shared services is also not coming up. Can someone please help The Hyperion Foundation OpenLDAP service terminated with service-specific

  • StageVideo on android shows a black frame on the start and end of video playback

    When my screen starts up it goes completely black for a moment and the interface becomes unreponsive for about a second when my stagevideo player class is added to the stage. My videos are encoded using Adobe Media Encoder with the 480p android setti

  • 127.0.1.1 nested exception

    Hi, I was trying to contact many servers. The lookup was successful, but the procedure call caused the error: java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is: *     java.net.ConnectException: Connexion refusée* w

  • IPod to iTunes copy with Artwork

    I've been reading other discussions on how to copy a music library from an iPod to iTunes. Can anybody recommend a program to use to this that will also copy the artwork as well? Thanks.

  • How to turn on transparent background as default

    I keep getting a white background for all new images, when what I need is that they be transparent. I don't see this as a preference anywhere. Am I just missing it? This is CS5.