SAP Query: Current Stock and Stock Sold

Hi,
As SAP no longer supports XLReporter with SQL 2012 I am in the pain staking process of trying the same data as near to the previous XLReporter reports as possible. Crystal is not an option for all reports as mt co-workers like to manipulate reported data in excel.
I have one report (which I thought would be simple) that is to show the current stock level of all  item codes with a chosen prefix and then to also show of those item codes which have been sold between a given date range.
The version below shows all the important information but the way I am requesting the data suppresses some item rows where they have not been sold in the given date range:
SELECT T0.[ItemCode], T0.[ItemName], SUM(T3.[Quantity]) AS ' Qty Sold', T2.[OnHand]
FROM OITM T0
INNER JOIN OITW T2 on T0.ItemCode = T2.ItemCode
LEFT JOIN INV1 T3 ON T0.ItemCode = T3.ItemCode
WHERE (T2.[WhsCode] = '01' OR  T2.[WhsCode] = '01A') AND T0.ItemCode Like '[%0]%%' AND T3.DocDate > '[%1]' AND T3.DocDate < '[%2]'
GROUP BY T0.[ItemCode], T0.[ItemName], T2.[OnHand]
Order BY T0.[ItemCode]
I know I need to move all references to INV1 into a sub query of some description but my attempts this afternoon have made no progress.

Hi David...
Try This
SELECT T0.[ItemCode], T0.[ItemName], SUM(T3.[Quantity]) AS ' Qty Sold', T2.[OnHand]
FROM OITM T0
INNER JOIN OITW T2 on T0.ItemCode = T2.ItemCode
Inner JOIN INV1 T3 ON T0.ItemCode = T3.ItemCode
WHERE (T2.[WhsCode] = '01' OR  T2.[WhsCode] = '01A') AND T0.ItemCode Like '[%0]%%' AND T3.DocDate > '[%1]' AND T3.DocDate < '[%2]'
GROUP BY T0.[ItemCode], T0.[ItemName], T2.[OnHand]
Order BY T0.[ItemCode]
Regards,
Kennedy

