SQL report to show new customers orders

Hi - We recently launched a new website and online marketing campaign. I want to report on how much revenue is being generated by NEW customers and on what item groups. I have this so far:
SELECT T0.[DocNum], T0.[DocDate], T0.[DocTotal], T1.[CardName], T2.[Dscription], T1.[CreateDate], T3.[ItmsGrpCod], T4.[ItmsGrpNam]
FROM ORDR T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN RDR1 T2 ON T0.DocEntry = T2.DocEntry
INNER JOIN OITM T3 ON T2.ItemCode = T3.ItemCode INNER JOIN OITB T4 ON T3.ItmsGrpCod = T4.ItmsGrpCod
WHERE T1.[CardType] = 'C' AND  T1.[CreateDate] BETWEEN [%0] AND [%1]
FOR BROWSE
Can anyone offer any improvement?
Thanks

Hi,
Try this below query , you have to consider the Linetotal insist of Document total and i have included the GrossProfit field also
Query for Document wise
SELECT T0.[DocNum], T0.[DocDate],T1.[CardName], T2.[Dscription], T1.[CreateDate], T3.[ItmsGrpCod], T4.[ItmsGrpNam],
t2.GrssProfit,t2.LineTotal
FROM ORDR T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN RDR1 T2 ON T0.DocEntry = T2.DocEntry
INNER JOIN OITM T3 ON T2.ItemCode = T3.ItemCode INNER JOIN OITB T4 ON T3.ItmsGrpCod = T4.ItmsGrpCod
Query for Item group wise
SELECT   T0.[DocDate],T1.[CardName] , T1.[CreateDate], T3.[ItmsGrpCod], T4.[ItmsGrpNam],
sum(Isnull(t2.GrssProfit,0)) [Gross Profit], sum(t2.LineTotal) [Basic Amt]
FROM ORDR T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode INNER JOIN RDR1 T2 ON T0.DocEntry = T2.DocEntry
INNER JOIN OITM T3 ON T2.ItemCode = T3.ItemCode INNER JOIN OITB T4 ON T3.ItmsGrpCod = T4.ItmsGrpCod
group by
T0.[DocDate],T1.[CardName] , T1.[CreateDate], T3.[ItmsGrpCod], T4.[ItmsGrpNam]

