Sales Qty and Days

Dear Forums,
If i want to get this report ;
Item Code / Qty Sales (accumulate this month) / Days (how many days till this month) / Total days in this month
eg . April 21
542514 / 2.563 / 21 / 30
can any one show me the query? thanks

The "Union" is to list the all the items which has stock >0 and items not in Invoice
SET ARITHABORT OFF SET ANSI_WARNINGS OFF
SELECT T0.ItemCode, T0.Dscription,T1.OnHand, convert(varchar,SUM(T0.BaseQty*T1.NumInSale)) AS 'Qty Sales',DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
,convert (varchar,(t1.onhand/(SUM(T0.BaseQty*T1.NumInSale)/DAY(GetDate())* Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END)))AS 'TURN OVER IN MONTH'
FROM DBO.INV1 T0 INNER JOIN DBO.OITM T1 ON T0.ItemCode = T1.ItemCode
WHERE Month(T0.DocDate) = Month(GetDate()) AND Year(T0.DocDate) = Year(GetDate())
GROUP BY T0.ItemCode,T0.Dscription,T1.OnHand
union
SELECT T1.ItemCode, T1.itemname,T1.OnHand, '' AS 'Qty Sales',DAY(GetDate()) as 'Days',
Case WHEN Month(GetDate()) in (1,3,5,7,8,10,12) THEN 31 WHEN Month(GetDate()) in (2,4,6,9,11) THEN 30 ELSE 28 END AS 'Total days'
,'No Sales' AS 'TURN OVER IN MONTH'
FROM DBO.OITM T1
WHERE T1.ITEMCODE NOT IN (SELECT ISNULL(ITEMCODE,0) FROM INV1)
AND T1.ONHAND>0
GROUP BY T1.ItemCode,T1.itemname,T1.OnHand
ORDER BY 1
Please let me know whether out is correct. If so i will try to include the A/R Credit Memo also

