Query about Sales per Owner

Hello to all
i am trying to write a query which will display the following fields with date (docdate) folter
OwnerName(Employee Name)
LineTotal of OINV
Number of invoices (count(docnum))
Grosprofit
Grosprofit%
Average total of invoices (doctotal/Number of invoices (count(docnum)))
Number of Lines for all the Invoices(sum(linetotal)
doctotal/lines
could you please help me on the above query?
i would appreciate a help on the above query

issue resolved

Similar Messages

  • Fastest way to calculate total sales per material?

    I'm creating a report where I need the total sum of sales per material. 
    Is the fastest & most efficient / only way to do this by querying VBAP?  We're talking about millions of lines.
    I guess I'm hoping that there is a FM already in place or that some sort of summary table exists.
    Any ideas?

    There is no FM. In the program you should be able to use table VAPMA, which has the same data as VBAP but the primary key is MATNR.
    Depending on the requirements, it might be beneficial to create an info structure (LIS) to track summarized sales. Your SD consultant should be able to do that, there is no programming required.
    Hope this helps.

  • Query on Sales Order Analysis

    Dear Experts
    I have written a Query for Sales Order Analysis and would like to have help on this.
    The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]
    After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. Everything is fine with this query except I would also like to incdude the total number of Sales Order (per day) right below the column "DocNum".
    Is it possible to achieve this?
    Thank You
    Regards
    Elton

    Try this:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT count(DocDate), SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]

  • Report Sales Per Customer

    Hello to all!
    i have a requirement to make a query that will bring me report for Sales Per Customer
    the desired fields are the following
    CardCode
    CardName
    --, (Select sum(T6.LineTotal) from inv1 t6  where t6.docentry=t0.docentry) 'Price Bef. Disc.'
    , (Select t5.linetotal from inv3 t5 where t5.docentry=t0.docentry and t5.expnscode in ('6','7')) as 'Freight'
    --, (Select t5.linetotal from inv3 t5 where t5.docentry=t0.docentry and t5.expnscode='11') as 'W/TAX'
    VatSum
    .DocTotal
    SlpName
    till now i have written the following code
    SELECT t0.docdate as 'Doc. Date', t0.docnum as 'Doc No.', T0.CardCode AS 'Customer Code', T0.CardName as 'Customer Name', (Select sum(T6.LineTotal) from inv1 t6 where t6.docentry=t0.docentry) 'Price Bef. Disc.', (Select t5.linetotal from inv3 t5 where t5.docentry=t0.docentry and t5.expnscode in ('6','7')) as 'Freight', (Select t5.linetotal from inv3 t5 where t5.docentry=t0.docentry and t5.expnscode='11') as 'W/TAX',T0.VatSum,  sum(T0.DocTotal) 'Doc. Total', T1.SlpName as 'Account Manager' FROM OINV T0 INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode inner join ocrd t2 on t0.cardcode=t2.cardcode inner join ocrg t3 on t2.groupcode=t3.groupcode WHERE (T0.DocDate between '[%0]' and '[%1]')
    group by T0.CardCode, T0.CardName, T1.SlpName, t0.docnum, t0.totalexpns, t0.docentry, t0.docdate,T0.VatSum
    union
    SELECT t0.docdate as 'Doc. Date', t0.docnum as 'Doc No.', T0.CardCode AS 'Customer Code', T0.CardName as 'Customer Name',(Select (-1)*sum(T6.LineTotal) from rin1 t6 where t6.docentry=t0.docentry) 'Price Bef. Disc.', (Select (-1)*(t5.linetotal) from rin3 t5 where t5.docentry=t0.docentry and t5.expnscode in ('6','7')) as 'Freight', (Select (-1)*(t5.linetotal) from rin3 t5 where t5.docentry=t0.docentry and t5.expnscode='11') as 'W/TAX', (-1)*T0.VatSum, (-1)*sum(T0.DocTotal) 'Doc. Total',T1.SlpName as 'Account Manager' FROM ORIN T0 INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode inner join ocrd t2 on t0.cardcode=t2.cardcode inner join ocrg t3 on t2.groupcode=t3.groupcode WHERE (T0.DocDate between '[%0]' and '[%1]')
    group by T0.CardCode, T0.CardName, T1.SlpName, t0.docnum, t0.totalexpns, t0.docentry, t0.docdate,T0.VatSum
    but i would like only once to be displayed each customer
    do you have any idea?

    issue resolved
    SELECT
    T0.CardCode AS 'Customer Code'
    , T0.CardName as 'Customer Name'
    ,(select sum(t5.linetotal) from inv1 t5 INNER JOIN oinv T6 ON T6.DOCENTRY=T5.DOCENTRY where t6.cardcode=t0.cardcode and t5.docdate between '[%0]' and '[%1]') 'Price Bef. Disc.'
    ,(Select sum(t7.linetotal) from inv3 t7 inner join oinv t6 on t6.docentry=t7.docentry where t6.cardcode=t0.cardcode and t7.expnscode in ('6','7') and t6.docdate between '[%0]' and '[%1]') as 'Freight'
    ,(Select sum(t7.linetotal) from inv3 t7 inner join oinv t6 on t6.docentry=t7.docentry where t6.cardcode=t0.cardcode and t7.expnscode ='11' and t6.docdate between '[%0]' and '[%1]') as 'W/TAX'
    ,(select sum(t8.vatsum) from oinv t8 where t8.cardcode=t0.cardcode and t8.docdate between '[%0]' and '[%1]') as 'VatSum'
    ,sum(T0.DocTotal) 'Doc. Total'
    , T1.SlpName as 'Account Manager'
    FROM OINV T0
    INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode
    WHERE (T0.DocDate between '[%0]' and '[%1]')
    group by T0.CardName, T1.SlpName,T0.CardCode
    union
    SELECT
    T0.CardCode AS 'Customer Code'
    , T0.CardName as 'Customer Name'
    ,(select sum(t5.linetotal) from rin1 t5 INNER JOIN orin T6 ON T6.DOCENTRY=T5.DOCENTRY where t6.cardcode=t0.cardcode and t5.docdate between '[%0]' and '[%1]') 'Price Bef. Disc.'
    ,(Select sum(t7.linetotal) from rin3 t7 inner join orin t6 on t6.docentry=t7.docentry where t6.cardcode=t0.cardcode and t7.expnscode in ('6','7') and t6.docdate between '[%0]' and '[%1]') as 'Freight'
    ,(Select sum(t7.linetotal) from rin3 t7 inner join orin t6 on t6.docentry=t7.docentry where t6.cardcode=t0.cardcode and t7.expnscode ='11' and t6.docdate between '[%0]' and '[%1]') as 'W/TAX'
    ,(select sum(t8.vatsum) from oinv t8 where t8.cardcode=t0.cardcode and t8.docdate between '[%0]' and '[%1]') as 'VatSum'
    ,sum(T0.DocTotal) 'Doc. Total'
    , T1.SlpName as 'Account Manager'
    FROM orin T0
    INNER JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode
    WHERE (T0.DocDate between '[%0]' and '[%1]')
    group by T0.CardName, T1.SlpName,T0.CardCode

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

  • FI-AR-CR Customer Sales per Credit Control Area

    Hi,
    Do you know any table or funtion that may calculate the Customer Sales Volume per Credit Control Area? I need to calculate a customer specfic DSO (Day Sales Outstanding) figure. The standard AR Summary doesn't return such information. This nay be obtained via BSEG, but it requires a complex query.
    I have found the function module CUSTOMER_BALANCE, but it returns customer sales per company code, which still requires additional calculation to totalize the balances for all the company codes that belong to a credit control area which the customer is assigned to.
    I appreciate any input that may provide a simplier solution for this question.
    Thanks and regards.
    Gonçalo

    Hi,
    I have decided to use the function module CUSTOMER_DSO_CALCULATION, and I will try get the sales volume from some internal variable that this FM uses to calculate the standard DSO. Then I'll store it on a  Z table in order to compute the new specific DSO
    Thanks and regards,
    Gonçalo

  • Big Troubles on designing Query about special customers' counting

    Hello buddies:
    I meet a problem on designing Query about special customers' counting. Let me describe the requirment first.  I want to create a query with BEX , and there is a key figure with very special logic.
    That is: to list the counts of the customers which has more than one sales records in a time period from sales data. 
    For example :
    when the user excute the query , he or she must input a time period ( 2007.01~2007.03 e.g)
    then the query output as follow:
    District          Cust-sount
    North-Zone       100
    South-Zone      120
    The Main trouble are :
    1. Threr are no document number in the detail of sales data document records. so I could not count the sales times with document number.
    2. The time period is not fixed value, it depends on the user's input, so I can not define the counting logic in the update rule or in the query with fixed time period.
    Anybody who met similar requirement pls show me your hand and give your solutions, thanks very much.
    Jason

    Hi,
        Your solution sounds a good way to count the distinct customers. but in my case, one salse line item must not be recognize as one sales record, instead,  one customer's all sales line items occurs in one day must be  recognize as one sales record ( or we say that one sales behavior).
    for example:
    customer     product    quantity   date
    cust001       prod001        10       2007.06.06
    cust001       prod002        20       2007.06.06
    the two line items above means one sales record for the customer "cust001".
    so I could not simply use the CKF : (( Counter ) *FV2 ) > 1 .
    Best Regards,
    Jason

  • Bapi about plant, bapi about sales organization

    Hi friends,
    Given a company code, I want to fetch a list of plants assigned to that company. Is there any BAPI or RFC could be used to achieve this? I have to call it outside the sap system, so fm like K_ABC_GET_WERKS_FOR_BUKRS can not help. Also I tend to not to use RFC_READ_TABLE to access the table of sap system directly.
    Another questions are about sales organization. I wonder what's the relationship between sales organization and company. If there is some relationship, is there any rfc or bapi can be used to query such relationships, such as get a list of sales organizations against a company code? And when I look into the BAPI BAPI_EMPLOYEE_GETDATA and find some concepts such as Personnel Area, Organizational Unit, Employee Subgroup, etc. Are these concepts have relationship with the concept of sales organization? I want to know which sales organization he/she is responsible for for each  given employee (rep). Is it possible? Still, are there any bapi or rfc available?
    Thanks

    Hi,
    you can use the FM RFC_READ_TABLE.
    Then read from the table T001K..
    This will also solve your purpose...
    I believe the other FM will also get it from the same table..
    Thanks,
    Naren

  • Query for Turnover per Customer / article and from wich agent in one file.

    Hello Experts -  basicly the subject tells it all, what I whant to see in the query is:
    Turnover Per Customer wich articles and wich agent is responsible for the customer.
    Many thanks in advance.

    Hi,
    Actually there are two field in the INV1 table
    1) Price = Net Price (after the adjustment of the Discount at row level)
    2) pricebefdi = Gross Price ( which does not include the discount at the row level)
    I have amended the query again based on the above fields :
    select distinct t0.CardName as 'Business Partner Name',
    CASE WHEN t1.discprcnt != 0 then ROUND(SUM((t1.Quantity*t1.PriceBefDi)*((100-t1.DiscPrcnt)/100)),2)
    WHEN t1.DiscPrcnt = 0 then ROUND(SUM((t1.Quantity*t1.PriceBefDi)*((100-t0.DiscPrcnt)/100)),2)
    WHEN t1.DiscPrcnt !=0 and t0.DiscPrcnt != 0 THEN
    ROUND(SUM((t1.Quantity*t1.price)*((100-t0.DiscPrcnt)/100)),2)
    END as [Total Turnover after Discount],
    t1.DiscPrcnt as 'Discount Percentage Rows',
    T0.Discprcnt as 'Header Discount',
    t1.VatSum as 'Vat Amount', t1.Dscription as 'Item Name',
    sum(t1.Quantity) as 'Qty Sold', t3.SlpName as 'Sales Employee Name'
    from OINV t0 inner join INV1 t1 on t0.DocEntry = t1.DocEntry
    inner join OSLP t3 on t3.SlpCode = t0.slpcode
    where t0.DocDate >= '2011.01.01' and t0.DocDate <= '2011.12.31'
    Group BY t3.SlpName, t0.Cardname,t0.slpcode, t1.Dscription,t1.DiscPrcnt,t1.vatsum,
    t1.DiscPrcnt,t0.discsum,t0.discprcnt
    order by t1.Dscription
    I have incorporated the one where discount is there both on header and rows.
    Kind Regards,
    Jitin
    SAP Business One Forum Team
    Edited by: Jitin Chawla on Oct 12, 2011 11:17 AM
    Edited by: Jitin Chawla on Oct 12, 2011 11:18 AM

  • HT1473 What are the royalties on sales, per single or album

    What are the royalties on sales, per single or album?

    Great question, Sarah Hums-Oracle! We did educate / demonstrate / document for our internal clients, but found there was need for pretty constant "re-education"... the farther removed from the initial to the first actual use, the greater the need for re-education. Those of us using Eloqua every single day were struggling a bit at first to understand why our internal clients weren't talking the same Marketing Automation language. I've now had multiple sessions where we share screens and link campaign planning to Eloqua functionality, and have seen an increased interest in the campaign canvas and the back-end data (at first, it was like "Why are you showing me the Eloqua campaign canvas? Let's get back to my campaign strategy PPT.").  There has also been a lot of re-education on how exactly marketing automation can function to nurture contacts through the customer journey cycle - we are still living about 85% in the world of discrete marketing campaigns, and only beginning to integrate the world of drip campaigns (welcome, nurture, re-engagement) now that our internal clients understand what those are (and that the associated assets and timing need to be thoughtfully planned out!).

  • Query for Sales Order Analysis

    Dear Experts
    I have written a Query for Sales Order Analysis and would like to have help on this.
    The query is used for generating daily report for Sales Order on number of documents (Sales Order), total amount of sales orders and total GP of Sales Order. The query is written as below:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum] ORDER BY T0.[DocNum]
    where U_Total_GP is a UDF for storing the GP of each order.
    After executing the query, a selection criteria of date appears and after a date is selected, the report shown information required. However, the query does not calculate column total for total amount and total GP. Although I know the total for each column can be displayed by pressing "Ctrl" + Click on the column title, it would have to be done from time to time.
    Therefore, I would like to modify my query in order to calculate the column totals when executed. Are there any suggestions for this?
    Thank you
    Regards
    Elton

    Hi Elton,
    Try this:
    SELECT T0.[DocNum], SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0] GROUP BY T0.[DocNum]
    Union ALL
    SELECT '', SUM(T0.DocTotal) AS 'Total', SUM(T0.U_Total_GP) AS 'Total GP'
    FROM ORDR T0 WHERE T0.[DocDate] =[%0]
    ORDER BY T0.[DocNum]
    Thanks,
    Gordon

  • Problem about sales order stock stock transfer and batch determination

    Hi, experts, I get a problem about sales order stock stock transfer and batch determination.The following is the current situation of my system:
      In OMCG I assigned search procedure ME0001 to both 311 and 311 E and ticked check batch. After that, I found  that if iI need to tranfer unrestricted-use material from storage location 1000 to 2000 with movement type 311, I just need to input * at the field batch, then the system will display all of the available batches. But for the transferring of sales order stock with movement type 311 E, after I input * at the batch field, no batch is displayed and there is also no message from the system.
      Can anybody help me? Is there anything else I need to do? Thanks very much.

    I think my question is not clear, actually I tried 562 E , 411 E and 413 already. all the transaction looking for the sales order but unfortunatly the sales order is deleted  from SAP.

  • TS3297 I have only a problem downloading the music porchased o. itunes on my min ipad? The file reach about 90 per cent and rhen it says error ..try later...what i have to do to solve it? Thank you in advance.

    Hi
    I have a problem when trying to download music or videos purchased on Itunes on my mini Ipad.
    When reaching about ninty per cent of download it says error end try later.
    What can I do to solve this?
    App store and book store work fine and I have no problem with them.
    Thank you for your help!
    My i Os is updated to the last version.

    Hello Theresa818,
    Thank you for using Apple Support Communities!
    It sounds like the cellular data will not activate for some reason on the iPad.
    I found this article that will help you resolve this issue here, named iPad (Wi-Fi + Cellular Models): Troubleshooting a cellular data connection, found here http://support.apple.com/kb/TS4249
    Check for a carrier settings update.
    Update your iPad.
    Toggle the Cellular Data setting off and on under Settings > Cellular Data.
    Restart your iPad.
    Tap Settings > General > About. Locate the Carrier entry and make sure that your carrier is correct.
    If your SIM card has SIM PIN enabled, try turning it off: Tap Settings > Cellular Data > SIM PIN.
    Make sure you're in an area of good coverage. If the cellular data connection works in another area, contact your carrier to report the original affected area.
    Reset network settings: Tap Settings > General > Reset > Reset Network Settings.
    Restore the iPad as new.
    If none of the above steps resolves the issue, make an appointment at an Apple Retail Store, contact your carrier, or contact AppleCare to troubleshoot further.
    I know you may have done one or two of the steps here, so you can skip those.
    Take care,
    Sterling

  • Sales per quantity

    Hi Experts,
    We have a requirement  where client wants the unit price to be upto 4 decimal places .But as per SAP standard , currency fields  can accept only 2 decimal places.So , in a Sales order pricing  conditions, we manually put Rate/1000 qty so that unit price has upto 4 deimal place.
    For eg-In our sales order,under item conditions for every condition type  we put price rate   as 9123.40 per 1000 quantity manually so that unit price has 4 decimal places. Eg-9123.40/1000=9.1234
    Client wants this to be automatic & not manual  i.e whenever user enters Rate =9123.40 in sales order pricing conditions ,automatically 1000 should appear under SALES PER QUANTITY so that unit price becomes 9.1234 .
    Presently by default , Sales per Quantity is 1.
    I think this can be done by some configuration changes in material master
    Please help.
    Regards,
    Rahul

    Hi Rahul,
    Yes you can change it in OY04 as given in above post.
    But my suggestion is to discuss this issue with FI consultant because if you change it in OY04 then it will impact many other feild.
    So take any decision with the suggestion of FI resource.
    Regards,
    MT

  • Sales per day

    Hi all,
    I have requirnment where i have to find the sales per day,i.e if the user select the month jan then sales per day should be calcualated as the no.of days from jan 31st to july 1st 2011 which is considered as the trading financial start.
    I want to know if we can give something like this logic -------timestampdiff of last sale date of (presentation variable) and july 1st 2011.
    Please help And let me know the possibility.If possible could you give a step by step information how to do it as I am new to obiee.
    Thanks and regards
    Sara

    Set level as "Total" for Company dimension in CALENDAR_MEASURES Fact.

