Fm to find saturday & sunday .

Hi,
Could any one tell the Function module to find whether the given date is saturday or sunday.
Thank &Regards
sathish

Hi,
Use this funtion module.
DATE_COMPUTE_DAY
eg
data: w_day type c.
call function 'DATE_COMPUTE_DAY '
  exporting
     DATE = sy-datum
importing
      day = w_day. 
if w_day is 6 then its saturday and if w_day is 7 then its sunday.
regards,
Santosh Thorat

Similar Messages

  • Holiday hours(saturday,sunday and other holidays of employee) in CATS_DA

    HI,
    My client wants Holiday hours (Iu2019e Saturday, Sunday & other leaves) to be shown in CATS_DA report. Usually employee is going to fill his time sheet thru CAT2.
    I would like to know the possibilities for getting Holiday hours to be shown in the CATS_DA report.
    Is there any provision using function module or possibility to track employee holiday hours from CATS with help of holiday calender. If so kindly suggest me.
    Is there any provision using functional module or possibility to track data from clusters. Kindly suggest me
    Regards
    Amar

    Hello Koutilya,
    I got the same requirement as yours. Can you please suggest me how to achieve this one.
    Thanks,
    R V Narayana.

  • Display dates/days except saturday sunday (ASAP)

    Hi all,
           I am developing a BSP application which run queries to be selected from a  dropdown. It basically displays some meeting data..filled or unfilled depending on the query. I want to display the day,date in different columns and a few other columns. But those should not include saturday/sunday and other holidays depending on the country in which the query is run. I have no idea how to do it.
    Plz provide me with any help asap.
    Regards,
    Rohit Khetarpal
    <i>*Suggestions are always rewarded.</i>

    <b>And my earlier code as suggested by Durairaj Athavan Raja was this:</b>
    <b>Layout:</b>
    <%@page language="abap"%>
    <%@extension name="htmlb" prefix="htmlb"%>
    <htmlb:content>
      <htmlb:page title="Account details" >
        <htmlb:form method = "post">
          <htmlb:tableView id            = "tv2"
                           headerText    = "Account Details"
                           headerVisible = "true"
                           footerVisible = "false"
                           design        = "ALTERNATING"
                           table         = "<%= holidays %>" >
         <htmlb:tableViewColumns>
              <htmlb:tableViewColumn columnName = "date"
                                     title      = "partner"
                                     edit       = "FALSE"
                                     width      = "100%">
              </htmlb:tableViewColumn>
              <htmlb:tableViewColumn columnName = "freeday"
                                     title      = "Start date"
                                     edit       = "FALSE"
                                     width      = "100%">
              </htmlb:tableViewColumn>
              <htmlb:tableViewColumn columnName = "holiday"
                                     title      = "End Date"
                                     edit       = "FALSE"
                                     width      = "100%">
              </htmlb:tableViewColumn>
              <htmlb:tableViewColumn columnName = "HOLIDAY_ID"
                                     title      = "Product"
                                     edit       = "FALSE"
                                     width      = "100%">
              </htmlb:tableViewColumn>
              <htmlb:tableViewColumn columnName = "TXT_SHORT"
                                     title      = "text"
                                     edit       = "FALSE"
                                     width      = "100%">
              </htmlb:tableViewColumn>
              <htmlb:tableViewColumn columnName = "TXT_LONG"
                                     title      = "text"
                                     edit       = "FALSE"
                                     width      = "100%">
              </htmlb:tableViewColumn>
            </htmlb:tableViewColumns>
          </htmlb:tableView>
        </htmlb:form>
    </td></tr></table>
      </htmlb:page>
    </htmlb:content>
    <b>OnInitialization event:</b>
    data: holidays type standard table of  ISCAL_DAY .
    CALL FUNCTION 'HOLIDAY_GET'
    EXPORTING
       HOLIDAY_CALENDAR                 = 'US'
       FACTORY_CALENDAR                 = 'US'
       DATE_FROM                        = '20070101'
       DATE_TO                          = '20070131'
    IMPORTING
    YEAR_OF_VALID_FROM                = year
      YEAR_OF_VALID_TO                 = YEAR_OF_VALID_TO
      RETURNCODE                       = RETURNCODE
      TABLES
        holidays                         = holidays
    EXCEPTIONS
       FACTORY_CALENDAR_NOT_FOUND       = 1
       HOLIDAY_CALENDAR_NOT_FOUND       = 2
       DATE_HAS_INVALID_FORMAT          = 3
       DATE_INCONSISTENCY               = 4
       OTHERS                           = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    In this code, i am not getting any values display under the column names when i execute.Can you suggest something on this too...
    Regards,
    Rohit Khetarpal
    Message was edited by:
            Rohit Khetarpal

  • Time Statement Form TF02 - Saturday Sunday

    Hi community,
    Could you explain how we can display
    Saturday
    Sunday
    in the TF02 form in case there is no time event please ?
    I already set up the feature LDAYW (value 7)
    Very useful when an employee is working on Sat or Sun according to his/her work schedule.
    Many thanks in advance.
    Kind regards

    Hi, you must delete following entries in V_T512G maintence view:
    TE XT S 6 $SKIP_NO_PAIRS
    TE XT S 7 $SKIP_NO_PAIRS
    Being 6 and 7 the weekdays.
    Regards,
    Diego.

  • Query to find First sunday of march and Second Sunday of November in SQL 2008

    Hi,
    I want query to find Second sunday of march and First Sunday of November in SQL 2008. This query can be used for Daylight savings(MST).
    Thanks in Advance.
    Regards,
    LuckyAbdul

    declare @d datetime,@d1 datetime
    set @d = '20140301'
    set @d1='20081101'
     SELECT @d1
    declare @baseMonday datetime
    set @baseMonday = '17530101'
    select
       @baseMonday + datediff(day,@baseMonday,@d)/7*7+13  as Sunday,
       @baseMonday + datediff(day,@baseMonday,@d1)/7*7+6 as Sunday1
    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

  • How to find No. of Saturdays,Sundays in Specified Dates?

    Hello Gurus,
    I have scenario where in user will provide me Two dates for instance say 1-Jan-2003 to 1-Jan-2004, Now I want to find out what are the dates in this specified range which has Sundays & Saturdays ?
    Is it possible to do it in Simple SQL query or Do you have any PL/SQL code(Implemented in Forms) which provides a solution to my given problem?
    Thanx in advance,
    Pritam.

    sabre150 wrote:
    Use String.replaceAll() to replace any characters that are not numeric and then take the length of the resultant String....and this might be useful: [http://www.regular-expressions.info/]
    ;-)

  • Finding all Sunday in a month

    Dear Community memeber;
    Hope all will be fine. I have a query which I am un-able to resolve. The query is that; I want to findout those date which are comming on Sunday in a month. Like I give month JUN-2010. it should be show me all date which occure on sunday.
    Thanks in advance.

    How abt dis..
    select dt from
    select trunc(sysdate,'mm')+level-1 dt from dual
    connect by level < to_char(last_day(trunc(sysdate,'mm')),'dd')+1
    )where to_char(dt,'dy') = 'sun';
    and a small block
    declare
         l_last_day     number;     
         l_next_sunday     date;
         l_first_sunday     date;
         j number;
    begin
         select     next_day(trunc(sysdate,'mm'),'sunday')
         into     l_first_sunday
         from     dual;
         dbms_output.put_line('first sunday is : '||l_first_sunday);
         j := to_number(to_char(to_date(l_first_sunday,'dd-mm-yyyy'),'dd'));
         for i in to_number(to_char(to_date(l_first_sunday,'dd-mm-yyyy'),'dd')) .. to_number(to_char(last_day(trunc(sysdate,'mm')),'dd'))
         loop
              j := j+7;
              exit when j > to_number(to_char(last_day(trunc(sysdate,'mm')),'dd'));          
              dbms_output.put_line('value of j : '||j);
              select     to_date(j||'-'||to_char(sysdate,'mm-yyyy'),'dd-mm-yyyy')
              into     l_next_sunday
              from     dual;
              dbms_output.put_line('Next sunday is : '||to_char(l_next_sunday,'dd-mon-yyyy'));
         end loop;
    end;

  • Help in finding all sundays of an year

    hi all,
    When we seletc a particular year,Can I be able to get the all the sundays of that year?I think using Calendar instance we can do that.but don't have an idea.Someone got faced the same requirement,Pls let me give some idea
    thanx

    u cn wrt it on ppr n ndrstnd, bt frst read teh API 2 chk wot mthods u cn use.
    Seriously, please try to write clearer questions in the future, if the question is structured you have bigger chance that the answer will be structured and clearer.
    About the specific case you are trying to solve - obtain a calendar instance, then use the appropriate set(...) methods to set it to the fist Sunday of the first week in the year you want. Stop here and test that this works as expected - you can check it using some calendar (application or paper, whatever you prefer).
    After that you can add weeks and filter the dates the way you want to meet the requirements, e.g. stop adding when you go into the next year.
    Mike

  • Find out previous Monday based on 0CALDAY

    Hi Gurus,
    I want a way to return the date of a pervious Monday regardless of the run day of the query. I have 0CALDAY field in query. How to do it please advice ?
    Thanks
    Liza

    Hello,
    There are lots of function modules for date conversion, you can use them in the User Exit and get the Prev Monday you want by using the system date
    see this which function is used for  adding days to given month
    see this fm to find saturday & sunday .
    Thanks
    Chandran

  • Dates for Sunday & Saturday in Month

    I want single query that shows dates of Sunday $ Saturday
    of perticular month.
    so please help me.

    def MONTH=JUL
    def YEAR=2004
    select ZDATE, to_char(ZDATE,'DAY') ZDAY
      from
       (select
              to_date('01-' || '&MONTH' || '&YEAR' ,'DD-MON-YYYY') ZDATE from dual
        UNION ALL
              (select to_date('01-' || '&MONTH' || '&YEAR' ,'DD-MON-YYYY') + N
                  from (select rownum N
                          from all_objects
                         where rownum <= 30
      where
             rtrim(to_char(ZDATE,'DAY')) in ('SATURDAY', 'SUNDAY')
        and  to_char(ZDATE,'MON') = '&MONTH'
    order by
        ZDATE
    03.07.2004 SATURDAY                   
    04.07.2004 SUNDAY                     
    10.07.2004 SATURDAY                   
    11.07.2004 SUNDAY                     
    17.07.2004 SATURDAY                   
    18.07.2004 SUNDAY                     
    24.07.2004 SATURDAY                   
    25.07.2004 SUNDAY                     
    31.07.2004 SATURDAY                   

  • Retreive Sunday to Saturday Week records

    Hi Friends,
    I am using Oracle 10.1 version. I have a requirement to retrieve records for week spanning sunday to saturday from the sales table.
    I have to execute this query on sunday, if the production job fails for some reason, i need to execute the job on a monday / tuesday.
    Is it possible to retrieve the records for the last week?
    Example
    Sunday Saturday Sunday
    04/25/2010 05/01/2010 05/02/2010
    if the jobs fails on sunday, i need to execute the job on 05/03, then the query should retrieve only 04/25 till the date reaches 05/08/2010. Since it completes the week span.
    i researched the forum and i found the below query to retrieve the records spanning week time.
    WHERE     some_date     >= TRUNC (SYSDATE + 1, 'IW') - 15
    AND     some_date     < TRUNC (SYSDATE + 1, 'IW') - 8
    How should i be able to modify this query to retrieve the record for a week span time.

    Hi,
    The formula you found is a good way to get the Sunday-to-Saturday week that was 2 weeks ago. If you want last week, then just add 7 days to the expressions to which you are comparing some_date:
    WHERE   some_date >= TRUNC (SYSDATE + 1, 'IW') - 8
    AND      some_date <  TRUNC (SYSDATE + 1, 'IW') - 1When run any time from Sunday, May 2 through Saturday, May 8, the condition above looks for some_date between Sunday, April 25 and Saturday, May 1, inclusive.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data if the query is run on a couple of different dates. (For example: "If I run this one Saturday, May 8, then the output should be ..., but if I run it on Sunday, May 9, then I want ...".)

  • Finding difference of Hours between two dates

    I need logic to find the difference of number of hours between any two dates excluding saturdays & sundays. Please provide PLSQL code.

    my dear
    this is the pl/sql to create on db.
    &#0124; &#0124; This function it will created on the data if you like.
    &#0124; &#0124; the input parameter for this function is two date .
    &#0124; &#0124; you can add more feature on it because turn it felixable eg.
    &#0124; &#0124; you can execlude varaible days from paramteres....
    CREATE OR REPLACE FUNCTION GET_HOURS(P_FROM_DATE IN DATE ,
    P_TO_DATE IN DATE DEFAULT SYSDATE ,
    P_EXECLUDE IN VARCHAR2 DEFAULT '17' ) RETURN NUMBER IS
    V_CURR_DATE DATE := P_FROM_DATE ;
    V_ALL_DAYS NUMBER := 0 ;
    V_NET_HOURS NUMBER := 0 ;
    V_FROM_JUL NUMBER := TO_CHAR(P_FROM_DATE,'J');
    V_TO_JUL NUMBER := TO_CHAR(P_TO_DATE,'J');
    BEGIN
    FOR R IN V_FROM_JUL..V_TO_JUL LOOP
    IF INSTR(P_EXECLUDE,TO_CHAR(V_CURR_DATE,'D')) = 0 THEN
    V_ALL_DAYS := V_ALL_DAYS + 1 ;
    END IF;
    V_CURR_DATE := V_CURR_DATE+ 1 ;
    END LOOP;
    V_NET_HOURS := V_ALL_DAYS * 24 ;
    RETURN(V_NET_HOURS);
    END;
    -- this is for test senario
    SELECT GET_HOURS(SYSDATE-30) FROM DUAL ;
    SELECT GET_HOURS(SYSDATE-30,SYSDATE,'127') FROM DUAL;
    SELECT GET_HOURS(SYSDATE-30,SYSDATE,'0') FROM DUAL; -- to execlude zero days.

  • Finding days in between dates expressed in days.

    Hi, i have a table having a structure similar to this:
    LP1
    TIME_EQ
    P_DAY
    LP2
    17.2
    0
    MONDAY
    16.8
    0.25
    TUESDAY
    17.03
    .5
    THURSDAY
    17
    .75
    FRIDAY
    17.4
    1
    FRIDAY
    16.9
    .25
    SATURDAY
    17.1
    .25
    SATURDAY
    17
    .5
    SUNDAY
    Now, i have two variable dates D1 = October 10, 2013 (Thursday) and D2 = October 13, 2013 (Sunday).
    How do i update my table such that only those rows covered between dates D1 and D2 are updated? In this case, rows where P_DAY in (Thursday, Friday, Saturday, Sunday)  I will use this for my cursor, my query begins with this:
    CURSOR LOAD_PROF is
          SELECT LP1, TIME_EQ, P_DAY
          FROM LOAD_PROFILE_TEST
          WHERE P_DAY in (??? days between D1 & D2).
    I hope you get my point.  Thanks.

    Thank you sir for your response.  This is the start of my query where I will use that:
    DECLARE
          CURSOR LOAD_PROF
          IS
               SELECT LOAD_PROF1,
                             V_TIME,
                             PROFILE_DAY,
                             DECODE(UPPER(PROFILE_DAY),
                                            'MONDAY', 1,
                                            'TUESDAY', 2,
                                            'WEDNESDAY', 3,
                                            'THURSDAY', 4,
                                            'FRIDAY', 5,
                                            'SATURDAY', 6,
                                            'SUNDAY', 7,
                                            'HOLIDAY', 8,
                                            'H_WEEK_T', 9,
                                            'H_WEEK_F', 10)
                                  ORDERBY
               FROM LOAD_PROFILE_TEST
            WHERE SUBSTATION_CODE = :V_SUBSTATION_CODE
                         AND CIRCUIT_CODE = :V_CIRCUIT_CODE
                         AND UPPER(PROFILE_DAY) IN (SELECT UPPER(
                                                                                           TO_CHAR
                                                                                                 :V_DATE + (level-1),
                                                                                                 'fmDAY'))
                                                                               FROM dual
                                                                          CONNECT BY LEVEL <=
                                                                                                           :V_DATE_IN
                                                                                                         - :V_DATE
                                                                                                        + 1 )
               ORDER BY  ORDERBY, V_TIME;
    V_PROF      NUMBER;
    Y_OUT1     NUMBER;
    Y_OUT2     NUMBER;
    Y_OUT3     NUMBER;
    Y_OUT4     NUMBER;
    Y_IN1      NUMBER;
    Y_IN2      NUMBER;
    Y_IN3      NUMBER;
    Y_IN4      NUMBER;
    Y_OUT      NUMBER;
    Y_IN       NUMBER;
    Y_OUT_A     NUMBER;
    Y_IN_A      NUMBER;
    Y_OUT_B     NUMBER;
    Y_IN_B      NUMBER;
    OUT_EXCL    NUMBER;
    IN_EXCL     NUMBER;
    OUT_EXCL_A   NUMBER;
    IN_EXCL_A    NUMBER;
    OUT_EXCL_B   NUMBER;
    IN_EXCL_B    NUMBER;
    UPPER_AREA   NUMBER;
    LOWER_AREA   NUMBER;
    UPPER_AREA_A  NUMBER;
    LOWER_AREA_A  NUMBER;
    UPPER_AREA_B  NUMBER;
    LOWER_AREA_B  NUMBER;
    DURATION   NUMBER;
    BEGIN
    IF :LOAD_DIFF < > 0
    THEN
          FOR UE IN LOAD_PROF
          LOOP
               EXIT WHEN LOAD_PROF%NOTFOUND;
               UPDATE LOAD_PROFILE_TEST
                     SET LOAD_PROF2 = LOAD_PROF1 + :LOAD_DIFF;
          END LOOP;
    ELSE
          FOR UE IN LOAD_PROF
          LOOP
               EXIT WHEN LOAD_PROF%NOTFOUND;
          UPDATE LOAD_PROFILE_TEST
                      SET LOAD_PROF2 = LOAD_PROF1;
          END LOOP;
    END IF;
    COMMIT;
    CALC_UE_AREA(:V_DATE, :V_SUBSTATION_CODE, :V_CIRCUIT_CODE);
    CALC_UE_CUMUL_AREA(:V_DATE, :V_SUBSTATION_CODE, :V_CIRCUIT_CODE);
    The column AREA is dependent from the column LOAD_PROF2, which I got by updating all the row in my cursor. The column CUMUL_AREA in turn, is dependent on the column AREA. After running these 2 procedures, i will now be able to compute for parameters which i need, using extrapolation method on the dates, LOAD_PROF2 & CUMUL_AREA
    Anyways, I will be proceeding with this query for now.  I hope you can give me a better suggestion onhow to better approach my problem.  Thanks very much for your help.  I will now close this thread but again, I will still wait for your suggestion.  Thanks again.

  • Where is Saturdays Primeval?

    I am for the most part happy with BT Vision but why is it, it is always the replay programmes that i look forward to watching, that appear late on Replay. It happened a lot when XFactor was on. It happened last week with Silent Witness. Now I cant seem to find Saturdays Primeval..... I've checked the tv guide, I am sure it was on, so why isnt it on replay yet?

    It was certainly on. It sounds like a series recording would save you some frustration.
    As we (or at least some of us) have BBC iPlayer, maybe we could get direct access to the ITV Player and cut out the middle man.

  • Query help - Fetch employees working on two consecutive weekends(SAT/SUN)

    Hello Gurus,
    I have the following requirement and i need your help on this.
    We have a table with all employees effort logged in for the days they have worked. a sample data is given below
    TD_date     Emp_id     Effort     Archive_month
    2-Mar-13     123     8     Mar-13
    9-Mar-13     123     8     Mar-13
    2-Mar-13     213     4     Mar-13
    3-Mar-13     213     4     Mar-13
    24-Mar-13     213     8     Mar-13
    9-Mar-13     312     4     Mar-13
    10-Mar-13     312     4     Mar-13
    16-Mar-13     312     8     Mar-13
    In the above sample data, we have employee 123 who worked on consecutive SATURDAY and 312 who worked on consecutive weekends (9th, 10th and 16th March) but the employee 213 worked on 1st weekend and 4th weekend of the month(Archive_month). So the output should return the employees who worked on two consecutive weekends as below.
    Emp_id
    123
    312
    I have written a query to fetch all employees who worked only on a SAT or SUN which is given below, but i am not able to return the employees who worked on consecutive weekends and i need your help.
    select emp_id, count(*)
    from timesheet_archive
    where archive_month = '03/2013'
    and trim(to_char(td_date,'DAY')) in ('SATURDAY','SUNDAY')
    group by emp_id having count(*) > 1
    order by td_date desc
    Please help me with an approach in SQL or PL/SQL to generate a report of employees who worked on two consecutive weekends.
    Thanks,
    Edited by: 999145 on Apr 9, 2013 11:08 PM
    Edited by: 999145 on Apr 9, 2013 11:10 PM

    hi Manik,
    thanks for your response!!
    Please find the below create and insert scripts for your testing.
    I am also validating the output with my requirement. Thanks for your help!
    create table timesheet_archive as
    (TD_date date,
    Emp_id number(19,0),
    Effort Float,
    Archive_month varchar2);
    insert into timesheet_archive values (to_date('2-MAR-2013','dd-MON-yyyy'), 123,8,'03/2013');
    insert into timesheet_archive values (to_date('9-MAR-2013','dd-MON-yyyy'), 123,8,'03/2013');
    insert into timesheet_archive values (to_date('2-MAR-2013','dd-MON-yyyy'), 213,4,'03/2013');
    insert into timesheet_archive values (to_date('3-MAR-2013','dd-MON-yyyy'), 213,4,'03/2013');
    insert into timesheet_archive values (to_date('24-MAR-2013','dd-MON-yyyy'), 213,8,'03/2013');
    insert into timesheet_archive values (to_date('9-MAR-2013','dd-MON-yyyy'), 321,4,'03/2013');
    insert into timesheet_archive values (to_date('10-MAR-2013','dd-MON-yyyy'), 321,4,'03/2013');
    insert into timesheet_archive values (to_date('16-MAR-2013','dd-MON-yyyy'), 321,8,'03/2013');
    insert into timesheet_archive values (to_date('2-MAR-2013','dd-MON-yyyy'), 124,8,'03/2013');
    insert into timesheet_archive values (to_date('9-MAR-2013','dd-MON-yyyy'), 124,8,'03/2013');
    insert into timesheet_archive values (to_date('16-MAR-2013','dd-MON-yyyy'), 124,4,'03/2013');
    insert into timesheet_archive values (to_date('23-MAR-2013','dd-MON-yyyy'), 124,4,'03/2013');
    insert into timesheet_archive values (to_date('16-MAR-2013','dd-MON-yyyy'), 241,8,'03/2013');
    insert into timesheet_archive values (to_date('23-MAR-2013','dd-MON-yyyy'), 241,4,'03/2013');
    insert into timesheet_archive values (to_date('24-MAR-2013','dd-MON-yyyy'), 241,4,'03/2013');
    insert into timesheet_archive values (to_date('2-MAR-2013','dd-MON-yyyy'), 412,8,'03/2013');
    insert into timesheet_archive values (to_date('3-MAR-2013','dd-MON-yyyy'), 412,8,'03/2013');
    insert into timesheet_archive values (to_date('30-MAR-2013','dd-MON-yyyy'), 412,8,'03/2013');
    insert into timesheet_archive values (to_date('31-MAR-2013','dd-MON-yyyy'), 412,8,'03/2013');

Maybe you are looking for