Item Query by onhand/QTY Sold in last week/month/QTY

I am trying to create a query showing items that are in a particular warehouse and then how many of that item has been sold over the last week/month/quarter.
I have got the following query started,but i am unsure to group can anyone help with this
SELECT T0.[ItemCode], T0.[ItemName],T1.[OnHand],   T0.[IsCommited],  T0.[MaxLevel], T0.[MinLevel], T2.[Quantity]
FROM [dbo].[OITM]  T0 INNER JOIN OITW T1 ON T0.ItemCode = T1.ItemCode INNER JOIN INV1 T2 ON T0.ItemCode = T2.ItemCode
WHERE T1.[WhsCode] = '01'

I am trying to create a query showing items that are in a particular warehouse and then how many of that item has been sold over the last week/month/quarter.
I have got the following query started,but i am unsure to group can anyone help with this
SELECT T0.[ItemCode], T0.[ItemName],T1.[OnHand],   T0.[IsCommited],  T0.[MaxLevel], T0.[MinLevel], T2.[Quantity]
FROM [dbo].[OITM]  T0 INNER JOIN OITW T1 ON T0.ItemCode = T1.ItemCode INNER JOIN INV1 T2 ON T0.ItemCode = T2.ItemCode
WHERE T1.[WhsCode] = '01'