Maybe you are looking for

  • Confirmations in scheduling agreement

    Dear All, In a PO, I can 'manually' enter confirmations using confirmation control key AB.Is it not possible to do so in scheduling agreements? Regards, Vijay

  • How to get pics from iphone to iphoto library on hard drive

    Hi there. I saved my photo library to an EHD. I pointed iphoto to open the library from EHD. Normally when I connect my iphone to my macbook pro, iphoto just pops up asking to import the pics from my phone. But now it doesn't do that and it doesn't s

  • Photoshop Elements 4 won't open, Mac Leopard

    Photoshop Elements 4, OS X 10.5.7 Been using Photoshop Elements 3 and 4 with iPhoto 6 for years.  Recently, when I tried to open Photoshop from iPhoto, Photoshop crashed. Since then, I have been unable to open Photoshop from this, my home user accoun

  • Using the TV inbuilt freeview

    We have just replaced our old CRT tv (no inbuilt freeview) with a nice new LG LED tv (with inbuilt freeview).  One of the benefits of doing this was that I thought we'd be able to watch the freeview via the TV, while allowing the BT Vision box to rec

  • Safarinotifi error

    I get a SafariNotifi error while installing Acrobat XI Pro from Creative Cloud. It happens when I'm at 49% installation. I have Safari closed and it still happens. Any suggestions how to fix this? Thanks!