Previous week 12AM Sunday to 11:55pm Saturday

Post Author: Steve1040
CA Forum: Formula
Anyone know of a formula for pulling Previous week 12AM Sunday to 11:55pm Saturday?
Thanks
Steve

Post Author: SKodidine
CA Forum: Formula
{your table date} in minimum(LastFullWeek) to datetime(maximum(lastfullweek),time(23,55,59));
If you do not need 11:55 PM for ending then you can simply say
{your table date} in lastfullweek;

Similar Messages

  • Function Module to convert date to week from Sunday to Saturday

    Hi,
    In BW the convertion date to week always give week from Monday(1) to Sunday(7)
    I'm looking for a function module to convert date to week from Sunday(1) to Saturday(7)
    Thanks
    Sebastien

    Hi,
    I think this SAP standardized. Maybe you need to create custom FM.
    You can copy SAP FM DATE_GET_WEEK. in the FORM FIRSTWEEK, I see below case,
    CASE start_weekday.
        WHEN if_calendar_definition=>c_monday.
          start_weekday_number = 1.
        WHEN if_calendar_definition=>c_tuesday.
          start_weekday_number = 2.
        WHEN if_calendar_definition=>c_wednesday.
          start_weekday_number = 3.
        WHEN if_calendar_definition=>c_thursday.
          start_weekday_number = 4.
        WHEN if_calendar_definition=>c_friday.
          start_weekday_number = 5.
        WHEN if_calendar_definition=>c_saturday.
          start_weekday_number = 6.
        WHEN if_calendar_definition=>c_sunday.
          start_weekday_number = 7.
      ENDCASE.
    Maybe you can play something here.

  • Getting previous weeks data based on parameters entered

    I am using CRXI. I have a RT that gives me the current week data but I need to be able to report on previous week data based on the paraments so if I enter dates between sunday and saturday of one week it will report on those data plus the same days of the previous week. I looked at the lastfullweek function, but not sure how to implement it in my scenerio. any ideas?
    Ralph

    That worked, thankyou. My next question along the same lines, is I am also having a third column that will indicate the percent change. for example
    Current             Previous              % Change
    97                    108
    I am trying to computer the % change between curent and previous basically it would look at previous as being the control and computer positive or negative based on what current is. I can do the math formulas, but I'm not sure what to comute to find the % change.
    Ralph

  • Previous week Dates

    Hi all
    Please help in writing a query to get the previous week data.
    If the input date is sysdate then it should return values for previous week Monday to Sunday.
    Whatever the input it should get the value for previous week from Monday to Sunday.
    Thanks
    Jo

    IW is the formatter for the "Iso-Week"
    ISO = international standard organization
    See also: http://en.wikipedia.org/wiki/ISO_week
    Main thing is that it will always start with monday. The weeknumber might be different then for ww format. This doesn't matter in your case. But you migh want to do some experiments with to_char(sysdate,'IW'), to_char(sysdate,'WW').
    Trunc(<datevale>,'IW') will cut the date back to the first day of this iso-week.
    select to_char(sysdate-365,'IW') IW , to_char(sysdate-365,'WW') WW from dual;
    IW     WW
    37     36Edited by: Sven W. on Sep 9, 2010 2:29 PM

  • Selection variable with default value as previous weeks mon through sun

    Hi Experts,
    1.)
    I need to create a Selection Variable ZTRANS_DT ( type Interval ), with the default value as  "Previous week, Monday Through Sunday" .
    Should we have to write a customer exit to populate these interval values dynamically every time the user runs the report ?
    If so can you please write a sample ABAP code.
    2.)
    The filter restriction for the date feild ZBUSINSDT has to be set to ">=#1/1/CURRENT YEAR#" ..
    How to set current year dynamically.
    Help done would be appreciated and would be assigned points.
    Thanks,
    Santosh..

    Hello,
    I dont remember of any standard variable but still you can wait to see if any1 comes up with one.
    Or else you can try the foll:
    Create the variable as per your requirement.
    Then in CMOD, write a simple code for i_step = 1.
    logic can be l_t_range-low = sy-datum - 1.
    Regards,
    Shashank

  • Previous Week Select Query

    I need to find all records from the previous week(Sun-Sat) based on the sysdate in a select statement. Any ideas on how i could do this?
    Message was edited by:
    user635070

    Hi,
    On Saturday, May 10 "next_day(sysdate,'SUN')-14)" will be April 27, but "next_day(sysdate,'SAT')-7" will be May 10.
    If you want to use NEXT_DAY, I suggest
    l.allo1_dt >= TRUNC (next_day (sysdate, 'SUN')) - 14 and
    l.allo1_dt <  TRUNC (next_day (sysdate, 'SUN')) -  7

  • How to get data for current week and previous week using customer exit in Bex.

    Hi everyone,
    I have a scenario in which I need to display data for current week and previous week (based on "sy_datum" the program has to calculate current week and previous week) in Bex using  Customer exit. I have created one variable in Bex Query Designer and I have written code for the variable in CMOD. But it is not working fine, (I know that we can do the same by using offset value in Bex). Can some one guide me how to achieve my requirement using customer exit.
    Thanks in Advance,
    G S Ramanjaneyulu.

    Hi krishna,
    Thanks for your quick reply, can you have a look at my code,
    case i_vnam.
    WHEN 'ZPWK_CWK'.
    ranges : pre_week for sy-datum.
    data : start_date type DATS,
           end_date TYPE dats .
    ************FM TO GET FIRST DATE OF CURRENT WEEK ************************
    CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
      EXPORTING
        DATE_IN  = sy-datum
      IMPORTING
        DATE_OUT = start_date.   " WEEK FIRST DATE
    end_date = START_DATE + 6.   " WEEK LAST DATE
    END_DATE   = START_DATE - 1.   " PREVIOUS WEEK END DATE
    START_DATE = START_DATE - 7.   " PREVIOUS WEEK START  DATE
    **********PREVIOUS WEEK DATES IN PRE_WEEK******************
    pre_week-SIGN   = 'I'.
    pre_week-option = 'BT'.
    pre_week-LOW    = START_DATE.
    pre_week-HIGH   = END_DATE.
    APPEND  pre_week.
    CLEAR : START_DATE,END_DATE.
    endcase.
    Regards,
    G S Ramanjaneyulu.

  • Urgent : Bill Qty based on Fisrt day of Previous week to current week

    Hi,
    I have to create a Restricted Key figure.
    Bill Qty is to be restricted on a day, which is first day of previous week.
    (1) I have restricted KF, with Current Week SAP exit variable.
    (2) Restricted KF, with Calendar Day (Variable ZDATE, customer exit type).
    (3) I have written Customer Exit in CMOD...
    data: LT_RANGE  type  RSR_S_RANGESID,
          LS_VAR_RANGE like RRRANGEEXIT.
    case i_vnam.
    when 'ZDATE'.
    if i_step = 2.
    break-point.
    loop at i_t_var_range into ls_var_range where vnam = '0CWEEK'.
    data: var1(2) type c,
          var2(4) type c,
          var3 LIKE SCAL-WEEK,
          date1 like scal-date,
          DATE2(10) TYPE C,
          MNTH(2) TYPE C,
          DAY(2) TYPE C,
          YEAR(4) TYPE C.
    var1 = ls_var_range-low(2).
    var2 = ls_var_range-low(4).
    concatenate var2 var1 into var3.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
      EXPORTING
        WEEK               = var3
    IMPORTING
       DATE               = date1
    EXCEPTIONS
      WEEK_INVALID       = 1
      OTHERS             = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    MNTH = DATE1+4(2).
    DAY = DATE1+6(2).
    YEAR = DATE1+0(4).
    CONCATENATE DAY '/' MNTH '/' YEAR INTO DATE2.
    lt_range-low = date2.
    lt_range-high = date2.
    lt_range-sign = 'I'.
    lt_range-opt = 'eq'.
    append lt_range to e_t_range.
    endloop.
    endif.
    <b>BUT I AM GETTING ERROR -</b>
    00010004              AError for variable in customer enhancement ZDATE
    Please suggest any idea..
    Thanks
    saurabh

    Hi Saurabh,
    Please try this dample code
    WHEN 'ZDATE'.
    DATA: Z_WEEK TYPE SCAL-WEEK.
    *Determine current week from SY-DATUM
            CALL FUNCTION 'DATE_GET_WEEK'
              EXPORTING
                DATE               = SY-DATUM
              IMPORTING
                WEEK               = Z_WEEK.
    *Determine first day of current week 
            CALL FUNCTION 'WEEK_GET_FIRST_DAY'
              EXPORTING
                WEEK = Z_WEEK
              IMPORTING
                DATE = LT_RANGE-LOW.
    LT_RANGE-SIGN = 'I'.
    LT_RANGE-OPT = 'eq'.
    APPEND LT_RANGE TO E_T_RANGE.
    Regards
    Joe

  • Calendar: Start week on Sunday, like in OSX 10.5.8

    Calendar: How do I Start my week on Sunday, like in OSX 10.5.8 ?

    who says British calendars start on Monday? Someone isolated in Cupertino?
    Nope, nothing to do with Cupertino.
    The International Organization for Standardization, in ISO 8601, defines the week as being Monday to Sunday. The British Standards Institution agrees, as do European Standards.
    So, Apple are just following international, European and British agreed standards.

  • To get time-booking entered thru CATW,CAT2 for the previous week

    Hi Experts,
    I need to analyze the absences booked by an emolyee. I have obtained the time-booking for the present week from the user-exit where I am writing the code. But I have to check the booking of the previous friday (previous week) to check if the same absence is taken on Monday (current week). Thus I have to check the booking made by the employee on friday previous week. How can I get the time booking data for the previous week?
    Do we have any Fm to get that?
    Thanks
    Akash

    BAPI_ABSENCE_GETDETAIL         Read absence
    BAPI_ABSENCE_GETDETAILEDLIST   Read instances with data
    BAPI_ABSENCE_GETLIST           Read instances
    But you need for CATSDb ie for CATS
    use standard trans code cats_da ie rcats_report_activities
    also we have bapis
    BAPI_CATIMESHEETMGR_CHANGE     CATS: Change data records
    BAPI_CATIMESHEETMGR_DELETE     CATS: Delete Data Records
    BAPI_CATIMESHEETMGR_INSERT     CATS: Insert data records

  • Report Issue: Previous Weeks, Current Week and Next Week Values

    Hello Folks,
    this is a typical requirement...at-least typical for me..
    we have 20 weeks of data at weekly level. we have four Metrics out of which two are coming from Database and rest two are calculated metrics.
    Metric0: On Hand Qty
    Metric1: Past Qty
    Metric2: sell Qty
    Metric3: unsell qty
    Metric4: Total Qty
    the report will always be shown for 20 weeks, but depending on whats my current week, all the past weeks should be flagged as Past Week. (so i wrote a case statement for this). for Instance: I am in Week11, so my weeks in should be Past Week, Wk11, Wk12.........Wk20.
    Metric 1 is always dependent on result of Metric4 (This is the Complexity) per week basis
    Metric1 for Past weeks value in Week Column will be wk1 to wk10 On Hand Qty (fox ex: 80)
    Metric4 for Pass Weeks Value in Week Column will be Metric1 for Pastweeks + Metric2 for Past Weeks (For Ex: 20) (Past weeks mean wk1 to wk10)
    value of Metric4 is now 100
    Metric1 for Week11 Now should 100 (From Past weeks Calculation)
    Metric4 for Week11 will be Metric1 for Week11(100) + Metric2 for Week11(10) + Metric3 for Week11 (10)
    Now...Metric1 for Week12 will be 120 which is wk11 total (100+10+10) and goes on Until Week 20
    Any Ideas how to achieve this in obiee 10g
    Thanks
    Rake

    Please try out in this way....
    Database level --Create opaque view & procedure or function  to get the week total,week ago total, current week , Past week ,future week & do rpd modelling and use PIVOT VIEW.
    At answers:
    1.Here Previous week M4 is the current week M1 which means it is a cumulative value carried forward week by week.
    2. M2 & M3 are direct database columns.
    3. You have time hierarchy with WEEK Level.
    M1 - ago(rsum(m2+m3),weeklevel)
    M4- RSUM(M2+M3)
    week -AGO(RSUM(M2+M3)- M2-M3-RSUM(M2+M3)
    w1-0-10-20-30
    w2-30-11-21-62
    w3-62-12-22-96
    Now you can PIVOT IT to get in
    W1-W2-W3
    M1 0 - 30-62
    M2 10-11-12
    M3 20 -21-22
    M4 30 - 62-96
    NOW PASTWEEK (W1-W10), CURRENT WEEK(W11)-W12
    1.as you see cumulative here you need to use BINS.means ( case when week <= currentweek(maybe variable) then prior) else week)
    2. UNION - combine similar request - First cirteria week <= w11 and second criteria week > week 11 --combine pivot it. Use sum agg in fx criteria1.
    Hope this should solve your pblm at answers.
    Edited by: MK on Oct 27, 2011 12:48 PM

  • Previous weeks data

    Hi all,
    I have a requirement where I need to show the Unbilled amount of this week as well as last 20 weeks based on region. Let say I am on fiscal week 20. Now if create a report based on region and Unbilled amount I will get $ 20 for europe. Now if after one week i.e FW 21 , I run the same report I get & 25 for Europe. Again let say after one more week i.e FW 22 I get $ 27 for Europe.
    Now user if run a report on FW 22. he wants areport like
    Week   Region  Unbilled
    FW20   Europe  $20
    FW21   Europe  $25
    FW22 Europe    $27
    i.e history data is required . As data is changing every day , user wants to see previous 20 weeks data.
    Now I am using a Zcube built on standard extarctor 0FI_GL_4. i dont have loading date or system date.
    Please suggest what to do
    Regards,
    Sunny

    Hi.
    If your object fiscal week restricted by variable you should do the next:
    1. create 20 calculated KF each one restricted with this variable with appropriate offset (lets say previous week wth vriable and offset -1, 2 weeks ago with variable and offset -2 ...)
    2. create another calculated KF with variable without offset to represent user selection week.
    So at the end you will see one KF with current week and 20 another KF with 20 previous weeks.
    Regards.

  • ESS Record time's "Copy Previous Week" functionality not working

    Hi,
    we are on 04s sp10. We are trying to modify the ESS Record time DC. In this DC, the "Copy Previous Week" button is invisible and we want this functionality to work. When I made that button visible, for some reason it doesnot copy the times from the previous week. So was wondering if I have to configure something in the backend to make this functionality work. Did anybody come across this issue?
    Thanks

    Any guesses on this one?

  • Function Module - Calculate Previous Week

    Hi Guys,
    I am looking to create a variable on Fiscal Period/Year, that automatically populates the variable with the previous week (current week minus 1), when the user runs the query.
    I have heard there is a Function Module available - can anyone help?
    Thanks
    Scott
    Message was edited by:
            Scott Sweeney

    Hi,
    use the following code:
    DATA: l_curr_week LIKE SCAL-WEEK.
    DATA: l_prev_week LIKE SCAL-WEEK.
    DATA: l_day TYPE DATS.
    CALL FUNCTION 'DATE_GET_WEEK'
      EXPORTING
        date               = SY-DATUM
    IMPORTING
       WEEK               = l_curr_week.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
      EXPORTING
        week               = l_curr_week
    IMPORTING
       DATE               = l_day.
    SUBTRACT 1 FROM l_day.
    CALL FUNCTION 'DATE_GET_WEEK'
      EXPORTING
        date               = l_day
    IMPORTING
       WEEK               = l_prev_week.
    hope this helps...
    Olivier.

  • Could not get Previous Week Day starting today

    I need help  to get PREVIOUS WEEK day starting today.
    Eg:
    Today is 15 / 09 / 2011
    I need Date 08 / 09 / 2011
    Hence both 15th and 08 are Thursday. One is today's thursday and other is previous week thursday.
    Regards

    Warranty on iPhone is not international, but valid only in country of
    original sale. Since you purchased the iPhone in Australia, your warranty
    is valid only in Australia. You must either personally return the iPhone
    to Australia for evaluation and possible replacement or sent it to someone
    in Australia to take into Apple for the evaluation. Apple will not accept
    international shipments for repair nor will Apple ship out of the country
    after replacement.
    Sorry to be the bearer of this news, but it is the way iPhone warranty and
    replacement has always worked.

Maybe you are looking for