Similar Messages

  • Check condition for last week

    Hi,
    I have a table in which records are stored according to datewise. I want to filter records for last week as per sysdate. For ex, today is thursday and i want to see records which had come in between Monday to Sunday last week.
    Please help me out here.
    Himanshu

    Hi,
    Here is the query to get first day of last week , last day of last week
    SQL>SELECT TO_CHAR((sysdate - to_char(sysdate,'D')),'DAY') LAST_DAY_OF_LW ,
           TO_CHAR((sysdate - to_char(sysdate,'D')) - 6,'DAY') FISRT_DAY_OF_LW,
      2    3         TO_CHAR(sysdate,'DAY') TOday
      4  from dual
      5  /
    LAST_DAY_ FISRT_DAY TODAY
    SATURDAY  SUNDAY    THURSDAY
    1 row selected.Note: Sunday = 1 and Saturday = 7
    Regards

  • Please help to get onhand stock report with last purchase and billed date warehouse and item wise

    please help to get onhand stock report with last purchase and billed date warehouse and item wise

    Hi Rajeesh Ambadi...
    Try This
    SELECT distinct T0.ITEMCODE , t1.ItemName, T0.ONHAND as 'Total Qty',  
      T1.LASTPURDAT ,t1.LastPurPrc
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD left join ibt1 t3 on t3.itemcode = t0.itemcode and t3.whscode = t0.whscode
    WHERE
    T0.ONHAND>0
    AND T0.WhsCode ='[%0]'
    Hope Helpful
    Regards
    Kennedy

  • Query to show items not used in last 12 months

    Can anyone help with a query or is there a was in B1 to pull a report of item that have not had activity in the last 12 months?

    I drilled into one item that I knew we are still using. The date on my inactive report was 01/01/07. This is what was displayed in inventory posting.
    Posting Date     Document     Whse     Qty     Price after Disc.     Balance
    210070                         1,329
    1/2/2008     SO 3133     1     -560     $0.05      769
    1/29/2008     ST     1     231     $0.05      1,000
    1/31/2008     SO 3231     1     -585     $0.05      415
    1/31/2008     SO 3235     1     -415     $0.05      
    2/7/2008     PD 2898     1     5,500     $0.00      5,500
    2/8/2008     SO 3261     1     -642     $0.00      4,858
    2/12/2008     PU 6801     1          $249.98      4,858
    3/10/2008     SO 3429     1     -1,281     $0.05      3,577
    3/19/2008     SO 3520     1     -1,335     $0.05      2,242
    3/28/2008     PD 3065     1     5,500     $0.05      7,742
    4/3/2008     PU 7204     1          ($0.27)     7,742
    4/16/2008     SO 3756     1     -1,308     $0.05      6,434
    5/2/2008     SO 3884     1     -1,265     $0.05      5,169
    5/5/2008     SO 3946     1     -1,368     $0.05      3,801
    7/10/2008     SO 4494     1     -643     $0.05      3,158
                             3,158

  • WIP Assy Completion -The onhand qty is zero for the selection criteria ente

    Hi,
    I am trying to do a Work Order-Less completions with Transaction Type as 'WIP Assy Completion', the assembly items are not serial and lot controlled.
    When i am trying to save it, it throws an error as 'The onhand qty is zero for the selection criteria entered'.
    Please suggest.
    Thanks

    Do you have onhand quantity for the components under that assembly?
    Thanks
    Nagamohan

  • Data Migration from 11i to R12 Global - Open POs,lines, receipts & on hand upload, Is it possible to do the onhand qty upload with over riding of all receipts which uploaded against Open PO lines?

    Hi Friends,
    We are in a phase of data migration from 11i to R12 
    I was discussed with client & they wants extraction of all open POs which was generated after 01 Jan 2014 to till date in 11i.
    Condition for open POs is PO qty-received qty=>0
    critical Example for open PO is :PO no: 10 has 4 lines, 3lines full qty has been received & for 1 line partial qty(say 50 out of 100) received.
    in this case he wants in R12 uploading as PO no:10 should entered as open PO with all 4lines & 3 lines complete receipt should be done, for 4th line partial qty i.e 50 should be received.
    the question is if we upload on hand qty first, then open POs & receipts, it will increase the onhand qty in new system(mismatch of on hand qty's 11i to R12) 
    Is it possible to do the onhand qty upload with over riding of all receipts which uploaded against Open PO lines.
    Or Please advice best solution.
    Thanks & Regards
    Giri

    adetoye50 wrote:
    Dear Contacts Journal Support Team,
    FYI, this is a user to user support forum.  You are NOT addressing Apple here.
    Honestly, I doubt anyone is really going to take the time to read the novel you have written.

  • Creation of a Query to show the values for the current month and the last 12 months data.

    Dear All,
    Good day!
    I have to create a Query with the below requirement.
    I have to create a Query to show the values for the current month and the last 12 months data.
    Can you please guide me how to achieve this ??
    thank you,
    Regards,
    Hema

    Hema
    explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
    you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
    for some more hints..
    http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
    http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
    http://scn.sap.com/thread/3217381
    search on SDN you will get many other ways..
    Thanks,
    Bhupesh

  • Query to get all minutes in last one hour

    Dear All,
    I am trying to write a query that returns every minute in last one hour.
    Like now, if the time is 4:15
    The query returns;
    3:14
    3:15
    4:11
    4:12
    4:13
    4:14
    4:15
    Please suggest a logic.
    Thank you so much.
    Regards, Imran

    You can also add or subtract INTERVAL literals to or from a DATE, for example:
    SYSDATE - INTERVAL '5' MINUTE
    The result is a DATE.
    Frank @ Getting the hour,seconds and minutes of a date data
    Regrads
    Girish Sharma

  • Microsoft Project Server 2010 - Need a query/report to show everyone who did not submit timesheet last week

    I need to create a MSPS 2010 query/report to send out to my project managers that show them everyone who did not submit their timesheet for the previous week.  I would like to be able to filter it by project/client but would settle for just a list
    of all unsubmitted timesheets at this point.  Every link I have found point to old reports for MSPS 2007 and the queries do not work because of schema changes between MSPS 2007 and 2010.  Please help!

    Thanks Elli!  Is there any way to also pull in the active resources that have not created a timesheet in the timeframe I am filtering on as well?
    Here is the query I had came up with.  Looks like I was on the right track...  I did two actually.  First one to give me a roll up list of employees with outstanding time sheets for last week and the hours, then the same data with an explosion
    by employee by project and also pull in their associated time sheet manager:
    --Everyone with an timesheet for last week where status  is not 'Approved' or 'Submitted'
    SELECT DISTINCT
            CONVERT(varchar(10),b.StartDate,1) + ' - ' + CONVERT(varchar(10),b.EndDate,1) as [Timesheet Date]
          , [ResourceName]
          , [TimesheetStatus]     
          , SUM([ActualWorkBillable]) as [Hours Entered]
      FROM 
        [dbo].[MSP_TimesheetLine_UserView] a
      , [dbo].[MSP_TimesheetPeriod] b
      WHERE
          a.PeriodUID = b.PeriodUID 
      and [TimesheetStatus] NOT IN ('Approved', 'Submitted')
      and DATEADD(dd,-7,GETDATE()) BETWEEN b.[StartDate] AND b.[EndDate]
      GROUP BY 
        b.[StartDate]
      , b.[EndDate]
      , [ResourceName]
      , [TimesheetStatus]
    GO
    --Everyone with an timesheet for last week where status  is not 'Approved' or 'Submitted' w/ Project/Customer explosion
    SELECT
     CONVERT(varchar(10),b.StartDate,1) + ' - ' + CONVERT(varchar(10),b.EndDate,1) as [Timesheet Date]
    , r.ResourceName AS [Resource Name]
    , [TimesheetStatus]     
    , [ProjectName]     
            , ([ActualWorkBillable]) as [Hours Entered]
    , isnull(rm.ResourceName,'<No Timesheet ManagerInformation Available>') AS [Timesheet Manager]
    FROM
          dbo.MSP_EpmResource_UserView r 
     LEFT OUTER JOIN
          dbo.MSP_EpmResource_UserView as rm 
       ON r.ResourceTimesheetManagerUID = rm.ResourceUID
    ,[MSP_TimesheetLine_UserView] as a
    ,[MSP_TimesheetPeriod] as b
    WHERE
          a.PeriodUID = b.PeriodUID 
      AND a.ResourceUID = r.ResourceUID
      AND  [TimesheetStatus] NOT IN ('Approved', 'Submitted')
      AND  DATEADD(dd,-7,GETDATE()) BETWEEN b.[StartDate] AND b.[EndDate]
      AND (r.ResourceIsActive = 1)
      AND (r.ResourceType = 2)
      AND (r.ResourceIsGeneric = 0)
    ORDER BY 
       r.ResourceName
     , ProjectName
    GO

  • UDF in item query form

    Hi,
    How to add a UDF to the ' item query' form.
      (Inventory->Inventory Reports->Item query)
    Thanks,
    Smitha

    Smitha,
    If you are talking about the SELECTION screen where you enter Item Number, ...... it would not be possible.  But if you want to add the UDF to the List of Items screen.
    Click on Form Settings from this screen and in the Field Name drop down select your UDF
    Suda

  • SQL query to get last 6 months records neglect the current month

    Hi All;
    I need help with 
    sql query to get last 6 months records neglect the current month
    Any help much appreciated
    Thanks
    Pradnya07

    SELECT <> FROM tbl WHERE dt >=dateadd(month,-6,GETDATE())
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Query on 0TCT_MC01 to get the last used date of a query

    Dear All,
    I tried to create a query on 0TCT_MC01 to get the last used date of a query.
    Since we do not have readily available key figure for Last used date, could any one help me out to achieve this result?
    I am interested to find the old queries which are not being used anymore.
    Thanks in advance.

    You can get the info from the below tables
    if you are working with BW 3.5 you can look in table RSDDSTAT in BI 7.0 it is RSDDSTAT_OLAP.
    Make a selction on the infocube and the OLAP Statistic Object which is the query ID and execute. Then you should see how often the query was executed, by whom and which date/time.
    in field Statistics Object Name Query ID you type in the tech name of the query
    from the Counter for statistics event calls -- will give the count... no of times the query used least the count lesser the query is used.
    Regards
    KP
    Edited by: Konduru Prashanth. on Dec 22, 2011 2:44 PM

  • How to force Work Item Query Policy to refresh its cached query results?

    I have enabled the Work Item Query Policy on my TFS project.  It works as expected, except when using Visual Studio 2013 with the following sequence of steps:
    User selects Check in Pending Changes from the Source Control Explorer
    User enters in the ID of the work item to be associated to the changeset
    User clicks the Check In button
    Work Item Query Policy displays message ' Work item ##### was not found in the results of stored query...'
    User realizes his mistake, and modifies (and saves) the work item so that it is returned in in the query result set
    User clicks the Check In button again expecting the TFS policy to accept the association
    Work Item Query Policy still displays message ' Work item ##### was not found in the results of stored query...'
    Removing the Work Item and re-associating it does not make a difference.  The only workaround that I have found is to close Visual Studio and reopen it.  Does any one have a better solution than this?

    Our setup is different from the one you are using:
    - User is using VS 2013 Update 4.
    - We are running TFS 2010 SP1
    The test case that you described is different from the one that is causing my problem (that scenario works fine for me as well).  I am trying to associate the check in to the same work item both times; whereas, you are associating it to a different
    work item the second time.  I can consistently reproduce the error using the following steps:
    1) Create a query that returns All Bugs in Active state, and set it as the query for the Work Item Query Policy
    2) Create and save a new Bug
    3) Run the query to confirm that the new bug does not appear in the result set
    4) Checkout a file, modify it, save it
    5) Check in the file and associate it to the bug from step 2)
    - the Work Item Query Policy will issue an error message saying that the work item cannot be found in the associated query
    6) Change the state of the bug to Active, and save
    7) Refresh the query to confirm that the bug now appears in the result set
    8) Check in the file again
    - error message from step 5) will not go away

  • Misplaced publication item query of two different publication itens

    Hi,
    I’m creating a new publication on Oracle Database Lite 10g.
    Almost all of the publication itens are ok, except two of then: when I publicate the “item1” ,the publication item query is rightly displayed on Mobile Manager page and in the administratives tables, as the C$ALL_PUBLICATIONS table. But, when I publicate the “item2”, that is rightly displayed on Mobile Manager site too, the query of the “item1” receives the same value of “item2” query.
    I’ve just checked for wrong synonym creation of the two tables involved , but they are correct.
    Has anybody ever seen something like that?
    An example of my two queries:
    Publication item1 : select field1 , field2 , field3 from table2 where field4 = 1
    Publication item2 :; : select field1, field2 from table1;
    It’s important : I have two different tables above.
    When I synchronize the PDA , with this publication assigned to the user, I receive an error message on Mobile Manager page that some field is misplaced or required . In other words: for publication item2 the application tries to put the data returned from the query of publication item1 .
    Thanks.

    Hi,
    The publication was created successfully and the type is “WCE”. I created it using the “Mobile Manager” page, with an .xml file , compressed in the .jar format.
    Here is the web.xml file:
    <?xml version = '1.0' encoding = 'WINDOWS-1252'?>
    <workspace>
    <application name="WCE_REGRAS">
    <app_info>
    <directory>/WCE_REGRAS</directory>
    <virtualpath>/WCE_REGRAS</virtualpath>
    <defaultpage/>
    <icon/>
    <description>WCE_REGRAS</description>
    <publication/>
    <platform>Oracle Lite PPC2000 ARM;US</platform>
    </app_info>
    <app_db publication="AFV"/>
    <snapshot name="REGIONS" owner="HR" order="1">
    <snaplatform object="TABLE" platform="ORACLE LITE PPC2000 ARM;US" template="SELECT * FROM HR.REGIONS" updatable="Y" conflict="client" refresh="fast" virtualprimname="" virtualprimcolname=""/>
    </snapshot>
    </application>
    </workspace>
    The publication item with weight equals to 1 (default) was deleted . I’m using an Java application to publicate the items an add them to the publication ( in this case, “WCE_REGRAS”)
    Some publication items will have the “conflict rule” set to “Client Wins” and the other ones will be set to “Server Wins”.
    Here is the .xml code that my java application reads to create the publication items that are wrong:
    Publicationitens.xml
    <app>
         <repository>
              <connectionString><!--THE CONNECTION STRING--></connectionString>
              <user><!--THE USER--></user>
              <password><!--THE PASSWORD--></password>
         </repository>
         <remoteDB>
              <connectionString><!--THE CONNECTION STRING--></connectionString>
              <user><!--THE USER--></user>
              <password><!--THE PASSWORD--></password>
         </remoteDB>
         <localDB>
              <connectionString><!--THE CONNECTION STRING--></connectionString>
              <user><!--THE USER--></user>
              <password><!--THE PASSWORD--></password>
         </localDB>
         <publication>     
              <name>15571</name>
              <virtualPath>/WCE_REGRAS</virtualPath>
              <deviceType>WCE</deviceType>
              <!--CLIENT WINS-->
              <item>
                   <type>local</type>
                   <name>RGE_SAFV_ATIVIDADE</name>
                   <owner>SC_PDA</owner>
                   <object>AFV_ATIVIDADE</object>
                   <filter>SELECT "COD_TIP_ATIV","DAT_ATIV","COMENT_ATIV","STATUS_ATIV","COD_ATIV_PRIOR","DSC_ATIV","COD_FUNCIO","COD_FUNCIO_RESP","COD_ATIV_SIEBEL","COD_CLI","COD_ATIV","COD_FUNCIO_ENC" FROM SC_PDA.AFV_ATIVIDADE WHERE COD_FUNCIO_RESP = :COD_FUNCIO AND STATUS_ATIV IN ('A', 'E')</filter>
                   <weight>26</weight>
                   <action>create</action>
              </item>
              <!--SERVER WINS-->
              <item>
                   <type>local</type>
                   <name>RGE_SAFV_ATIVIDADE_PRIO</name>
                   <owner>SC_PDA</owner>
                   <object>AFV_ATIVIDADE_PRIO</object>
                   <filter>SELECT "COD_ATIV_PRIOR","DSC_ATIV_PRIOR" FROM SC_PDA.AFV_ATIVIDADE_PRIO</filter>
                   <weight>8</weight>
                   <action>create</action>
              </item>      
         </publication>     
    </app>
    In this case the connection string, password and user were omitted form the .xml file.
    In my Java application the following code creates and associate the publication itens to the publication :
    Consolidator.createPublicationItem(connSie, item.getName(), item.getOwner(), item.getObject(), "F", item.getFilter(), null, null);
    Consolidator.addPublicationItem(publication.getName(), item.getName(), null, null, "S", null, item.getWeight());
    , where the object “item” is populated with the publicationitens.xml file with a loop statment .
    This code works ok to the others publication items.
    The problem is : in the administrative tables ( like C$ALL_PUBLICATIONS) the publication string (filter – sql statement) is right. But, when I access the “Mobile Manager” page they are misplaced:
    the filter string from “RGE_SAFV_ATIVIDADE” receives the same filter of “RGE_SAFV_ATIVIDADE_PRIO”.
    Curiously when I delete the “RGE_SAFV_ATIVIDADE_PRIO” publication item , the filter string of “RGE_SAFV_ATIVIDADE” publication item appears correctly in the Manager page.
    I ‘ve just deleted the "RGA_SAFV_ATIVIDADE_PRIO" publication item using my Java application , or by database : I dropped tables, views and triggers that are created by “Consolidator” (java .jar) methods. I created this item again , but the same error occurs.
    I think that it may be something with the data integrity in the database.
    The mobile database is 10g, version 10.2.0.2 ;
    Thanks.

  • User Exit for line item query

    HI There,
    I'm not good at ABAP coding and need some help from experts.
    Working on Line Items Query and enhanced the 0FI_AP_4 to include fields from BSEG table, the fields are:
    GEBER - Funds
    FISTAL - Funds Center
    KOSTL - Cost Center
    GSBER - Business Area.
    I used the below code to enhance the datasource 0FI_AP_4, and its taking toooo long to load the data, but its pulling the line item data into BW.
    Please find another code after this....its very quick, either in extract checker or loading into BW, however its not loading all fields into BW. Specially line items like Cost Center, Fund center and Fund fields.
    Please go through the below codes and suggest me what changes i have to make to work as it should be.
    DATA: L_TABIX LIKE SY-TABIX.
    DATA: ZADTFIAP_3 LIKE DTFIAP_3.
    CASE I_DATASOURCE.
    WHEN '0FI_AP_4'.
    LOOP AT C_T_DATA INTO ZADTFIAP_3.
    L_TABIX = SY-TABIX.
    SELECT SINGLE GEBER FROM BSEG INTO ZADTFIAP_3-GEBER
    WHERE BUKRS = ZADTFIAP_3-BUKRS AND GJAHR = ZADTFIAP_3-FISCPER+0(4).
    SELECT SINGLE FISTL FROM BSEG INTO ZADTFIAP_3-FISTL
    WHERE BUKRS = ZADTFIAP_3-BUKRS AND GJAHR = ZADTFIAP_3-FISCPER+0(4).
    SELECT SINGLE KOSTL FROM BSEG INTO ZADTFIAP_3-KOSTL
    WHERE BUKRS = ZADTFIAP_3-BUKRS AND GJAHR = ZADTFIAP_3-FISCPER+0(4).
    MODIFY C_T_DATA FROM ZADTFIAP_3 INDEX L_TABIX.
    ENDLOOP.
    ENDCASE.
    Below code is extracting data very quickly but not bringing data for all fields specially line items like Fund Center, Cost center and Fund fields.
    DATA: L_TABIX LIKE SY-TABIX.
    DATA: ZADTFIAP_3 LIKE DTFIAP_3,
    wa_bseg Like bseg.
    CASE I_DATASOURCE.
    WHEN '0FI_AP_4'.
    LOOP AT C_T_DATA INTO ZADTFIAP_3.
    L_TABIX = SY-TABIX.
    Select single * from
    bseg into wa_bseg
    where BUKRS = ZADTFIAP_3-BUKRS
    and GJAHR = ZADTFIAP_3-FISCPER+0(4)
    and BELNR = ZADTFIAP_3-BELNR
    and BUZEI = ZADTFIAP_3-BUZEI.
    IF SY-SUBRC = 0.
    Move: wa_BSEG-GEBER to ZADTFIAP_3-GEBER,
    wa_BSEG-FISTL to ZADTFIAP_3-FISTL,
    wa_BSEG-KOSTL to ZADTFIAP_3-KOSTL,
    wa_bseg-GSBER to ZADTFIAP_3-GSBER.
    ENDIF.
    MODIFY C_T_DATA FROM ZADTFIAP_3 INDEX L_TABIX.
    ENDLOOP.
    ENDCASE
    Thanks
    Vandana

    Hi,
    You can try this.
    USEREXIT_MOVE_FIELD_TO_VBEP                                      
    Use this user exit to assign values to new fields at the level of
    the sales document schedule lines.                               
    The user exit is called up at the end of the FORM routine        
    VBEP_FUELLEN.                                                    
    Thanks
    Krishna.

Maybe you are looking for

  • Howto: Display text in the border line of the JPanel

    I create a JPanel and set it's border, later i add a textField at the border line of the JPanel, but when the words i type in, the line of border still at the center of the textField. Pls Help

  • Due date update using GP APIs?

    Hi all I am working on the Due date update using GP APIs, I have done it at the "process" level. However I dont know how to trigger it at an activity level using GP APIs. Please tell me how to gain access to the Activity (Action) instance of the next

  • Button to Navigate Timeline

    I am using Flash CS3 making use of AS3. I have 10 buttons, every button will play the next 10 frames on the current timeline then "jump" to its intended frame which is also in a different scene. The goal is to have the beginning of every scene a basi

  • Posting in backdate

    hi all guru`s Here Im looking for posting stock in backdate by mb1c. currently two periods are open april 04 and may 05...I want to post stock on date 31.03.2009 I tried ob52 and mmpv ,mmrv but my issue is not getting solved...plz help... thanks in a

  • EBS 12.1.3 32-bit VM templates

    HI ALL i would like to download ebs 12.1.3 32-bit templates from edelivery but could not find it Are the templates files removed? thanks shabz