Similar Messages

  • A report which shows the purchase order MM and the linked vendor invoice

    Hi All,
    I wonder if ther's a SAP standard report which shows the purchase order MM and the linked vendor invoice (the FI document)  with the Net due date.
    Could anyone help me?
    Thanks
    G.Rossi

    Hi,
    ME80FN with PO History View
    ME2N with Scope of List "ALLES"

  • Reporting(Netsales for new customers)

    Hi All,
    In a report i have to display the Net sales for the new customers based on the fiscal year(rows). The new customers is defined as the customers who joined in the previous fiscal year.
    Now in the result if we see the Fiscal year 2008 in the rows then in the colums for the net sales for new customer i have to display the net sales of the customers in 2008-1 i.e 2007.
    FY -
    NetSls NewCust
    2008       ---            1438.80 (this is actually net sales of the
                                                   customers in 2007)

    Have Fiscal year period in rows and KF to columns.
    Then restrict the KF with Fiscal year period and restrict the fiscal year period with the selection variable. Here right click on the variable in the variable screen and set the offset.
    Say, if the offset is -12, and the selection is 2008 it will display 2007 in the columns and also KF data for 2007.
    Hope this helps.
    Regards
    Kumar

  • Report to show all purchase orders for which invoice tolerence is greater than 3%?

    Hi Experts,
    Recently our company cofigured 3% tolerence limit for invoice.Now, I have got a requirement to create a report to show all the PO's for which the
    invoice tolerence limt is eq 3 %.Kindly anyone advise ,is there any table that stores the inovoice tolerence limit based on PO? How to achieve this requirement.
    Thanks in advance
    Thanks & Regards,
    Anusha.B

    Hi,
    I was wondering don't you have in your company MM consultant who suppose to give you the required tables name .
    Regards.

  • SQL Report not showing data - available in SQL Workshop and SQL Developer

    I am having an issue with developing a SQL Report in APEX 3.2.1. I run the code in both SQL developer and SQL Workshop and I get data pulled back (both against my development environment). When I run the same code in a SQL Report region, it returns no data available. Does anyone have any idea what would be causing this? Other regions on the page accessing different tables in the same schema return data without issue. Any help would be appreciated.
    Thanks
    Freddie

    Could you explain the last comment a bit more. Here is a bit more info just in case I touch on the info with it. The db schema is BPAMGR, the Workspace is BPAMGR. We use the same schema for all of our reporting. All of our tables are in the same schema. We don't use any tables outside of this schema. Our APEX workspace has been associated to only this schema. The tables are able to be queried by SQL Workshop in the same APEX instance that the report application is under.
    Freddie

  • How do I modify a report to show new fields in a stored procedure?

    The server uses Crystal Reports Embedded Server 2008 SP3 (running on Windows Server 2008 R2 / IIS 7.5), and I am using Crystal Reports Developer 2008 SP3 on my PC.
    Hello,
    I am a MSSQL database administrator with little experience with Crystal Reports.  At my job, we have a need to add a couple of fields to a report.  The report comes with an enterprise procurement web-based application and displays the details of a given purchase order.  They want me to add the supplieru2019s address below the supplieru2019s name on the report.  I was hoping there might be a fairly straight-forward, not overly complicated answer to my question.
    The report works with a stored procedure (OrderForm1) which creates a temp table called #ReportParameters.  It then executes another stored procedure (GetReportParameters), in which it uses 'sp_xml_preparedocument' and eventually 'sp_xml_removedocument'.  It then executes a stored procedure called  (OrderForm1Main) which contains the select statement that brings in the bulk of the fields and joining the pertinent tables.  I made a backup copy of OrderForm1Main and modified the original, to include the supplier address fields.
    Don't know if I'm on the right track, but hereu2019s what I tried so far:
    When I open the OrderForm1.rpt in Crystal Designer, I have found that I can go to Database > Set Datasource Location, create a connection (OLE DB (ADO)) to the database, highlight the name of the stored procedure under u2018Current Data Sourceu2019, then find the same stored procedure in the database in the section u2018Replace withu2019:
    http://i.imgur.com/KXBuf.png
    When I clicked the u2018Updateu2019 button, a u2018Enter Valuesu2019 for parameters window pops up:
    http://i.imgur.com/5uQ9V.png
    Iu2019m confused as to what to do at this part.  Whether I click u2018OKu2019 or u2018Cancelu2019, it then adds my database connection with stored procedure to the list in the u2018Current Data Sourceu2019 section:
    http://i.imgur.com/aD4KH.png
    After completing this data source change, in the Field Explorer under Database Fields > OrderForm1, it then includes the new fields I added to the stored procedure.  However, when dragging the new supplier address fields to the report layout, saving the report in this state, and trying to run it in the web application, the report window displays the message u2018Missing parameter valuesu2019 instead of the report:
    http://i.imgur.com/gz8S3.png
    In Field Explorer > Database Fields > Parameters, Iu2019m seeing a list of parameters that arenu2019t the exact ones in the stored procedure, which leads me to believe, they are somehow defined in the report itself.  Also, under u2018Parameter Fieldsu2019 in the Fields Explorer there is the @fParameters listing with a question mark icon, that appeared since the data source change:
    http://i.imgur.com/llkrk.png
    There does not seem to be an equivalent set of parameters in the database, as there were defined in the report.  I imagine that the actual parameter values come from the data held in the currently displayed purchase order (from which you can push a button 'Print PO' that will display the report in question).  I have read that when you change a data source in Crystal, you have to complete the task of resetting, or adding back in the parameters.  That would be easy if they were in the database somewhere.  Whenever I attempt to look at the properties of the u2018ReportInformationu2019 in u2018Set Datasource Locationu2019, or simply try Database > 'Verify Database' to refresh the datasource, an u2018ADO.NET (XML) windows pops up with a file path in it, something to the effect of:
    MyLoanerLaptop\ebo bk\orderform1.xml:
    http://i.imgur.com/SEVOE.png
    I did a search on the entire server for the file OrderForm1.XML and could not find it anywhere.  So Iu2019m thinking that the software companyu2019s development team used that file originally, to create the report (did they use a dataset to do this, or is the temporary XML file created during the process actually the schema here?).  I think Iu2019m basically trying to change the data source in the report, to an updated version of the original stored procedure referenced, while still somehow leaving the parameters list in the report alone and have them still work?
    Any and all help would be greatly appreciated.  I realize that this type of work most likely is routine stuff that can be learned by taking the time to do so.  My team is only interested in allowing me a certain amount of time and resources to delve into Crystal and we do not have a Crystal dev team.  So, hopefully you understand my dilemma here.
    Thank you,
    Mike
    Edited by: Mike_DBA on Jan 23, 2012 8:03 PM
    Edited by: Mike_DBA on Jan 23, 2012 8:05 PM
    Edited by: Mike_DBA on Jan 23, 2012 8:11 PM (2:12 pm EST)
    Edited by: Mike_DBA on Jan 23, 2012 8:13 PM
    Edited by: Mike_DBA on Jan 23, 2012 8:18 PM
    Edited by: Mike_DBA on Jan 23, 2012 8:30 PM
    Edited by: Mike_DBA on Jan 23, 2012 10:58 PM

    Hi Mike,
    CRSE is an OEM Product and for use with a custom application they have written. Unfortunately we don't their reports or how they are connecting, it would appear they were originally built off a SQL and then set to a Dataset in the app or they could be adding the data source at runtime. Lots of variations and without access to the source code to see what they are doing not much we can help you with.
    You need to contact the OEM Partner for help in resolving this and find out what you can and need to do to update your SP and work with their canned reports,
    Thank you
    Don

  • VL10E report should show only sales order with complete stock

    Hello Friends,
    I have to make-to-order scenario. While creating a sales order the system proposes a delivery date based on the inhouse production day maintained in the material master.
    In VL10E the system gives list of Sales Order for which delivery is due on that particular date. It does not check whether actually the material is really available on that date for the concerned sales order.
    Is there any scope ( any config change or user_exit) which will show only the sales order with complete stock confirmed through production order in the VL10E report.
    Regards
    Debesh

    Hi,
    Check userexit LV50R_VIEWG02. If CF_SUBRC = 1 you will not see it in the list. For this purpose in the interfase you have the information in IS_VBEP. Set a break-point and check the conditions.
    For more info check the Note 198137 - VL10: Customer-specific enhancements / user exits
    I hope this helps you
    Regards
    Eduardo

  • Generate a report that shows all customers that have changed groupcodes

    We use our groupcodes on the business partner to define retail customers, wholesale customers or vendors.  I have been requested to generate a report by data range any customers who have changed from retail to wholesale.
    The information can be viewed via the change log one record at a time, but the user is requesting a report by date range.  So they can say in the last 30 days what customers were retail and are now wholesale. 
    How can I access the data in the change logs?
    Erin

    Hi Erin,
    There is a 3rd party tool for SAP that can generate standard ALV reports. It is based on an sql editor, and the report can be generated with a few clicks.
    Read a bit more here: [alv report generator|http://www.hovitaga.com/report-generator-overview]
    See it in action: [Report Generator video|http://www.youtube.com/watch?v=cKSBvz_sd98]
    Download a free version from here: [Download free version|http://www.hovitaga.com/try]
    I hope this helps.
    Best regards,
    Tamas

  • Bug - Sorting Order in SQL Reports not Working?

    Today i defined a SQL Report in APEX and choose 3 columns for sorting the report.
    The order is like that:
    1. Category
    2. List Price
    3. Product Name
    When calling the SQL Report in a new session i expected to get a sorted report like defined.
    I got only the report like the last person who edited this report.
    It looks like that the Sort Sequence columns is not usable in SQL Reports.
    Here is an example based on the problems which i described:
    http://apex.oracle.com/pls/apex/f?p=40082
    below the SQL Report a screenshot is shown, where the Report Attributes (and the sort sequence) is displayed.

    OliverL
    Did you reset the pagination of the report you made the changes to?
    Normal behaviour is that APEX remembers per user per report the last sorting that was used.
    Including when a user clicked a column header to change the order from the default one.
    The sort preference are stored in preferences with a name like FSPapp_id_Ppage_id_Rinternal region_id_SORT.
    Nicolette

  • How to show Open Sales Orders only in a report?

    Hi,
    I am working on a Business Objects report to show open sales orders. Here i pull data from a RapidMart universe for which data comes from SAP.
    I just wanted to know which object or field in SAP can/will differentiate whether a particular sales order is delivered or not.
    Is MRP anyway related to this?
    Plz. help!
    Many Thanks,
    Arun KK

    Gattu,
    Thanks for your reply.
    However, the problem goes like this.
    I am working on an existing BO report. This report works perfectly(shows only the open sales orders) except for some leakage(some delivered items too get it).
    The existing report's query have filters only one MRP Element and Order Category.
    Could there be anything that can be done with these objects?
    Thanks,
    Arun KK

  • CO46 report not displaying all sales orders

    Dear all
    We are not able to get details of all sales orders in CO46..(All item categories and different sales order types).Screen remains blank while executing..It doesn't show line items-Overview screen..
    can u please tell us the reason for the same
    Is it to do with sales order type or item category...How do we bring all sales orders in this report
    Regards
    sudha

    Hi
    I think this report only shows the sales order that have diract relation to a Production Order. The other Sales Order are not showed
    If you want a report for all sales order, try VA05 or SD01
    Hope this helps
    Roger

  • SQL report shoring report total - how to disable it

    Hi,
    I am using a report of type "SQL report" to show monthly revenues by year... Report is showing total for individual years... my issue is that Report is also showing a grand total for all years (report total)... may I know how to get rid of report total

    You could build your query to produce the subtotals using a rollup and then NOT have to have the report do totaling..
    Thank you,
    Tony Miller
    Webster, TX
    On the road of life...There are 'windshields', and there are 'bugs'
    (splat!)
    "Squeegees Wanted"
    If this question is answered, please mark the thread as closed and assign points where earned..

  • After creating new sales order through BAPI, it is not showing in VA03

    Hi Experts
    I am developing one program to create sales order using FM BAPI_SALESORDER_CREATEFROMDAT2. In output screen it is showing that the new sales order number created with new sales order number. But whenever I want to display the newly created sales order via VA03 it shows an error message SD document 10007547 is not in the database or has been archived but in program output it shows that 10007547 is created. This is in DEV server. Document numbers are generated by the system sequencially, but it is not reflected in database.
    I am also attaching my code below.
    REPORT  z_bapi_salesorder.
    DATA : gt_header LIKE bapisdhd1,
           gt_item TYPE TABLE OF bapisditm,
           gt_itemx TYPE TABLE OF bapisditmx,
           gt_partner TYPE TABLE OF bapiparnr,
           gt_return TYPE TABLE OF bapiret2.
    DATA : gs_item LIKE LINE OF gt_item,
           gs_itemx LIKE LINE OF gt_itemx,
           gs_partner LIKE LINE OF gt_partner,
           gs_return LIKE LINE OF gt_return.
    DATA : v_vbeln TYPE vbeln_va.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(30) ord_type FOR FIELD p_auart.
    PARAMETERS : p_auart TYPE auart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS       : p_vkorg TYPE vkorg OBLIGATORY,
                       p_vtweg TYPE vtweg OBLIGATORY,
                       p_spart TYPE vbak-spart OBLIGATORY,
                       p_sold TYPE kunnr OBLIGATORY,
                       p_ship TYPE kunnr OBLIGATORY,
                       p_matnr TYPE matnr OBLIGATORY,
                       p_menge TYPE kwmeng OBLIGATORY,
                       p_plant TYPE werks_d OBLIGATORY.
    SELECTION-SCREEN : END OF BLOCK b1.
    INITIALIZATION.
      ord_type = 'Order Type'.
    START-OF-SELECTION.
    *Header information data.
      gt_header-doc_type = p_auart.
      gt_header-sales_org = p_vkorg.
      gt_header-distr_chan = p_vtweg.
      gt_header-division = p_spart.
    *Partner information data.
      gs_partner-partn_role = 'AG'.
      gs_partner-partn_numb = p_sold.
      APPEND gs_partner TO gt_partner.
      CLEAR gs_partner.
      gs_partner-partn_role = 'WE'.
      gs_partner-partn_numb = p_ship.
      APPEND gs_partner TO gt_partner.
      CLEAR gs_partner.
    *Item data
      gs_item-itm_number = '000010'.
      gs_itemx-itm_number = 'X'.
      gs_item-material = p_matnr.
      gs_itemx-material = 'X'.
      gs_item-plant = p_plant.
      gs_itemx-plant = 'X'.
      gs_item-target_qty = p_menge.
      gs_itemx-target_qty = 0.
      APPEND gs_item TO gt_item.
      APPEND gs_itemx TO gt_itemx.
      CLEAR : gs_item, gs_itemx.
      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
        EXPORTING
      SALESDOCUMENTIN               =
          order_header_in               = gt_header
      ORDER_HEADER_INX              =
      SENDER                        =
      BINARY_RELATIONSHIPTYPE       =
      INT_NUMBER_ASSIGNMENT         =
      BEHAVE_WHEN_ERROR             =
      LOGIC_SWITCH                  =
      TESTRUN                       =
      CONVERT                       = ' '
       IMPORTING
         salesdocument                = v_vbeln
        TABLES
         return                       = gt_return
         order_items_in               = gt_item
         order_items_inx              = gt_itemx
         order_partners               = gt_partner
      ORDER_SCHEDULES_IN            =
      ORDER_SCHEDULES_INX           =
      ORDER_CONDITIONS_IN           =
      ORDER_CONDITIONS_INX          =
      ORDER_CFGS_REF                =
      ORDER_CFGS_INST               =
      ORDER_CFGS_PART_OF            =
      ORDER_CFGS_VALUE              =
      ORDER_CFGS_BLOB               =
      ORDER_CFGS_VK                 =
      ORDER_CFGS_REFINST            =
      ORDER_CCARD                   =
      ORDER_TEXT                    =
      ORDER_KEYS                    =
      EXTENSIONIN                   =
      PARTNERADDRESSES              =
      IF v_vbeln <> space.
        COMMIT WORK.
        WRITE :/ 'Document', v_vbeln ,'created'.
        CLEAR : v_vbeln, gt_header.
        REFRESH : gt_partner, gt_item, gt_itemx.
      ELSE.
        WRITE :/ 'Error in creating document'.
      ENDIF.
    Please give the possible solutions for this. What is reason for that update termination.

    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
        EXPORTING
          ORDER_HEADER_IN           = ORDER_HEADER_IN
      WITHOUT_COMMIT            = ' '
      CONVERT_PARVW_AUART       = ' '
       IMPORTING
         SALESDOCUMENT             = SALESDOCUMENT
      SOLD_TO_PARTY             =
      SHIP_TO_PARTY             =
      BILLING_PARTY             =
         RETURN                    = RETURN
        TABLES
          ORDER_ITEMS_IN            = ORDER_ITEMS_IN
          ORDER_PARTNERS            = ORDER_PARTNERS
      ORDER_ITEMS_OUT           =
      ORDER_CFGS_REF            =
      ORDER_CFGS_INST           =
      ORDER_CFGS_PART_OF        =
      ORDER_CFGS_VALUE          =
      ORDER_CCARD               =
      ORDER_CFGS_BLOB           =
         ORDER_SCHEDULE_EX         = ORDER_SCHEDULE_EX
    use bapi_transaction_commit.
    Regards,
    Venkat

  • Do we have standard report to show sale order stock with amount?

    Do we have standard report to show sale order stock with amount?
    I try to use MB5B and MBBS but they don't show value.
    MB5B show only qty
    MBBS no any report.
    Please kindly help.
    Thank you very much.

    Okay Thank you very much for your suggestion.
    I think I have to create a new ZProgram. T_T

  • Create a report to show changes in Sales Order Due Dates

    Hello all,
    I've recently started using SAP Business One 8.8 and I want to run a report to show a list of Sales Orders with the original Sales Order Due Date, and the New Date that it has been changed to. What is the best way to create a report to show me this?
    thanks
    Leigh

    Hi Leigh.......
    Try this......
    Select T0.DocNum, Max(T1.UpdateDate) 'Last Update', T0.DocDueDate
    from ADOC T0
    JOIN ADOC T1 on T1.DocNum = T0.DocNum AND T1.ObjType = '17'
    where T0.ObjType = '17'
    Group By T0.DocNum, T0.DocDueDate
    Regards,
    Rahul

Maybe you are looking for

  • HP LJ1006 wont print on RDP 2012

    Dear All,      We have a a NEW Terminal server in MS Azure Running Server 2012 R2 and the client is Windows 8.1 (Fully updated). The client has a HP LJ1006 attached to it through USB cable and we would like to redirect athe printing on the applicatio

  • How do I "auto shuffle" photos in a table?

    Hi! I have a page of 33 headshot photos. I'd like the photos to "auto rotate" so that the same photo is not always top left, etc.....is there a somewhat simple way to do this? The page I am referring to is: http://www.arlingtondesigncenter.com/findad

  • IPhoto 6.0.6 files restored not recognized.

    I have built a movie on iMovie 6.0.4. I then shared this movie with iDVD 6.0.4. I was running out of HD space and deleted the iPhoto images to create space (not realizing that iDVD needed this to complete the movie). I restored the iPhoto folder from

  • Using Streamclip for FCE import of DVD.......HELP please, not happy

    Hi there friends... Using Streamclip to import a dvd (I shot some stuff and popped it on dvd) or two for use in Final Cut Express... I select the .VOB files to use and it does its thing.....but when I preview (before exporting), there are fine lines

  • Help with scaling of chart

    I have a problem manipulating the scale of the graph here. in the VI that i attached, there's two chart. The one at the top is the problem that i am facing. I want to have a chart that has time on the x-scale in 24-hr format with increment of 1 hour.