Similar Messages

  • Qty and Date Variance using Purchasing InfoCube

    Using Purchasing Cube, I want to find out the Qty Variance and Date variance,
    Iu2019m calculating these using GR Posting date and Requested Delivery Date and GR Qty and Qty in UoM.
    Iu2019ve the following doubts:
    1.     In order to calculate the Variance, do we need to filter the data pertaining to any particular BW Transaction Key (0PROCESSKEY) since we donu2019t want Goods Issues (can be Purchase Returns or intra company Stock Transfers ), If so what are the values for the Process Key to be considered for filter.
    2.     Though the Qty key figure matches the Requested Qty, the PO status is u2018Openu2019. What could be the possible reasons?
    3.     The qty. and days variance for the POs already received can be calculated. But what should be done incase of POs for which Goods are not yet received? Again in that scenario, we can have two cases: Delivery Past Due and Delivery Date in Future. How to tackle these 2 cases. As per our Requirement, we have to calculate the difference between System date and Requested Delivery Date incase of Past Delivery Date so that we can have the variance as of System Date. Like If the Delivery Date is 25th Nov, if we run the Query on 28th, it should show 3 days late and if run on 29th, it has to be 4 days if still undelivered. Please give me the code to be written in Transformations.
    We have not yet decided what has to be done in the second case i.e. Future Delivery Date. Please guide me what is the best option in that case.
    Thanks,
    Aryaman

    Hi,
    1. In order to calculate the Variance, do we need to filter the data pertaining to any particular BW Transaction Key (0PROCESSKEY) since we donu2019t want Goods Issues (can be Purchase Returns or intra company Stock Transfers ), If so what are the values for the Process Key to be considered for filter.
    You need to add Z-Keyfigures and then write Routines based on Process Keys in Update Rules/Transformations and filter the required Process Keys, you need to find required Process Keys in ECC, SPRO-->Reference IMG an dthen search for BW Transactional Key and see it disuss with MM FUnctional COnsultant and Identify it.
    2. Though the Qty key figure matches the Requested Qty, the PO status is u2018Openu2019. What could be the possible reasons?
    I faced the problem with 2LIS_02_* datasources so I created new generic data source and used it.  Just take only one record with that you track in ECC. You must take MM Consultants help, they will guide you.
    3. The qty. and days variance for the POs already received can be calculated. But what should be done incase of POs for which Goods are not yet received? Again in that scenario, we can have two cases: Delivery Past Due and Delivery Date in Future. How to tackle these 2 cases. As per our Requirement, we have to calculate the difference between System date and Requested Delivery Date incase of Past Delivery Date so that we can have the variance as of System Date. Like If the Delivery Date is 25th Nov, if we run the Query on 28th, it should show 3 days late and if run on 29th, it has to be 4 days if still undelivered. Please give me the code to be written in Transformations.
    We have not yet decided what has to be done in the second case i.e. Future Delivery Date. Please guide me what is the best option in that case.
    Once you have Qty and Dates from Transactional Data then it is easy to calculate the Date Varience and Qty varience, see the follwoing URL it is having one article How to Calculate Meterial Aging whcih will give how to calculate the differnce..
    http://wiki.sdn.sap.com/wiki/display/profile/Surendra+Reddy
    Thanks
    Reddy

  • MRP is conflicting with Sales order requirement Qty and date

    Hi experts,
    We have below scenario:
    Material has the stock 100. It has reorder point 3 and MRP type V2 (Automatic reorder point with external requirements) and planned delivery time 10 days.
    MRP run creates purchase requisition whenever the stock falls below reorder level or/and based on customer orders requirements.
    We created first sales order for Qty 80 and delivery date 03/01/2012.  Qty 80 is confirmed against this sales order.
    We created second sales order for Qty 50 and delivery date 01/31/2012. Now remaining Qty 20 is confirmed against this order. So we have requirements of 30 Qty for this second order.
    When we run MRP, it supposes to create Purchase requisition for Qty 33 (30 + 3) including reorder point (3 Qty). As the delivery date for this order is 01/31/2012 and requirement Qty is 30, and planned delivery time is10 days, MRP run should create purchase requisition. But it is not creating.
    If I change the planned delivery time to 30 days, it is creating purchase requisition. It is considering sales order delivery date of First order (delivery date: 03/01/2012), but not for second order (delivery date: 01/31/2012).
    So MRP is conflicting with Sales order requirement Qty and date.
    Appreciate your help in this regard to resolve the issue
    Thanks,
    Srini

    Hi,
    We are using manual reorder point planning with external requirements (V1)
    Thanks,
    Srini

  • Delivery Qty and OPEN Qty Field in SALES Order Delivery Reports.

    Dear All Experts.
    Please Help me for which field put for Delivery QTY. and it is necessary to calculate OPEN QTY. or we can put directly from field.
    i used this field for Order Qty : WMENG.
    Please Guide me.
    Thnks With Regards :
    Bhavesh Panchal.

    Delivery qty - LIPS-LFIMG.
    You cannot get open quantity directly.
    use this way.
    Delivery qty   - LIPS-LFIMG.
    order qty       - VBAP-KWMENG.
    open qty = delivery qty - order qty.

  • Billing Qty by Sales office and Sales group (LIS)

    Hello!
    I am running the report MC-E, I want to see there (or at another report of LIS) the ratio Billing Quantity, but shown by Sales office and/or by Sales group, could anybody help me?
    Thank you in advance
    Regards

    Hello Enrique
    You may add key figure 'Billing Quantity' to standard Infostructure S002 or add characteristics "Sales Office' or 'Sales Group' to Infostructure S001.
    Or if you don't want to tamper with standard delivered, copy S001 or S002  and create custom Infostructure ( S500+) with the requisite characteristics and key figures.
    Hope this helps.

  • Difference between Withdrawal Qty and Allocated

    Hi!
    Can anyone tell me the difference between Withdrawal Qty and Allocated in tcode RRP3 in tab Forecast?
    In tab detail I have the Plan Qty (Forecast) and the Withdrawal Qty that most of days is the same quantity as Plan Qty and no value in Allocated. The category text is Forecast is this cases.
    In other days, I have Withdrawal Qty different from Plan Qty and values in Allocated. I see that the allocated values are from orders or deliveries because the category text is SalesOrder or Deliv. and I see the ECC document number, but what means Withdrawal Qty in this and other case?
    EX:
    date                  material    location     category text  Plan Qty  Withdrawal Qty  Allocated
    12.03.2009     1270999     UN02     FC req.            726         726                       0
    17.03.2009     1270333     UN02     FC req.          1.478         410                     60
    17.03.2009     1270999     UN76        SalesOrder     0     0                             40     
    17.03.2009     1270999     UN769     SalesOrder     0     0                             20     
    Regards,
    Teresa Lopes

    Hi Teresa,
    The forecast tab shows the consumption scenario.
    It has Planned Qty. , Allocated Qty.,  Withdrawal and remaining.
    Planned Qty. is the qty in forecast keyfigure
    Allocated is the qty. allocated to the sales order by the system.
    Withdrawal is the qty. totally deduced from the forecast once the order is PGIed.
    Remaining is the qty. left in forecast
    Example:
    If the strategy is 10 ( sales orders do not consume forecast)
    You have a forecast of 100 PCs
    Planned qty: 100
    Allocated Qty: 0
    Withdrawal: 0
    Remaining: 100
    You create a sales order of 50 PCs
    Planned qty: 100
    Allocated Qty: 50
    Withdrawal: 0
    Remaining: 100
    You create a delivery for this sales order of 50 PCs
    Planned qty: 100
    Allocated Qty: 50
    Withdrawal: 0
    Remaining: 100
    You PGI the delivery for this sales order of 50 PCs
    Planned qty: 100
    Allocated Qty:0
    Withdrawal: 50
    Remaining: 50
    The same above thing when the strategy is anything else except 10 like 20, 30 or 40 ( sales orders consume forecast)
    You have a forecast of 100 PCs
    Planned qty: 100
    Allocated Qty: 0
    Withdrawal: 0
    Remaining: 100
    You create a sales order of 50 PCs
    Planned qty: 100
    Allocated Qty: 50
    Withdrawal: 0
    Remaining: 50
    You create a delivery for this sales order of 50 PCs
    Planned qty: 100
    Allocated Qty: 50
    Withdrawal: 0
    Remaining: 50
    You PGI the delivery for this sales order of 50 PCs
    Planned qty: 100
    Allocated Qty:0
    Withdrawal: 50
    Remaining: 50
    Hope this helps.

  • How to add FISCAL YEAR, Period and Day to cube.

    hi,
    I am using SD EXTRACTORS (2LIS_11_VAITM, 2LIS_11_VAKON, 2LIS_12_VCITM and 2LIS_13_VDITM) and directly updating each corresponding ODS and cube.
    All the extractors only have FISCAL VARIANT has the time characteristic. So, all my ODS contains only one time char - fiscal variant and other dates (liek document created date etc. (not a time char)).
    Now, I want to use fiscal period, fiscal year and fiscal day in my cube. I have added these time char in my cube.
    My question:
    1. how to get FISCAL YEAR, FISCAL PERIOD and FISCAL DAY get updated. Do I need to map to document created date in update rules or Do I need to use some functional module.
    Pls note I am bringing only FISCAL VARIANT from R/3 into ODS and then to CUBE.
    PLS REPLY.

    thanks sundar..i got your point..but I have one question
    All the cubes (sales, sales condition and billing) have the sales order number (VBUK-VBELN) and item number (POSNR-VBUK). But info objects used for these fields in sales cube and sales condition cube are same but for billing it is not same.
    Can I combine all cubes (sales order, sales condition, billing) in muliti provider.
    1. Sales order cube (from VAITM)
               Sales order number (VBUK-VBELN) --  (0DOC_NUMBER)
               Sales Item (VBUK-POSNR)              --  (0S_ORD_ITEM)
    Date : Document created date (VBAK-AUDAT) --  0DOC_DATE
    2. Sales Condition cube (from VAKON)
               Sales order number (VBUK-VBELN) --  (0DOC_NUMBER)
               Sales Item (VBUK-POSNR)              --  (0S_ORD_ITEM)
    Date: Document created date (VBAK-AUDAT) --  0DOC_DATE
    Key field: Netprice (VBAP-NETWR) -- 0NET_VALUE
    3. Delivery Cube (from VCITM)
             Sales order number (VBUK-VBELN)   -- (0DELIV_NUMB)
             Item   (VBUK-POSNR)                         -- (0DELIV_ITEM)
    Date: Delivery Date :LIKP-WADAT_IST      -- 0ACT_GI_DTE
    4. Billing Cube (from VDITM)
              Sales order number (VBUK-VBELN) --  (0BILL_NUM)
              Sales Item (VBUK-POSNR)              --  (0BILL_ITEM)
    Date: Billing Date: (VBRK-FKDAT)             -- (0BILL_DATE)
    Key field: Net price (VBRP-NETWR)       -- 0NETVAL_INV
    I want to combine above cubes. If I combine, Will I get correct data??????
    Points will be assigned to every useful answer

  • Order qty and confirmed qty mismatch

    Dear friends,
    My requirement is System should not allow to go further if the sale order qty and confirmed qty(after avaialbility check) mismatch is there.Pls suggest.
    Now currently system will check the availability qty and will show the information of confirmed qty in the another screen.and if we say continue the process, we can go ahead and save the document.but the document will be in open state.
    So pls suggest the way i can go ahead for this requirement.
    Regards
    Mahendar.

    hi,
    If u want to allow user to create SO as much as available qty..? means  system sud create SO for order qty is equal to availble qty ...? if yes
    then go the availbality check  and find out availability check and checking rule..
    and again go to OVZ9 remove the check box check with out RLT from rep.lead time tab
    Resul is: If u enter in SO a10 qty ,and if you have only 5 qty in hand or in plant ,then system after checking the items it will change the order qty in SO(i e 5) automatically,
    Caprin

  • Function module for open sales order and open PO

    hi all,
    can anyone please tell me that is there any function module to get open sale order  and also for open purchase order?
    regards saurabh.

    Hi ,
    In EKPO Table u select this fields  Purchase Document no and Item no of Purchsing Document , Material no , and Purchase Order Qty.
    In MSEG Table u select this fields Purchase Document no and Item no of Purchsing Document , Material no , and  Qty.
    Both Tables having  Purchase Document  no , So  Purchase Doucment no throguh  u will get the Material and qty , Finally u Subract the both Material Qty's .
    u will get the Open Po For particular Material.
    If ur not getting ,Inform me .
    Regards ,
    Shankar GJ

  • Diffrence in incomming order qty and billing qty in cube 0sd_c03 & 0sd_c01

    Dear All.
    i have uploaded 2 cubes 0SD_C01 & 0SD_C01 from our R/3 data, SAP recommed for 0SD_C03 for sales analysis and their best practice is also based on 0SD_C03  but it is very strange the values of both the cubes are not the same when i run the report but the values of 0SD_C01 is 100% same as R/3 values i.e. mcsi reports show the same incomming and billing qty as i can see in report for 0SD_C01 but strang to see in 0SD_C03 there is diffrence in these values.
    can any one explain why did this happen as SAP recommed to use lbwe data sources and their best practice also base on 0SD_C03 and the other one i.e. 0SD_C01 is based on old LIS structures.
    during exploration i come to know that in some material orders incomming and billing quantaties are same but diffrence in most of them.
    any help will be highly appreciated.
    thanks & best regards,
    Zeeshan

    Hi,
    There are somany Routines for Keyfigures in both Cubes, I hope you may using 0QUANT_B key figure for Qty, the reason is there may be some difernece in Routines in both cubes, so you need to check it tehn you check in teh reports, whether is there any restrictions, you need to iopen the each node and check i nthe both reports.
    I also faced teh same problem with MCSI and BW reports, MCSI, we can customizi it an dut is just InfoStructure and having routines internally. So you need to take one material, plant and date where the diffrenece is coming then track it.
    Check OSS NOTES:
    Note 166996 - BW InfoCube 0SD_C03: incorrect incoming order qty
    Note 1156259 - Update rules incorrect for InfoCube 0SD_C03
    Thanks
    Reddy
    Edited by: Surendra Reddy on Aug 10, 2009 7:19 AM

  • View open qty and manually close SO

    Hi,
    Example : I have SO with qty 10pcs, but only 3pcs are delivered, the remaining 7pcs are yet to be delivered. Hence, this SO is still open. The thing now is that I want to see the open qty and manually close the SO.
    I tried with VA05 but it doesn't show the open qty. What transaction to view the open qty? How to manually close an open SO? Is there a button or checkbox that I can just click on it to close the SO?
    Thanks.
    Edited by: Wooi Ling Ng on Feb 14, 2008 2:56 PM

    Hi,
    As said that you want to close the sales order for 7 qty of total 10 qty.
    When do the following.
    Goto the sales order created, goto the line item eg 10 scroll towards right side of the screen to find the field " Reason for Rejection" assign the relavent message why you want to close the order for remaining quantity.
    If you have many line items you can reject the undeliveried line items if you want them not to delivery.
    Kindly Reward points if usefull.
    Regards
    vK

  • BOM business requirement for sales order and PGI

    Hi Experts,
    Current setting
    The BOM structure is A = A1+A2
    1) Material A created in MM master item category group = ERLA
    2) Sub component material A1 and material A2, MM master item category group = NORM for both component.
    3) Maintained in CS01 BOM header is A and items are A1 and A2.
    4) Item category in IMG was created and assign item category also created.
        4.1) OR-ERLA-TAQ-TAE
    new business requirement as listed below.
    5) The material A is alway zero quantity on hand, no goods receipt required with no physical with such material or package at all. (it is dummy material number in SAP).
    6) while SO created.
        6.1) Fro material A sales price captured at BOM header level only, NO QTY and COSTshow in the sales order.
         6.2) Material A1 and A2 are actual physical inventory item in the ware house.
         6.3) The sub component of material A1 and A2 is required to captured QTY and COST. NO SALES PRICES NEEDED.
    CONCLUSION
    HOW to setup/configure such a business scenario?
    - Is it logic to configure as OR-ERLA-TAE-TAN that's what i think of?
      My problem is how to make the material A is alway ZEROS stock on hand and allow in sales order creation with ZEROS order qty?
    MATERIAL                                          QTY                             COST                                  SALES NET VALUE
           A                                                      0                                   0                                              1,500.00
           A1                                                    1                                  100.00                                           0
           A2                                                    1                                    50.00                                           0
    Thanks & Regards,
    Yong Kok Wah
    Edited by: Yong Kok Wah on Jan 27, 2010 11:16 AM

    As per your post,
    -  You are creating Main item which is a dummy material without any physical inventory maintained, but the pricing/billing should be done @ main item level.
    - here you are not dispatching main item, but billing should be carried at this level. in such case, I suggest you to go with the new sch.line cat w/o maintaining any mov type to it. & use Zitem category for this main item in VOV7, mark "Order qtty=1" so that min order qtty for this main item should be 1, so that you can calculate price.
    -  You want to capture Cost of sub items , summation of sub items cost is total cost of main item & Profit will be calculated accordingly.
    Sub items, sch.line category should have mov type, item cat should be not relevant for pricing & billing , but relevant for sch.lines. In Copy control from delivery - Billing @ item level, for the main item ,- item category, choose "Cumulate cost", so that cost of the sub items will be cumulated to main item.
    eg:
    MATERIAL QTY COST SALES NET VALUE
    A 0 0 1,500.00
    A1 1 100.00 0
    A2 1 50.00 0
    My problem is how to make the material A is alway ZEROS stock on hand and allow in sales order creation with ZEROS order qty?
    To avoid this, mark order qtty=1, in item category for main item, but for the same item, sch.line category should not have mov type. so that there will nt be any PGI document. But PGI should be done for sub items to capture inventory & cost.
    Test & revert, if any issues.

  • Quantity is different from sale order and delivery

    Hi,
    Gurus,
    Quantity is different from sale order and delivery.
    I identified the Material in the sales order, the item category for this material as BOM.
    I have also checked the bill of material display header overview. The Base Quantity maintained as 1000 EA3. The SUBITEM maintained in G in the unit field in bill of material display.
    Accordingly i have checked the same for material master's additionl data in Units of Measure tab, it is mentioned the basic unit as 1000 EA3 and alternative unit as 600 G.
    My client processed the order for 100 QTY. The QTY for the two sub item is 99.601 each in the sale order.
    My client Question is why in delivery the Material Qty is coming as 99.730 and the SUB ITEM is coming as 99.330 EACH.
    Note:- The material X is maintained in EA3 in Bill of material header overview. I do no how the sale unit came as G for the Material in sale order.
    The other two sub item is perfectly coming as G. Because it is maintained in G in the Bill of Material Display.
    Guide me GURUS.
    Thanks and Regards,
    ANAND

    Hello Rumar
    I guess you entered the text manually in the sales order. The Ship-to may not be having any text, but the Sold-to may be and it may be coming from sold to.
    In transaction VOTXN, check the access sequence for the text type id and see which one takes precedence - one from customer master or from the order by checking the order of accesses.

  • Sales order and Delivery difference

    I Am trying to write a query to produce totals of items ordered by customers compared to deliveries made. However there may be 3 deliveries made to one sales order and so my sales order total for an item is getting multiplied by 3 and showing a difference compared to the amount delivered where in fact the whole order has been delivered. How do I hold the sales order total per item once but then compare with the total delivery per item over multiple deliveries?

    Hi,
    Try this query for cost difference
    SELECT T0.ItemCode, T0.Dscription, Sum(T0.LineTotal) AS 'Order Value', ISNULL(Sum(T1.LineTotal),0) AS 'Delivered Value', Sum(T0.LineTotal) - ISNULL(Sum(T1.LineTotal),0) AS 'Lost Sales'
    FROM RDR1 T0 LEFT OUTER JOIN DLN1 t1 ON  T0.DocEntry = T1.BaseEntry AND T0.LineNum = T1.BaseLine and T1. BaseType = 17
    GROUP BY T0.ItemCode, T0.Dscription
    ORDER BY T0.ItemCode
    Replace my query with below query
    SELECT T1.[CardName]'CustName',T1.DocNum 'SOOrder',T1.[DocStatus]'SOStatus',T0.[Project]'JobNo', T0.ItemCode,T0.Quantity 'SOQty',T2.Quantity 'Delivered QTY',T0.OpenQty 'BalQty', T3.DocNum 'Delivery#',T3.[DocDueDate]'DelDate'
    From RDR1 T0 inner join ORDR T1 on T0.DocEntry=T1.DocEntry
       left join DLN1 T2 on T2.Basetype=17 and T2.BaseEntry=T0.DocEntry and T2.BaseLine=T0.LineNum
       left join ODLN T3 on T2.DocEntry=T3.DocEntry
    Thanks & Regards,
    Nagarajan

  • Valuation of item cost in Sales [Return and Credit Memo]

    Hi,
            Is there any way to get item cost affected in Sales [ Return and Credit Memo(with out copy from)] documents when item qty is Nill in respective warehouse, valuation method is FIFO

    Hi,
    Item cost is only linking to purchase or production. There is no link between sales and item cost.
    Thanks,
    Gordon

Maybe you are looking for