Similar Messages

  • Custom Report for the Stock and Stock value for a specific date

    Hi SAP Gurus,
    Is there any SAP standard t-code or any logic to get the transcations (additions (for example: Purchases) and subtractions (Sales) to the inventory) for a particular materials in a plant and with Total Stock and also Total Stock value when that particular transaction happened?
    Our system is R/3 4.7
    I looked at the MB5B, MBCE, MBCA, MC44, MB51 and some other standard T-codes but could not find the total stock value at the time of Transaction happened.
    The history tables MBEWH and MARDH  are updated after the month end closing procedures, right, which means I will have the inventory value changing every month if material has Price "S".
    Thank you,
    -Harter

    Hi Harter,
    Unfortunately, you cannot see in a single tcode the value of stock and stock quantity on a specific date. As you yourself have pointed out, we only have to make use of the history table MBEWH, MARDH for the month wise stock quantity and value. Along with that you should also make use of the table MBEW to take teh stock quantity and value. So the total value of stock on a particular date will be
    Stock qnty = MBEWH value until the previous month (for teh specific valuation class, period etc) + MBEW value for the present date.
    But this will nto work out if you want to find out teh stock quantity and stock value on a past date basis. For past data, only  m onthwise data is available. For this anyway you can refer to MC.1 and so on reports.

  • Negative stock and Stock below safety stock

    Hi,
    Both negative stock and stock below safety stock create procurement proposals - internal or external.
    But what is the difference between them?
    Thanks in advance.

    Hi,
    NEGATIVE STOCK:
       Negative stock function used when you want to post Goods Issue quantity that larger than the book quantity.
    For example: you have stock of material A000 = 90 qty and you want to Goods Issue with 100 qty.
    Negative stock function is not relevant for the procurement, It can only use for the excess qty issue to to the production than stock qty. System will not create PR .
    You need to do configuration setting to use this function.
    Cust: In customizing negative stock are must allow for a valuation area, Plant and Storage location level.
              In addition you can set the special stock at plant level such as
    Consignment
    Material provided to vendor
    consignment stock at customer
    sales order stock
    project stock
    returnable packaging with customer
    returnable transport packaging
    Application: The indicator for negative stock is with the storage data in the material master mast be maintained.
    Note: It is possible for unrestricted use and blocked stock only.
    With the standard price, There are no special features to the negative stock. But with the Moving average price , a price diff account can be posted to when goods are received.
    STOCK BELOW SAFETY STOCK.
    The Safety stock should cover any excess material consumption that may occur during the replenishment lead time as well as the normal requirements when deliveries delayed.
    The Safety stock is therefore part of reorder point.
    You do not required any special setting to use safety function. Just need to maintain the safety stock level in the material master.
    If stock reduce below safety stock, system will create procurement  proposal i.e Planned order or Purchase requisition.
    I hope it will clear your query.
    Ashish Panchal

  • On order Stock and stock in transit with date variable

    Hi experts.
    İt may be an easy question.
    We need to see  on order stock (menge,can be seen T code MMBE) and stock in transit(T CODE MB5T) with date variable.
    Any T code or table...?
    I mean that  for exp: on order stock and sttock in transit  on 02/02/2012..
    Thanks in advance..

    Hi,
    as per my knowledge you have to develop report using following table
    how many Po closed for material
    how many MIGO happens and how many remain etc
    table EKPO
    EKKE
    EKBE
    MSEG
    MKPF
    [Report|http://wiki.sdn.sap.com/wiki/display/ERPLO/SAPStandardReports]
    [tables req to get date wise stock report;
    Regards
    Kailas Ugale

  • SAP QUERY using ASSHR and ASSOB tables

    We currently have SAP query that reports on additional payments (Info type 0015).  The user wants to report the cost center held on the cost assignment (Tables ASSOB and ASSHR).
    The existing query uses infoset created using PNP logical database. 
    How do I add or join the ASSOB and ASSHR tables to Info type 0015 to report the cost center?
    Thanks in advance
    Shamshudin

    Hi Sham
    You may need to create custom fields in the infoset and create some code to pull out and display details from ASSHR and ASSOB corresponding to the ifnotype record.

  • Inventory:Transaction in ECC for displaying Total Stock and Stock value

    Hello Experts,
    I have ran the report on BW side which gives me Inventory's Total Stock (ZTOTALST) & Stock Value(ZSTDPRICE) period wise.
    I want to reconsile data between ECC & BW for these two fields, please provide me trasactions for the same.
    I have material num & Plant for input.
    I want  to see the ZTOTALST & ZSTDPRICE value period wise in ECC.
    Thanks in Advance.
    Regards,
    Yash.

    Hi,
    Check in MB5B and MC.9 Tcodes in ECC.
    Note: select Valuated Stock in ECC and gibe Date Ranges also
    Thanks
    Reddy

  • SAP Query (SQ01) - create and save queryies

    Hi Expert;
    We wanted to implement SAP query reporting (SQ01) tool, and already developed custom HR infoset and user groups and transported to QAS.  We experienced the problem that we can not directly "save" any queries in SQ01. We pretty much have the client opened up and set at "Changes without automatic recording".  But keep getting a "transport object create" dialog upon "save" query.  But in Adhoc (PQAH), we don't encounter same problem.    We wanted our users be able to create and save any queries directly without creating any local objects. Is there another setting that needs to be set? 
    Thanks for any information that you can provide.  Points will be awarded.
    Helen

    Hello Helen,
    in SQ01 you can save queries like in HR Ad Hoc Query (or Infoset query as it is called outside HR).
    However this is only possible in the "Standard Area" not in the "Global Area". However as Ad Hoc Query is based on the SQ0x basics it only hides this effect.
    If you are doing HR specifics you should consider the documetnation on the special HR switches:
    http://service.sap.com/~form/sapnet?_SHORTKEY=01200252310000076208&
    In general if you are new to the topic you should consider the courses BC407 for Query Basics and HR580 for reporting in HR.
    Also to get a feeling for the different types of reporting with the InfoSet Query you can look at the following documentation:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/a8/2e7237a323427ee10000009b38f8cf/frameset.htm
    HR Reporting Tools -> Sap Query -> InfoSet Query -> Calling InfoSet Query.
    Or you can book a special training if you need a contact let me know your email adress
    Best regards,
    Michael

  • SAP Query (SQ01) who and when to use the report

    HI Experts!!!
    Is there somewhere recorded information:  who and when to use the report from SAP Query (SQ01)?
    Thanks

    Hi
    This topic doesn´t belong to the Service Marketplace Area.
    regards Martin

  • Integrate Sap Query into ESS and MSS

    Hello
    I have been following this http://scn.sap.com/docs/DOC-50736;IDSactivation=99FDF6E06B5918D0293BF0BE7884FBCB0606A0F376FFD7908517BA7F2738E3A6
    for the intergration of SAP Query.
    However i am getting stuck at step 6 as it appears RP_MSS_CONVERT_MDT_TO_LPD_CUST
    does not exist and ideas what i am missing.
    So i have had to convert my MDT scenario using PWPC_CONV_MDT_TO_LPA
    From there i have then been able to run program APB_LPD_LPA_CUST_TO_LPD_CUST
    which has converted it into a launchpad in LPD_CUST, however once there it has no system alias defined for my applications so they won't launch and the launchpad entries for managers desktop don't give me a system alias option.
    Regards
    Adam

    Hi Adam,
    what release are you on? Do you use any Add-ons? The document you are following is written for EHP6, and I think MSS Add-On 1.0 is also needed as this add-on brings the WD ABAP applications for MSS.
    The report you don't have in your system is located in the WDA specific package for MSS, so I think it comes with the Add-on. The transaction you use for launchpad generation is the "old" one, that can be used from Enterprise Portal. Inside portal, you have a launchpad iView with properties for the scenario and the system alias.
    Do you have a possibility to install MSS Add-On 1.0? This should solve your problem and let you follow the guide.
    Regards,
    Marc

  • SAP HANA Current Revision and how to update

    Hi All,
    I would like to know how we can check the current HANA IMDB server revision version, are there are specific Linux commands to check the revision on the HANA IMDB server? Also I would like to take your inputs to learn how to update the revision for HANA server. Can this be done using the HANA unified installer?
    Thanks for the help.
    Thanks and Regards,
    Archana

    Hi Vitaliy,
    Thanks for the inputs, thats very helpful. The HDB version command gives the HANA version and revision details. Currently we are on HANA 1.0 SP3 Revision 20 and looking forward to upgrade to Revision 21.
    Thanks for the link on the upgrade guides, I had read through it previoulsy but have some questions.
    The SAP Note  u201C1653292 - SAP HANA appliance: Revision 21 of SAP HANA databaseu201D mentions:
    u2022  For the installation and update procedure of the SAP HANA appliance software and its core components (incl. SAP HANA database), see the SAP HANA Automated Update Guide https://service.sap.com/~sapidb/011000358700000604952011
    I would like to know if the only way to update the HANA revision from 20 to 21, is to follow the steps in the HANA automated update guide and set up the components for automated update, then do a revision update?  Is there a manual way to do it, but none of the HANA guides mentions how to manually download a specific revision package from SAP service maket place and update the revision version. Please let me know if I missed any guide that talks about this?
    Thanks for the help.
    Thanks and Regards,
    Archana Kuppuswamy

  • Link between batch stock and stock transport order no.

    hello all,
    my client want the report for stock in hand against batch and sto no..in standard tcode mb52(stock in hand) we can see the stock against batches.but i want the report for which sto no. stock is recieved corresponding to batch.
    pls tell me from which table and field i should pick data for stock against sto no.
    thanks in advance for ur valuable input
    regards
    simran
    caution-- we are using two step procedure with stock transport order for transferring the material between plants

    S

  • Discrepancy between IM stock and WM Stock

    Hi experts,
    We found there is discrepancy between IM stock and WM Stock.Before configuring WM storage types , IM Stocks are not syched. So WM stocks are showing less then IM stocks,. Now i need to synch up the IM stock and WM stock. what we needs to do. Can you please guide us.
    Thanks & Regards,
    Vamsi

    OR
    have a look at using transaction LX23 (provided you dont use HUM this should help you determine/ analyse and post any differences between IM and WM).
    thanks,
    A
    LX23: Stock Comparison Inventory Management / Warehouse Management
    Description
    Using this report you can generate an inventory comparison between the IM System (Inventory Management) and the WM System (Warehouse Management).
    On the selection screen, you can limit the area for comparison by entering the plant / storage location, plant / warehouse number or only the warehouse number.
    In addition to specifying the area, you can also determine the extent of information to be issued.  Here you have three options:
    1. "With bin inventory"
    In addition to generating the corresponding stock figures, you can also have a list of the corresponding WM bin quantities included.
    2. "All data on material"
    Even if only one difference occurs in one of the listed combinatations of material / batch / special stock indicator / supplier, all material combinations are listed. This can be very helpful when searching for errors.
    3. "Clear differences"
    If you mark this field, the system will generate a batch input session. By starting the batch input session, the differences to be cleared are removed in the IM system.  Negative WM stock figures and stock differences in returns will not be cleared.
    If you want to have a batch input file generated for the purpose of clearing the differences, it is important, for consistency reasons, that the materials in the respective warehouse are blocked in order that postings affecting stock figures can be prevented.
    CAREFUL: If you generate this session, all the material stocks belonging to the respective warehouse number are blocked completely, that is, for the duration of the program, no postings affecting the stock in the warehouse will be possible!
    Prerequisites
    The comparison is also possible for warehosue numbers managed on a decentralized basis.
    Output
    You receive a list with various materials. The list contains the following information, for example:
    The first line contains the plant, storage location, warehouse number, material number, total stock in inventory management, total stock in the warehouse, and the difference between the stocks.
    The following line contains the first combination of batch / special stock indicator / supplier (or sales document and item number for sales order stock) and stock category (Q,R,S, ), the stock figures in Inventory Management, in Warehouse Management, and the difference.
    If a batch input session is to be generated, the list contains a note in the log as to whether or not a session has been generated or behind the pushbutton "non-postable stocks", which materials could not be cleared because of negative stock figures or because they belong to returns stock.
    Edited by: WILSAQ on Aug 11, 2009 12:09 AM

  • ABAP Coding Help for Subtotal type output - SAP Query

    I've created a SAP Query to display a stock overview by storage type using the table LQUA.
    The output that I get is:
    Material
    Description
    Plant
    WHN
    SLOC
    Storage Type
    Batch
    GR Date
    Available stock
    2057 
    STRAWBERRIES
    BP01
    100
    0088
    200
    0001081766
    17.06.2014
    225
    2057
    STRAWBERRIES
    BP01
    100
    0088
    200
    0001081766
    17.06.2014
    720
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    1,000
    I can get a subtotal for each Material, batch and GR date combination by using the ALV grid functionality.
    This method adds too much clutter to my query and can't be easily manipulated in Excel afterwards for what I want. I want to condense the results down and just keep a cumulated available stock, e.g:
    Material
    Description
    Plant
    WHN
    SLOC
    Storage Type
    Batch
    GR Date
    Available stock
    2057 
    STRAWBERRIES     
    BP01
    100
    0088
    200
    0001081766
    17.06.2014
    945
    2061
    VOSTIZZA CURRANTS
    BP01
    100
    0088
    200
    0001081272
    17.06.2014
    4,000
    How can this be done?

    Hi,
    Please try to use STATISTICS in your SAP Query. you can sort and add your value based on condiiton then it will be show you collect value in SQ01.
    Please see the below documents for STATISTICS
    https://help.sap.com/saphelp_erp2004/helpdata/en/d2/cb4263455611d189710000e8322d00/content.htm
    Regards,
    Prasenjit Mishra

  • SAP Query(SQ01) need to be transported

    Hi All,
    I want to transport a tcode which is using SAP query. Now I am able to send the tcode to other system but when I go to SAP query under queries and standard query area I am not able to see the version management details. I also tried going to the SAP query report through double clicking on the report name under SE93, and when I am into the report it also does not show any version details. It says "No version found".
    What I am thinking is just get the active request number from the version management and transport it to the other system.
    Can anyone of you tell me how to transport a SAP query.
    Thanks,
    Mahen

    Hello everyone,
    I am having problem in fixing this up. Let me tell you all what I have done.
    I first transported the tcode from souce system to target system.
    Because I transported the tcode so in the target system. Tcode has the report/program name as it is existing in the source system.
    Now when I transported the everything like user group, infoset and the query, I was able to see them in the target client. I tried to run the tcode.
    Tcode does not run, It says there are inconsistensies in the tcode.
    I tried to trouble shoot the problem. I found that when I was trying to run the tcode it was not able to find the report/program.
    What I did was, I generated the program for SAP query existing in the target client.
    When program was generated, I observed that It is different with the one that is currently existing for the tcode in the target client.
    This is the main problem report name are different. When I see in the se93 report name is the old one which I transported from the source system for the tcode, but when I see the report name for the SAP query by going into SQ02 it is coming different. I want to know when you create the program name for the SAP query, On what basis is the namespace of the program generated.
    SAP query program name existing for the tcode and in the source system and also in the target system(When you see it in se93) is :
    AQ01FI==========ZBSAK_LFB1====
    SAP query program name when I generated it in the target client is :
    AQFKFI==========ZBSAK_LFB1====
    Bythe way the query name is ZBSAK_LFB1
    Kindly throw some light on this.
    Thanks,
    Mahen

  • Create documentation for sap query

    Hello,
    I have created a sap query with sq01 and I want to create also documentation for it.
    I go from se38--> select the program and then change documentation,
    but the documentation button is grey.
    Thank you!

    Hi,
    Check this below link
    http://help.sap.com/saphelp_nw04s/helpdata/en/4f/83a6302fe1403db4289e2ac60b800a/frameset.htm
    Regards,
    Jyothi CH.

Maybe you are looking for

  • Problem with Unlocked 6131

    hi all, i unlocked the secure-element of 6131phone and in the previous months i am using this phone for installing, deleting and accessing the cardlets inside the phone. But accidentally i tried several times through a java program to access the secu

  • Want to export my video as 320x240 but having problems.

    Hi I'm using adobe CS5. I need to export my video as a flv video and the dimensions of the video have to be 320x240. Whenever I'm about to export the video, I check the "Resize Video" box and change the dimensions and export it. However, whenever  I

  • Adapter Administration and Monitoring - AAM in SP17

    I'm trying to use apis that are listed in this new AAM module in SP17 and I cannot find this directory in my xi system - <serverDir>/j2ee/cluster/server0/bin/services directories in this path are com.sap.aii.af.service.administration.api API is parti

  • Is it possible to change the home button location in the navigation bar?

    The Home button is in an inconvenient location and I would like to move it to the left side of the navigation bar.

  • RReport landscape printing

    Hallo, I know this is not exactly java, but since in many threads here RReport is recommended, here is my question: I have created a rep file that has width of 297mm and want to print it ISOA4 landscape. Initially no matter what I told the printer in