Date of last movement in Query

Dear all,
I have a query in which I would like to display the last movement of goods. The Key figures are
1. Quantity receipt stock
2. Quantity issued stock
I would like to get the last date of either last receipt stock amount or the last issued stock amount.
I tried to do so by implementing two conditions
Key figure = Quantity receipt stock - TOP N - Value = 1 -- Characteristic Assignment = Individual Chars and chars combination
Unfortunately this is not working. It delivers the biggest movement but not the last.
Could you please help me.
Thanks
Stefan

Hello,
thank you very much with your help. This was a good hint although it takes a bit more to get to a solution.
Nevertheless it works now.
Procedure:
As I mentioned in my first post, I have two key figures.
So as a first step I created a formula in which I checked the following parameters
(( Key Figure1 <> 0) OR (Key Figure2 <> 0)) * 0Calday
So every value is 0 except of the dates there was a movement within one of the two Key Figures.
After that I made a TOP N Condition on that formula with value 1.
I renamed the Calender Day within the query and voilá I had the last movement day.
Best regards
Stefan

Similar Messages

  • How to calculate the days between last movement of material till today date

    Hello Experts,
    Could someone help me please?
    I have a key figure in the InfoCube 0IC_C03 witch contain the last date of movement of material.
    (it is a key figure created in format date and contain the max value).
    How can I to calculate the number of days between this date (last movement),  till today date (system date).
    I need to show:
    material........last movement.....days without movements.
    xxxxxxxxxxx.....dd/mm/yyyy..........9999
    Im trying to do this calculation in bex using variable formula but it doesn't work becouse current date (customer exit) brings sy-datum in format yyyymmdd and the kf-last-mov is in format number (I dont know what kind of number)
    Thanks in advance,
    Points are assured.
    Regards,
    Silvio Meurer.
    Message was edited by:
            Silvio Meurer

    Hi Parth,
    Here we are using the version 7.0 and SP 10, I'm afraid I could not understand you. I Can't find the function DATE_DIFF (Where is it?)
    I'm using the formula and it doesn't work. Coud you see the result is:
    last movement date     Today date        result
    02.04.2007                  20.070.625       19.337.856
    18.05.2007                  20.070.625       19.337.810
    the "today date" is from customer exit and the result is a strange number to me.
    Could you help me?

  • Reference date of last data load in query

    Is it possible to referece the date of the data load in a query via user exit / formula variable or some other way?
    We have a requirement to display data in a query based on when the data was last loaded. If the data load has not occured this month, then only records from the previous month should come into the result set.
    Has anyone ever done anything like this? Or can you think of a way using SY-DATUM in the update rules that would allow you to segment data on the front end?
    Thanks!
    Adam

    Defenitely there would be a better way.
    For short term you can use a date filed in cube which is filled using your update rule as sy-datum.
    Later you can fiter out while running the query
    try using the Infopackage load tables.
    if 2004s, try using any of RSDDSTAT*
    Mey

  • How to calculate first date and end date of this year in Query

    Hi Expert
    I want to calculate following dates with inputted date in query.
    I have no knowledge on ABAP and I just can create a query with simple logic.
    Could you teach me how to calculate following date?
    (If inputted date is April 12 2009)
    - First date of this year (Ex January 1 2009)
    - End date  of this year (Ex December 31 2009)
    - First date of last year (Ex January 1 2008)
    - End date of last year  (Ex December 31 2008)
    - First date of this month (Ex April 1 2009)
    Thank you!
    Take

    HR_JP_MONTH_BEGIN_END_DATE   use this FM to get the begin and end date of the Date you are passing. eg when u give input as 04/12/2009, it will return
    04/01/2009 as begin date
    04/30/2009 as end date
    pass the Year in this FM HR_E_GET_FISC_YEAR_DATES, you will get the Fiscal year Begin and End Dates
    Abh

  • Show data of last day of previous month against any day of current month

    Hi,
    I have fact table which contains data at date level (we have data for oct-2009 to april-2010). Our requirement is to show data of last day of previous month against any day of current month in obiee 11g. I am facing problem in Feb 2010 its picking data of 28-Jan-2010 instead of 31-jan-2010 and for April its picking data of 30-mar-2010 instead of 31-mar -2010.
    Any suggestion ???

    You're asking to filter your data set to only include rows between:
    1) last day of the previous month
    2) any day of the current month
    This can be achieved with prompting in OBIEE Answers.
    last day of previous month = TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) . The problem is you need to make query work within Oracle's Answer syntax.
    In the prompt, select the operator type for your date dimension as 'between' and default to 'SQL Results'.
    For the 'last day of previous month' , use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    For the current date, use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else CURRENT_DATE
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    Another option is to create a last_date_pervious_month variable in the RPD and have that as the default value in your prompt.

  • Batch classification "Date of last goods receipt" is "00.00.0000"

    Dear all,
    I have configured all steps for batch determination for FIFO.
    It worked fine for IM (stock transfer - mov.type 301) on last friday, however, get the issue today:
    - After I do GR (mov.type 101), the batch is auto created, batch classification is created,
    I use MSC2N to view batch classification:
    the value of "Date of last goods receipt" is "00.00.0000"
    What is wrong with my configuration?
    Could you pls help me to fix this?
    Thanl you very much for you help!
    Edited by: Ngo Quoc Hung on Dec 13, 2010 10:59 AM

    System Updates Batch Data in the Batch Master Record in the Following ways :
    1)  If the batch does not yet exist for the plant, it is automatically created.
    2)  If the batch already exists for the plant, the new quantity is simply posted as a receipt in the specified storage location.
    When posting a goods receipt with reference to Purchase order, the system updates Posting date as the goods receipt date in general data of the batch.

  • Date of last extraction from DataSource 0HR_PY_PP_2 is not available

    Hello all,
    We are using this data source to extract data for HR in BW. We are currently on BI 7.0
    When I used this datasource in BW development system it worked fine. But now I am trying to extract data using the same datasource in BW QA system and I am getting this error.
    "Date of last extraction from DataSource 0HR_PY_PP_2 is not available     HR_BIW_PP"
    The datasource is delta supported so I am trying to init it, and thats when I am getting this error.
    Has anyone seen this message before, can some give some suggestions?
    Thanks in advance

    Just quick check, check rsa3 if you can get any data and  also it seems like it is complaining about changes in extract structure, can you compare the extract structure of the two system manually? If you have made changes to the extract structure, did you move that change in the source system? Sometimes it worth it to replicate the datasource and reactivate the transfer structure using program RSActiTran.
    thanks.
    Wond

  • Date should be displayed on query execution

    hello all
    when v execute a query date should display when query is executed.like if i execute query on 01/06/2006 this date should be displayed and when execute query on 01/02/2006 this date should be displayed?,like that so on?
    kindly anyone let me know how it should be done?
    how this should be done?
    many thanks

    hi Balaji,
    in bex analyzer, you can display the date with menu business explorer -> display text elements -> general, you will see some info, 'author'... 'last refreshed'.
    in web (WAD) you can use web item 'text element' and choose element type 'general text' and
    element id 'SYUZEIT'.
    element id can be used
    general text elements:
    - technical name of the query (REPTNAME)
    - description of the query (REPTXTLG)
    - InfoProvider (INFOCUBE)
    - key date for the query (SRDATE)
    - validity of the data (date and time) (ROLLUPTIME)
    - the person who wrote the query (AUTHOR)
    - the last time the query was changed (date and time) (MODTIME)
    - the last person to make changes to the query (MODUSER)
    - current user (SYUSER)
    - the last time the query was refreshed (date and time) (SYUZEIT)
    hope this helps.
    Message was edited by: A.H.P

  • Automatically displaying date of last page change

    I think I remember seeing this a year or so ago, but I can't find it.
    Is there a way to grab the date that a page was last modified and display that on the page? It seems like there should be and easy way, since the information shows up in the developer reports.
    I have the following query which works in SQL*Plus:
    select max(audit_date) from flows_020000.WWV_FLOW_BUILDER_AUDIT_TRAIL
    where flow_id = 130
    and page_id = 306
    but in a page definition I get an 'insufficient privileges' message.
    I'd to avoid granting select privileges on the table, as I'd then have to remember to redo it with each new version of ApEx as well. And since I can't get the above to work yet, I'm not sure if I could substitute strings like &APP_ID. and &PAGE_ID. into the where clause, so this could just be a Page 0 item instead of hard coding it onto each page.
    Any ideas what I'm missing? (Other than when I purge my logs)
    Thanks,
    Bill Ferguson

    (Almost) a couple of small typos in the first select statement.
    First, somehow I wound up with two create table lines. Not sure why, but get rid of one. Next, This bit of code didn't have the other DISTINCT in it (I guess somehow I copied the older version, dunno).
    So, here's the correct version:
    CREATE TABLE LAST_WEB_APP_CHANGE AS (
    SELECT DISTINCT pk_field, short_name workspace, NAME app_name, app_id, page_num, last_change_date, flow_user
    FROM (SELECT DISTINCT pk_field, app_id, page_num , lv last_change_date
    FROM (SELECT short_name|| LPAD (NVL (flow_id, 0), 6, 0)
    || LPAD (NVL (page_id, 0), 6, 0) pk_field,
    flow_id app_id, page_id page_num,
    last_value(audit_date) OVER (PARTITION BY flow_id, page_id) AS lv
    FROM flows_020000.wwv_flow_builder_audit_trail c,
                                  flows_020000.wwv_flow_companies
    WHERE c.flow_id = flow_id
    AND c.page_id = page_id
    AND security_group_id = provisioning_company_id
                   GROUP BY short_name, flow_id, page_id, security_group_id, audit_date) a
    WHERE page_num IS NOT NULL),
              flows_020000.wwv_flow_builder_audit_trail a,
              flows_020000.wwv_flow_companies c,
              flows_020000.wwv_flow_models m
    WHERE a.flow_id = app_id
    AND page_id = page_num
    AND last_change_date = audit_date
    AND a.security_group_id = c.provisioning_company_id
    AND a.security_group_id = m.security_group_id
    AND short_name = '<your workspace name>'
    Just to be sure, I retested again this morning and this one does grab (and create) the last changed record in the audit trail and stores it into whatever table name you chooes (if you edit it).
    As Vikas said in an earlier post, it best (probably) to do this on each parsing schema, since each parsing schema can have multiple apps associted with it, and it can become a can of works creating a generic schema accessible to all.
    Anyway, after the table is created and populated for each schema, then it's easy to create a page to to handle insert/update/deletes for the future maintainability of the data.
    Personally, I'm leaning towards a variation of the above code associated with a button, to update the information, maybe a drop table followed by the above code? I need to experiment some.
    But, you can create a Page 0 hidden item, I called mine :P0_LAST_CHANGE_DATE, with a SQL source of :
    select TO_CHAR (last_change_date, 'DD-MON-RRRR HH24:MI:SS') last_change_date
    from LAST_WEB_APP_CHANGE
    where app_id = &APP_ID.
    and page_num = &APP_PAGE_ID.
    Then, on each page's footer, I have the statement:
    Page Last Changed: &P0_LAST_CHANGE_DATE.
    Variations of the above can also be used to display who changed it last (the flow_user field).
    Now, each page will display the date of last change (almost) painlessly). I just need to periodically go out and maintain the table. Maybe a scheduled job run each night?
    Somebody want to supply an example of how to do that?
    Bill Ferguson

  • Searching for movie data in file "******.mov"

    The last couple of weeks I've been getting dailog boxes that freeze up Keynote with the following message:
    Searching for movie data in file "******.mov"
    It runs through all the different MOV or MP4 video files I have in that particular Keynote and doesn't allow me to do anything but wait. I've tried moving the file to another HD but this didnt't change anything. Also changing the save settings didn't help.
    It happens a couple of times an hour and is getting annoying. Anyone have any clue how to solve this?

    I am also seeing this bug and often work on 400mb+ presentations that use larger screen sizes and have lots of video assets for work.   On large files I find that autosave is not ideal, and would also like a way to turn it off. The computer that was seeing the issue was running 10.7.5.  It was just updated to 10.8.2 so I am keeping my fingers crossed that it works better now.  Time will tell.
    I also really hope that Apple gives us a real refresh on Keynote on the Mac.  As old as it is, it still ahead of Powerpoint.  But it wont stay that way forever standing still and nobody else has a better alternative that is as fast and flexible to work with.  They are squandering somthing special by letting it gather dust.

  • Get dates of last week - Please Help !

    Hi All,
    I have to make a query for retrieving the data for the last one week from a table say "Orderdata".
    So can anybody please tell me how to retrieve date of last weak from the current date. I mean if current date is 12/08/2004 (mm/dd/yyyy) then I would be needing date as :--
    12/01/2004 (mm/dd/yyyy) to 12/07/2004 (mm/dd/yyyy).
    To more clear, here is the query that am using :
    select * from orderdata where orderdate between 12/01/2004 AND 12/07/2004
    I know I would be needing java.sql.timestamp class to set date . but it is the last thing to do .
    First I have to get date of last weak...........
    Here is the code----------that i have just start to write ..
    Calendar cal;
    TimeZone tz;
    String estTimezone="GMT-05:00";
    tz=TimeZone.getTimeZone(estTimezone);
    cal=new GregorianCalendar(tz);
    cal.setTimeZone(tz);
    String currentdate=String.valueOf(cal.get(Calendar.MONTH)+1);
    currentdate+="/"+String.valueOf(cal.get(Calendar.DAY_OF_MONTH)-1);
    currentdate+="/"+String.valueOf(cal.get(Calendar.YEAR));
    out.println(currentdate);And assume if current date is 12/1/2004 (mm/dd/yyyy) then subtracting -1 form the current date will give 12/00/2004 so not getting the correct result .
    Hope it is clear to all................
    Please Help !
    amitindia

    Hi All,
    Thanks chirag813 for your coding. and thanks to all.
    By the way I have to change time in EST and also required start date and end date of last weak. So my final coding is as:
    Please have a look into the code and tell me whether the code is correct / fine or not.
    Do I need to call the getInstance() method in my code as you (chirag813) have put in your code
    Calendar calendar = Calendar.getInstance();
    Is my code fine ?
    Please Answer..................
    String startdate;
    String enddate;
    Calendar cal;
    TimeZone tz;
    String estTimezone="GMT-05:00";
    // is this line correct to get startdate
    SimpleDateFormat sdfStartdate= new SimpleDateFormat("yyyy-MM-dd 00:00:00");
    // is this line correct to get enddate
    SimpleDateFormat sdfEnddate= new SimpleDateFormat("yyyy-MM-dd 23:59:59");
    tz=TimeZone.getTimeZone(estTimezone);
    cal=new GregorianCalendar(tz);
    cal.setTimeZone(tz);
    cal.add(Calendar.DATE,-7);
    startdate=sdfStartdate.format(cal.getTime());
    cal.add(Calendar.DATE,6);
    enddate=sdfEnddate.format(cal.getTime());
    Timestamp t1=Timestamp.valueOf(startdate);
    Timestamp t2=Timestamp.valueOf(enddate);
    out.println(t1);
    out.println("<br>"+t2);
    And finally I have used Timestamp class to change the date (String) to Timestampt.
    Thanks !
    amitindia
    SCJP 1.2

  • How to get the data for last 3rd business day and also include saturday and sunday if its a wednesday?

    Hi All,
    I have a simple query which is below:-
    Declare @reportdate date
    set @reportdate= (DATEADD(dd,-5,getdate()))
    select * from dbo.Table
    where date IN (@reportdate)
    I need this query to pull the data for the last 3rd business day .So lets say today is monday then i need the data for last week wednesday which is 3 business days back from monday, if today is a tuesday it would be for last thursday ( as 3 business days for
    tuesday would be thursday). But if today is wednesday then i need to be last 3rd business day which is last friday and i also need to get the data for saturday and sunday.
    Can someone please help me how cani change my filter to do this?
    Please let me know if i am still unclear.
    Thanks

    Hi SqlDev12,
    Based on my understanding on your requirement, you can reference the below sample.
    CREATE TABLE BusinessTable
    Bdate DATE,
    Wd VARCHAR(10)
    ;WITH Cte(DT,WD) AS
    SELECT CAST('20150401' AS DATE),DATENAME(WEEKDAY,CAST('20150401' AS DATE))
    UNION ALL
    SELECT DATEADD(DAY,1,DT),DATENAME(WEEKDAY,DATEADD(DAY,1,DT)) FROM Cte
    WHERE DT<GETDATE()
    INSERT INTO BusinessTable SELECT * FROM Cte
    SELECT * FROM BusinessTable
    SET DATEFIRST 7 -- Set Sunday as the first day of a week
    DECLARE @givenDay DATE ='20150415' --Wednesday
    SELECT * FROM BusinessTable
    WHERE Bdate BETWEEN
    --For Monday and Sunday, select last wednesday
    (CASE WHEN DATEPART(WEEKDAY,@givenDay) IN(1,2) THEN DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay)-1,0))
    --For Tuesday and Wednesday, last week's Thursday and Friday
    WHEN DATEPART(WEEKDAY,@givenDay) IN(3,4) THEN DATEADD(DAY,-5,@givenDay)
    --For Thursday and Friday, current week's Monday and Tuesday
    WHEN DATEPART(WEEKDAY,@givenDay) IN(5,6) THEN DATEADD(DAY,-3,@givenDay)
    --For Saturday, current week's Wednesday
    ELSE DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay),0)) END)
    AND
    (CASE WHEN DATEPART(WEEKDAY,@givenDay) IN(1,2) THEN DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay)-1,0))
    WHEN DATEPART(WEEKDAY,@givenDay) IN(3) THEN DATEADD(DAY,-5,@givenDay)
    WHEN DATEPART(WEEKDAY,@givenDay) IN(4) THEN DATEADD(DAY,-3,@givenDay)
    WHEN DATEPART(WEEKDAY,@givenDay) IN(5,6) THEN DATEADD(DAY,-3,@givenDay)
    ELSE DATEADD(DAY,2,DATEADD(WEEK,DATEDIFF(WEEK,0,@givenDay),0)) END)
    DROP TABLE BusinessTable
    If you have any feedback on our support, you can click
    here.
    Eric Zhang
    TechNet Community Support

  • Query to show last time a query was run

    I am trying to write a query that will show me the last date/time a specific query was run. I have looked into v$sql and I can find the query, but from what I can tell it does not show the last time the query was executed.

    Hi,
    use v$sqlarea instead of v$sql and look at the column last_active_time. See also the documentation (docs.oracle.com/cd/E11882_01/server.112/e40402/title.htm) on the dynamic performance views in the database.
    You will get more answers, however, if you put your question to the forum Oracle Database > SQL and PL/SQL .
    Regards,
    Gudrun Pabst

  • Date of last run of any program

    Hi Experts,
    Can anyone please provide how to fetch Date of last run of any program.
    I tried for transaction STAD/STAT,did not get desired Results.
    Any table name / FM in this regard will be helpfull.
    Thanks in Advance.
    Regards
    Ullas

    Hi Ullas,
    Not sure of table/FM. But i can give a pointer.
    Create one Ztable with mandt, date and time. Only mandt is key here.
    In ur program once u finish all selection screen validations just query this Ztable.
    SELECT single * INTO wa.
    Here u can get the date and time.(First time there won't be any record).
    In the last statement update this table with current date and time.
    wa-date = sy-datum.
    wa-time = sy-uzeit.
    MODIFY ztable from wa.
    Why i am asking to do it in last is ur program may fail in between. So if it reaches till the end of execution where there are no more statements to be executed MODIFY the ztable.
    So at any point of time u can get the successful execution date and time of the report from this table for the given client.
    If u don't want to happen at client level then u can remove the mandt field from table.
    Hope this may be helpful.
    Thanks,
    Vinod.

  • Entry date not proper in adhoc query

    Hi,
    Entry date field in action infotype ( in the adhoc query) always returns 00.00.0000. Whereas the standard reports brings the entry date properly (This is from prelq.hiredate). How we can bring the values into this particular field.The feature 'ENTRY' returns DATYP but data is not maintained in IT41. System should bring the hiring action date (0000 start date) as the entry date. We want to use this entry date field in the adhoc query.
    Thanks in advance.
    Sreeja

    Hi Sreeja
    Please  read the following paragraph of the consulting note 508026 :
    "Exception:
    If the query is started with a key date selection, the query calls
    function module HR_LEAVING_DATE with the key date and not with the start
    and end date of the personnel action in which the key date exists. You
    can use modification note 562031 to change this system response."
    Please also make sure, that the corrections of note 561514 are contained in your system.
    I hope that this information be useful for you.
    Regards,
    Jun

Maybe you are looking for

  • Is my HD completely dead or can it be saved?

    Hi everyone, I have a MacBook Pro (13 inch, Mid-2010) running OS X Mavericks 10.9 and it seems the HD has died. I'd be incredibly grateful if anyone could offer me some help and advice. I was using my MacBook as usual this morning. I had a few work d

  • I was FaceTiming on my iPhone 5c and it just shut off and now it won't turn back on....HELP?

    I just recently got it for Christmas. The phone is pretty hot, maybe it overheated??

  • IMovie HD projects on an external hard drive problems?

    I've recently been making a highlight tape for my football team. Since i dont want to take up that much space on my computer, I've decided to use an external hard drive. Making this project means taking DVD's that arent in the correct format and ripp

  • Consumption value updated for zero value materials

    Hi Masters I have maintained value of a material in material master as zero.Although it is maintained zero, When the material is issued using 261 accounting document got generated and showin the following entries   Inventory a/c Consumption a/c(+) Ho

  • HTML-page into flash slideshow?

    Hi, I'm am trying to load a HTML-page into a flash slideshow. The slideshow is going to run locally on the computer and the HTML-page (or RSS-feed if that is easier) is recieved from the company´s web-page. I'm totaly new to flash, and I would be ver