Calculate previous Sunday from the current day

Hi Gurus,
Can anybody tell what is the name of the function module which caluclates the previous Sunday from the Current system date. or any other idea how to calculate previous sunday from the current system date in Query.
Thanks
Liza

Hello,
See my previous thread to you for a similar Re: Find out previous Monday based on 0CALDAY
Thanks
Chandran

Similar Messages

  • 2nd Previous Period from the current period

    Hi MM Gurus,
    Is it possible in MM to open a 2nd previous from the current period?
    Please advise,
    Thanks,
    Themba

    hi,
    > Check the OSS NOTE 487381
    You can only open the last period via using the MMPI..using indicator allow back posting...
    Other than this you can open pervious periods for sandbox techniques. as well ....but SAP don't recommend it...
    check few posted threads on SDN...
    Regards
    Priyanka.P
    Edited by: Priyanka Paltanwale on Jun 2, 2009 9:52 AM

  • CALCULATE 6 MINS FROM THE CURRENT SYSTEM TIME....................?

    Hi
    I want to subtract few mins (say 5 min , 10 min ,15 mins , max to 55 mins) from the current system time,
    ex-current time 00:40:00
    Subtract 5 mins(means 5 mins backward)
    Final time 00:35:00
    ex-current time 01:20:00
    Subtract 30 mins(means 30 mins backward)
    Final time 00:50:00
    Pls help me with this with a appropriate logic or FM..
    Thanks a lot in advance
    Basic Date and Time questions are not allowed. They have been answered umpteen times. Please search for them.
    Edited by: kishan P on Sep 1, 2010 12:05 PM
    Edited by: Matt on Sep 1, 2010 9:01 AM - And please do not post in ALL CAPITALS

    May be you can do something like this!
    data: l_time like sy-uzeit.
    data: l_time1 like sy-uzeit value '06'. "6 hrs to be deducted from system time
    move sy-uzeit to l_time. "this is system time
    "write l_time.
    "write:/ l_time1.
    SUBTRACT l_time1 from l_time.
    write:/ l_time. "This is 6 hrs behind system time
    Rajasekhar

  • CALCULATE 6 HOURS FROM THE CURRENT SYSTEM TIME....................?

    hi
    good
    i want to subtract 6 hours from the current system time,
    ex-current time 17.07
    Subtract 6 hours(means 6 hours backward)
    Final time 11.07
    Pls help me with this with a appropriate logic.
    Thanks a lot in advance
    mrutyun^

    May be you can do something like this!
    data: l_time like sy-uzeit.
    data: l_time1 like sy-uzeit value '06'. "6 hrs to be deducted from system time
    move sy-uzeit to l_time. "this is system time
    "write l_time.
    "write:/ l_time1.
    SUBTRACT l_time1 from l_time.
    write:/ l_time. "This is 6 hrs behind system time
    Rajasekhar

  • Previous quarter from the current date using Date functions

    hi all,
    how can i get the value of the previous quarter and previous month using using NOW() function in the formula.
    regards,
    Rk
    Edited by: Rk on Feb 13, 2009 9:28 AM

    Hi Pk,
    This "DSTR(DADD(NOW(),-1,'Q'),'YYYYQ')" will give you just an year 2008 (if you run this today).
    But this "DSTR(DADD(NOW(),-1,'Q'),'YYYYMM)" will give you an year and month of prev quarter
    200811(if you run this today)
    Ola

  • How to return the week number starting from Sunday as the first day

    Hi Friends,
    My application needs to have a report for the weekly totals and must have the Sunday as the first day for the week. For example, January of 2005 should be in the report for having six weeks, Jan 1 is Saturday, this is week 1, Week 2 is from 2 to 8, and the last week , week 6 has 30 and 31. Days need not be displayed, only the week number as follows:
    Week Number Total Sales
    =========== =========
    Week 1 8,525
    Week 2 8,168
    Week 3
    Week 4
    Week 5
    Week 6
    The discoverer hierarchies function for week (eul_date_trunc(item_date, '"W"W')) seems to start the week from the first day of the month regardless of the day. Oracle function TO_CHAR(item_date, 'W') does the same thing, .As the result, the January of 2005 has only 5 weeks.
    Any help or advice for this issue will be greatly appreciated.
    Thank you very much,
    J.K

    Try this
    ---------------------------------------------actual formula---------------
    select ceil(
    ( to_number(to_char(to_date('1-'||to_char(sysdate,'MON-YYYY'),'DD-MON-YYYY'),'D')) -1
    + to_number(to_char(sysdate,'DD'))
    ) / 7
    week_number
    from dual
    e.g try different dates below by replacing 31-Jan-2005
    select ceil(
    ( to_number(to_char(to_date('1-'||to_char(to_date('31-JAN-2005'),'MON-YYYY'),'DD-MON-YYYY'),'D') ) -1
    + to_number(to_char(to_date('31-JAN-2005'),'DD'))
    ) / 7
    week_number
    from dual
    How does it work
    week number is calculated by dividing the current day number by number of days
    so in your case if the week starts at a different day , you just add the offset and divide by 7
    In the first part, i am finding the week day number for the 1st day of the current month and this is used as offset.
    Hope this helps
    -nj
    http://www.infocaptor.com

  • Regarding subtraction of 10 days from the current date

    Need to know how I can get 10 days subtracted from the current date before the report is excuted. This needs to appear in the selection screen before the report is excuted.
    The select option contains two fields the first field is the date which is 10 days subtracted from the current date and the next field is the current date.
    Please suggest.
    Thanks.

    Hi Dolly
    I had a same req before check that code:
    AT SELECTION-SCREEN OUTPUT.
    IF pa_older = 'X'.
    CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
    EXPORTING
    date = pa_end  "<<<<< date or in ur case sy-datum
    days = '10'
    months = '00'
    signum = '-'
    years = '00'
    IMPORTING
    calc_date = pa_end1.  " <<< subtracted date
    ENDIF.

  • Urgent ---calculate version  from the current week number

    hi,
         i have an requrenment to modify the charasteric routines
      i have xxx table with parameter i have to read this paramater n  if this parameter contains value 'D' then calculate version(eg:- A00,A01 ...) from the current week number.
    pls advice me which FM i have to call or provide me with some sample codeing.
    points wil be rewarded
    ravi

    There is a FM "WEEKNR_GET".
    This will give you the week no. You need to read the param value from the table that you mentioned and call this FM and updat the version.
    You will need a ABAP person to do this.
    Ravi Thothadri

  • PERSG previous bet different from the current PERSG using info-type pa0000

    Hi Friends,
    Please guid me how get the PERSG previous bet different from the current PERSG
    using info type pa0000.
    Regards,
    Durga

    Folks,
    even after having repaired the inbox folder under "properties" a few times, I still had some e-mails where the contents are different from the subject line.
    In other words in the inbox there are two e-mails: one with subject line "abc", and another one with subject line "def".
    When I display the e-mail with the subject line "abc", the contents are from the e-mail with the subject line "def" in the in-basket.
    What else can be done to correct this problem?
    Thanks and best regards.
    Fred Kunz-Shirzad
    Chemin Ronzeures 6A
    1297 Founex VD
    Switzerland
    [email protected]

  • How can i stay logged in on iPhone Skype after i delete the app from the 'current' apps?

    How can i stay logged in on iPhone Skype after i delete the app from the 'current' apps?
    Thanks for ur answers !

    You are correct. There is no other way to recover this material, and yes it would have been a good idea to backup the iPhone prior to the restore. Remember that a restore to a previous date deletes everything on the device and puts it back to the state of things on the date you choose. The texts and contacts would be gone. Did you possibly sync the contacts with a supported application on the computer? That is the only other way to recover contacts. They are designed to be synced with a supported application on the computer, or with a cloud service such as iCloud, Google or Yahoo.

  • Is there a way to default the monthly calendar display so that the current day always shows on top?

    Is there a way to default the monthly calendar display
    so that the current day always shows on top? ie, I want to always be able to see what's in the future 3-4 weeks, not what's in the past 3-4 weeks. The default monthly display is archaic--only allows you to see through the last day of the month. Suddenly today
    is Oct. 30th, and I have a ton of projects lined up in November, but because I haven't been scrolling down every day, I haven't been aware of them every day. I realize there are other tools in Microsoft to help me stay on task, such as reminders and such,
    but it would be helpful if I could always have the current day display on top of the monthly view so I can quickly scan what's coming up in the next few weeks. 

    Thank you!
    Right, I already have it in Month view. My question is a little more specific--I'd like for the current day to always display at the top. For example, today is Oct. 31st, so the current day is at the bottom of the calendar since it is the last day of the month.
    I can view everything in October that I've already completed. What I can't see are the future weeks because we haven't hit November yet. I'd like for the current day to always display at the top of my calendar so I can always see what's coming in the following
    three - four weeks (whether they're a part of that month or not). I've been to other forums trying to find the answer, and have come across the same exact question from frustrated users--but there seemed to be no solution. So I'm posing the question myself
    in this forum. Do you know if this is possible? What I found from other forums is that Outlook defaults to a physical 'desk' type calendar format--so just as I'd use a paper calendar at my desk, I wouldn't be able to see the following weeks unless I either
    flip the page to that month or I come to the first day of the next month, thereby tearing the the old month off and now only able to see the current month. That format is just so...paper...and archaic! Essentially I want the calendars to loop so it doesn't
    even really matter what month it is--I just always want to see what lies ahead without having to scroll down. With our being in the Technology Age, I'd assume this is a logical expectation, but we may be stuck with the replica version of the paper-desk-calendar
    format until Outlook programmers add this Technology Age feature in newer versions.  
    See, this month kind of messed me up because I have so many projects for November that start tomorrow and next week, but I haven't seen them until this week. I would have been better quipped--at least expecting them--had I been able to see all of those projects
    since last week or the week prior.  
    If there is no solution to this answer, would you know how I can contact Outlook to provide feedback? I'm guessing a newer version is on its way...
    Thanks again in advance!

  • Changing the calendar settings: Sunday as the first day of the week

    Dear Masters of SAP universe,
    In ECC6.0, I am using a LIS info-structure with the period split set to week.
    I would like to know how can I change the calendar settings in order to consider Sunday as the first day of the week, instead of Monday.
    For example:
    A sales order created on Dec 12th creates the record 201049 in the info structure S900 - SPWOC.
    I would like to have it as 201050, where 50 is the currently week in the system.
    I already checked OSS notes and the transaction SCAL for customizing. But I did not find a solution this issue.
    Your help is highly appreciated!

    hi,
    this seems to be a calendar issue.
    please check for OSS also - 1158474.
    balajia

  • Does anyone know how to remove sundays from the datepicker in BC?

    I have a client that is closed on Sundays and occasionally gets an irate customer that books late saturday and is upset that no one is there on Sundays. So I would really like to remove the option of Sundays from the date picker.

    Hi guys,
    I had the same problem as jbyrom and found a work-around using a bit of jQuery. Before I begin...
    Downsides
    It's a bit of a pain if you have tons of date fields, as you'll need to add a class to each datepicker field
    Because you need to add a class to each datepicker field, you'll need to add the Web Form as HTML (ie make sure "insert as module instead" is unchecked when adding the form to a page)
    As mentioned, it's a work-around - may stop working in the future if Adobe changes the way the datepicker works
    Users could still put in "restricted" dates by manually typing the date instead of clicking the date in the datepicker
    How-To
    Add a class to each datepicker field you want to restrict days on (I'm using "datepickerhack").
    Add the script below the form (ie at least after the closing </form> tag). This is so jQuery and BC's Java_Datepick.js are loaded before the script.
    Add some CSS to your stylesheet to make it obvious to them they can't click certain dates.
    Script
    <script type="text/javascript">
    $(document).ready(function(){
         $(".datepickerhack").focus(function(){
              // Grab the ID of the relevant date field and use it to call the built-in BC displayDatePicker function
              var datetable = $(this).attr("id");
              displayDatePicker(datetable);
              // Now the date table is in the DOM, remove the onclick events of the appropriate TDs
              // In this example I'm removing the onclick event of the first TD in each row (ie Sunday)
              $(".date tr td:first-child").attr("onclick","");
              return false;
    </script>
    CSS
    Last step is something simple for usability, so users know they can't click the unclickable days. I just used:
    .date tr td:first-child{background-color:#CCC;}
    .date tr:last-child td{background-color:#FFF;}
    The second line is needed as the last row contains the "Today"/"Clear"/"Close" buttons (as opposed to dates)
    Edit: fixed formatting, added last "Downside"

  • Selecting Invoice (OINV) records from the current financial year

    Hi Everyone,
    I would like to select Invoices (OINV) from the current Financial Year. I am located in Australia and our financial year is measured from the 1st of July to the 30th of June.
    Here is a pseudo - code sample -
    SELECT T1.DocEntry, T1.DocNum, T1.DocDate
    FROM AU.dbo.OINV T1
    WHERE "CURRENT FINANCIAL YEAR"
    Notice above that I would like to replace "CURRENT FINANCIAL YEAR" with an SQL code snippet that selects all dates from the beginning of the financial year (1/07/xx) to the current date.
    Any help here will be greatly appreciated.
    Kind Regards,
    David

    Hi Everyone,
    Here is a code snippet that permits returning only values from the current financial year -
    DECLARE @day nvarchar(2) = DAY(GETDATE())
    DECLARE @currentMonthAndDay INT = CAST(CAST(MONTH(GETDATE()) as nvarchar(2)) + (REPLICATE('0', 2 - LEN(@day)) + @day) as int)
    DECLARE @StartOfFinancialYear DATETIME
    SET @StartOfFinancialYear = CAST(YEAR(GETDATE()) - CASE WHEN @currentMonthAndDay<701 then 1 else 0 end as nvarchar(max)) + '0701'
    SELECT *
    FROM AU.dbo.OINV T0
    WHERE T0.DocDate >= @StartOfFinancialYear
    AND T0.DocDate < DATEADD(yy, 1, @StartOfFinancialYear)
    Many thanks to Faheem for providing the answer to returning only results from the current financial year, in this thread: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/2edbe630-faca-4f94-a014-04f5a832f81d/returning-results-that-fall-within-the-current-financial-year?forum=transactsql
    Kind Regards,
    David

  • Get three previous records of the current record

    Hi,
    I need to get three previous records of the current record in an Oracle Form
    Sorry for the lengthy explanation:
    I have a table name: ARCHIVE_DATA with column name: coll_time and its data type DATE.
    SQL> SELECT COLL_TIME FROM ARCHIVE_DATA;
    COLL_TIME
    12-AUG-05
    12-AUG-05
    12-AUG-05
    12-AUG-05
    12-AUG-05
    12-AUG-05
    12-AUG-05
    12-AUG-05
    12-AUG-05
    12-AUG-05
    10 rows selected.
    SQL> select to_char(coll_time,'dd-mon-yyyy:HH:MI:SS') from ARCHIVE_DATA;
    TO_CHAR(COLL_TIME)
    12-aug-2005:02:42:00
    12-aug-2005:02:43:00
    12-aug-2005:02:44:00
    12-aug-2005:02:45:00
    12-aug-2005:02:46:00
    12-aug-2005:02:47:00
    12-aug-2005:02:48:00
    12-aug-2005:02:49:00
    12-aug-2005:02:50:00
    12-aug-2005:02:51:00
    10 rows selected.
    This is the Requirement:
    In a Form's Block(BLK1), for example: the current_record is the fifth record from the top
    (i.e. 12-aug-2005:02:46:00)
    When the fifth record is the current_record and When I click a button, three previous records of the
    current_record should be populated on the screen.
    See what I did:
    I created another table same as the first table(ARCHIVE_DATA) and its name is: THREE_RECS.
    I am inserting three records from the first table(ARCHIVE_DATA) into the second table: THREE_RECS
    which are less than the current record and ORDER BY DESC.
    CANVAS:
    Two blocks (BLK1, BLK2) based on ARCHIVE_DATA and THREE_RECS are on the same CANVAS.
    But the first block (BLK1) which is based on the first table:ARCHIVE_DATA is populated with one record and the
    second block (BLK2) is empty.
    So when I click a particular button (ex: prev_recs), the second block(BLK2) should be populated with
    three previous records of the current record( :BLK1.COLL_TIME)
    (off course :BLK2 populates with one record and use arrows or scrollbar to get the other two records)
    This is the code I wrote in the trigger and followed by the error:
    1 BEGIN
    2 DECLARE
    3 cursor c1 IS
    4           SELECT MONITOR_ID,
    5               SAMPLE_ID,
    6               COLL_TIME,
    7               DEW_POINT
    8          FROM ARCHIVE_DATA;
    9 cursor c2(passing_date IN date) IS
    10           SELECT MONITOR_ID,
    11               SAMPLE_ID,
    12               COLL_TIME,
    13               DEW_POINT
    14          FROM (SELECT MONITOR_ID,
    15               SAMPLE_ID,
    16               COLL_TIME,
    17               DEW_POINT
    18          FROM ARCHIVE_DATA
    19          ORDER BY COLL_TIME desc)
    20      WHERE COLL_TIME < passing_date;
    21     BEGIN
    22     FOR cur_rec in c1
    23     LOOP
    24          IF (cur_rec.COLL_TIME = to_date(:BLK.COLL_TIME,'dd-mon-yyyy:HH24:mi:ss')) then
    25     FOR second_cur_rec in c2(second_cur_rec.COLL_TIME)
    26          LOOP
    27      IF c2%rowcount < 4 then
    28               BEGIN
    29               INSERT INTO THREE_RECS
    30                    values(second_cur_rec.MONITOR_ID,
    31                         second_cur_rec.SAMPLE_ID,
    32                         second_cur_rec.COLL_TIME,
    33                         second_cur_rec.DEW_POINT);
    34               COMMIT;
    35               END IF;
    36 END LOOP;
    37 END IF;
    38 END LOOP;
    39 END;
    40 END;
    This is the error I am getting:
    Error 103 at line 14
    Encountered the symbol "(" when expecting one of the following
    a PL/SQL variable or double quoted string
    an expanded name
    an expanded name link
    a table reference __expression
    a key word
    Resuming parse at line 126, column 46
    Thanks in advance

    Why not just a simple select that doesn't involve a second table and PL/SQL?
    sql>select * from t1 order by dt;
    DT
    08/12/2005 02:42:00am
    08/12/2005 02:43:00am
    08/12/2005 02:44:00am
    08/12/2005 02:45:00am
    08/12/2005 02:46:00am
    08/12/2005 02:47:00am
    08/12/2005 02:48:00am
    08/12/2005 02:49:00am
    08/12/2005 02:50:00am
    08/12/2005 02:51:00am
    10 rows selected.
    sql>select dt
      2    from (select dt, row_number() over (order by dt desc) rn
      3            from t1
      4           where dt < to_date('12-aug-2005:02:46:00', 'dd-mon-yyyy:hh:mi:ss'))
      5   where rn <= 3
      6   order by dt;
    DT
    08/12/2005 02:43:00am
    08/12/2005 02:44:00am
    08/12/2005 02:45:00am
    3 rows selected.If the use of an analytical function (row_number()) is a problem with Forms, then the query can also be done as:
    sql>select dt
      2    from (select dt
      3            from (select dt
      4                    from t1
      5                   where dt < to_date('12-aug-2005:02:46:00', 'dd-mon-yyyy:hh:mi:ss')
      6                   order by dt desc)
      7           where rownum <= 3)
      8   order by dt;
    DT
    08/12/2005 02:43:00am
    08/12/2005 02:44:00am
    08/12/2005 02:45:00am
    3 rows selected.

Maybe you are looking for