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

Similar Messages

  • How can i validate attribute(timestamp type) enter date day is not sunday.

    hi All,
    problem is that i want to validate timestamp type attribute. when user select a date if the date day is sunday than error message
    show to user.
    can i do this with groove expression.

    You can add a script validation to the EO attribute and use an groovy expression like
    def d = newValue;
    println d.day;
    return d.day != 0;
          I only tested this with a date but it should work with a timestamp too...
    Timo

  • Original GI date should display closest day when Saturday and Sunday comes

    Hi Guys,
    I am getting Original GI Date as After deducting Transit time from Original Delivery Date.
    But i want to fullfill  the below requiremnt also.
    the Original GI Date should be then the working day defined in the calendar of the shipping point. Thus if the calculation gives  Original GI Date to be Sunday 4.3.2012 then it should changed to the closest previous working date which is Friday 2.3.2012 (calendar 'YT').
    Any one help me how to execute the above requiremnt.
    regards
    reddy.

    Hi,
    Pass your GI date to below given FM, it will return you the day of the week.
    CALL FUNCTION 'DATE_COMPUTE_DAY'
    EXPORTING
    DATE = GI_DATE
    IMPORTING
    DAY = day_of_week_num
    EXCEPTIONS
    OTHERS = 8.
    the value returned by this FM in day_of_week_num will be between 1 to 7, 1 representing Monday and 6 = Saturday and 7 = sunday.
    Now if your working days are from monday to friday then simply check the value returned by this FM is it is 6 then you can subtract 1 for last friday or add 2 for next monday and in the same fashion if value returned is 7 then subtract 2 for last friday and add 1 for next monday in GI date.
    For adding and subtracting value from GI date you can use FM RP_CALC_DATE_IN_INTERVAL.  And if you need to check some settings related to Factory calander then you can use FM DATE_CONVERT_TO_FACTORYDATE.
    Regards,
    Durgesh.

  • Can OCOD recognize if a date is a saturday or a sunday so it can be exclude

    I need to create a formula behind a date fiield that will increase a date by 2 days if the date is a Saturday and by 1 day if the date is a Sunday.
    In other word the date cannot fall on a weekend.
    Is this possible in OCOD?
    Thanks in advance for your help.

    There is information on the KB around time based workflow for weekends. Based on this i would say that there could be away that you could create a formula for this.

  • Need to display date result but has to exclude sat & sun day

    Hi all,
    I need to display date (A), from the plan date (B) for qty more than 10, but the result of A, should be B -10 and should not include sat & sunday.
    I managed to do in excel but I have problem in oracle sql here.
    My quote in excel, =IF(qty<=10, WORKDAY(plan_date,-5), WORKDAY(plan_date,-10))
    If qty=12, plan_date is 30/05/11, the result is 16/05/11
    qty=2, plan_date is 30/05/11, the result is 23/05/11
    Anyone can help me to quote in SQL ?
    Thanks.
    Lim

    CREATE OR REPLACE FUNCTION GOKHAN.business_date (start_date DATE, days NUMBER)
       RETURN DATE
    IS
       counter  number := 0;
       curdate DATE:= start_date;
    BEGIN
       WHILE counter < days
       LOOP
          curdate := curdate  - 1;
          IF TO_CHAR (curdate, 'D') BETWEEN 1 AND 5
          THEN
             dbms_output.put_line( curdate || ' ' || TO_CHAR (curdate, 'D'));
             counter := counter + 1;
          END IF;
       END LOOP;
       RETURN curdate;
    END;
    with t as (
    select to_date('30/05/11','DD/MM/YY' ) plan_date, 12 qty from dual
    union all
    select to_date('30/05/11','DD/MM/YY' ) , 2  from dual
    select qty, case when qty <= 10 then business_date( plan_date, 5 ) else business_date( plan_date, 10 ) end plan_date from t;
           QTY PLAN_DATE
            12 16/05/2011
             2 23/05/2011Best Regards,
    Gokhan Atil
    If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks

  • Displaying date and day

    Hi all
    Can anybody help me how to display the system date in the following format
    "dd-mm-yyy" "day"

    Hello,
    Try this program below:
    import java.util.Date;
    import java.text.SimpleDateFormat;
    class DateCheck
         public static String stringConvert(Date date)
              String expDate=null;
              try {
              String MY_DATE_FORMAT =" \"dd-MMM-yyyy\" \"EEE\"";
              expDate = new SimpleDateFormat(MY_DATE_FORMAT).format(date);
              } catch(Exception e) {
              e.printStackTrace();
              return expDate;
         public static void main(String[] args)
              Date d = new Date();
              System.out.println(stringConvert(d));
    }

  • Date Parameters displaying a day prior on Report Layout

    Hi,
    I am currently creating some reports using Oracle BI Publisher 11.1.1.6.2.
    The reports in question have a Start Date from Parameter and an End Date To Parameter.
    I also display the values for the parameters in the Report Layout which appears to display the values entered correctly in the Interactive Viewer, but looking at other outputs (i.e. HTML, Excel, PDF etc.) the value in the parameter field in the layout always displays a day prior to what has been entered.
    Has anyone come across this?
    Thanks in advance.

    This is an example of code:
    <?xdofx:substr(season_start_date,6,2)?>
    This would take the month out of the repository variable: season_start_date, in the format MM.
    (MM is on the 6th position, with a length of 2.)

  • 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.

  • How to display only Day value instead of DATE in Bex Report

    Hi Experts,
    We have a Month to date Report, in this report we need to display only day value instead of DATE value,
    Like
    if Date is 14.05.2010 we need to show only  14
    Regards,
    Chandra

    Hi ,
    Thanks for Quick Response
    we does have the option to create the char(calday or ...) value variable replacement with char (calday or ...) info object, we can  replace with Report r variable value only not with info object.
    i hope we can replace the with info object only with formula variable with replacement.
    My BEx Report is Designed like
    Columns
    0Calday
    Rows
    Plant
    Keyfigures
    Actual
    Plan
    Report output Looks like month to date
    0CALDAY            01.06.2010   02.06.2010  03.06.2010
    P1  ACTUAL            10                     8                    4
    P1  PLAN                 15                     6                    2
    P2  ACTUAL              5                   10                     7
    P2  PLAN                  4                      8                    3
    Report should be
    0CALDAY            1    2     3
    P1  ACTUAL      10     8      4
    P1  PLAN           15     6     2
    P2  ACTUAL        5    10    7
    P2  PLAN            4      8     3
    please let me know how can i achive this
    Regards
    Chandra

  • While displaying date its displaying 1 Day  behind

    Hi All,
    I am saving date using ,
    <t:inputCalendar renderAsPopup="true" value="#{Bean.startDate}" />
    After saving I am retriving date & displaying as,
    <h:outputText value="#{beanVar.startDate}"/>
    But its displaying 1 day behind.
    Do i need to use converter while displaying
    Thanks.

    Hello Gurus,
    I am new to GRC, I have to create a background job for RA&R daily  Management Reports. I have created a background job by going to Risk Analysis>user level->Risk level>Critical>Report Format>Management summary>clicking on Background>setting the backgorund job for daily.
    But the background is failing to display the report. I ran in the foreground and it works fine.
    Please let me know if I am doing anything wrong in the steps..
    Thank you!
    Regard's,
    SA

  • Need to Display Data for Cummulated to Current Day of Current Fiscal Year

    We use fiscal variant V3 (April-March).  My need is to display data automatically from first of fiscal period (April 1 2006) to today.
    I tried using 0CYTCD on Calendar Day but this works only for the current calendar year that the system is in  i.e 2007.
    Is there a standard variable I can use on 0CALDAY so I always get data from day one of current fiscal year/period to today? e.g. April 1, 2006 to January 3, 2007
    If not, can someone please help with the exact customer exit code that I would need to write in CMOD in BW?
    Thanks a ton!

    I thought of using 0FYTCD variable, but I cannot find it in the business content.
    Has anyone used 0FYTCD (Fiscal year to current day) in BW 3.1 SP25?
    Again, I am looking for a variable that would get me the beginning of fiscal year to today.
    Thanks.

  • How to count days between two dates excluding saterady and sunday

    Hi all
    iam working on oracle sql/plsql.
    In my application , i need to caliculate leave days between two dates excluding saterady and sunday
    Please tell me the solution if any one knows
    thanks in advance ,
    balu

    More modern version:
    WITH date_tab AS
    (SELECT TO_DATE ('&from_date', 'dd-MON-yyyy')
    + LEVEL
    - 1 business_date
    FROM DUAL
    CONNECT BY LEVEL <=
    TO_DATE ('&to_date', 'dd-MON-yyyy')
    - TO_DATE ('&from_date', 'dd-MON-yyyy')
    + 1)
    SELECT business_date
    FROM date_tab
    WHERE TO_CHAR (business_date, 'DY') NOT IN ('SAT', 'SUN');Thank you,
    Tony Miller
    Webster, TX
    Never Surrender Dreams!
    JMS
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Unable to display data no entry in the table without using Model clause

    Hi,
    I've an urgent requirement described below :
    The previously posted Question has been answerted using Model Clause:
    Is there any way out to solve it without using Model clause:
    I've a table named as "sale" consisting of three columns : empno, sale_amt and sale_date.
    (Please ref. The table script with data as given below)
    Now if I execute the query :
    "select trunc(sale_date) sale_date, sum(sale_amt) total_sale from sale group by trunc(sale_date) order by 1"
    then it displays the data for the dates of which there is an entry in that table. But it does not display data for the
    date of which there is no entry in that table.
    If you run the Table script with data in your schema, then u'll see that there is no entry for 28th. Nov. 2009 in
    sale table. Now the above query displays data for rest of the dates as its are in sale table except for 28th. Nov. 2009.
    But I need its presence in the query output with a value of "sale_date" as "28th. Nov. 2009" and that of "total_sale" as
    "0".
    Is there any means to get the result as I require?
    Please help ASAP.
    Thanks in advance.
    Create table script with data:
    CREATE TABLE SALE
    EMPNO NUMBER,
    SALE_AMT NUMBER,
    SALE_DATE DATE
    SET DEFINE OFF;
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('12/01/2009 10:20:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/30/2009 10:21:04', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/29/2009 10:21:05', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/26/2009 10:21:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/25/2009 10:21:07', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 5000, TO_DATE('11/27/2009 10:23:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 4000, TO_DATE('11/29/2009 10:23:08', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 3000, TO_DATE('11/24/2009 10:23:09', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 2000, TO_DATE('11/30/2009 10:23:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 7000, TO_DATE('11/24/2009 10:24:19', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 5000, TO_DATE('11/25/2009 10:24:20', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 3000, TO_DATE('11/27/2009 10:24:21', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 2000, TO_DATE('11/29/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 1000, TO_DATE('11/30/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    Any help will be needful for me
    Regards,

    select sale_date,sum(sale_amt) total_sale
    from
    select empno,0 sale_amt,(sale_date + ao.rn) sale_date
    from
    select empno,sale_amt,sale_date ,(t.nxt_dt - t.sale_date) diff
    from
    select empno
    ,sale_amt,trunc(sale_date) sale_date
    ,trunc(nvl(lead(sale_date) over (partition by 1 order by sale_date),sale_date)) nxt_dt
    from sale
    ) t
    where (t.nxt_dt - t.sale_date) >1
    ) rec,(select rownum rn from user_objects where rownum<=200) ao
    where ao.rn <=(rec.diff-1)
    union all
    select empno,sale_amt,trunc(sale_date) sale_date
    from sale
    group by sale_date
    order by 1;
    ~~~~Guess this will serve the purpose...
    Cheers Arpan

  • Date & Day & Month please help

    Hi Scripters,
    I have creat a diary book in InDesign CS4.
    Probelm: I want to alert the date and day for each time like this. But after the 7 saturday after alert the 8th day is undefined result.
    Date     Day
    1          Sunday
    2          Monday
    3          Tuesday
    4          Wednesday
    5          Thursday
    6          Friday
    7          Saturday          This is alert fine after the date execute in 8 i want to alert Day "Sunday" but i get it result in "undefined"
    Please check my Below JS Code Give your valuable output.
    var myMonth= new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
    var myDay = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    var myThirty = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30");
    var myThirtyfirst = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
    var myFeb = new Array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28");
    for(i=0; i<myMonth.length; i++){
        if(myMonth[i]=="January"){
            for(j=0; j<=myThirtyfirst.length; j++){
                alert(myThirtyfirst[j]+"|"+myDay[j]);
                   // after the 8 day is alert is shown  in undefined; i want to continue after the next month is started in wednesday or some other day please check
        else if(myMonth[i]=="February"){
            for(j=0; j<=myFeb.length; j++){
                alert(myFeb[j]+"|"+myDay[j]);
        else if(myMonth[i]=="March"){
            for(j=0; j<=myThirtyfirst.length; j++){
                alert(myThirtyfirst[j]+"|"+myDay[j]);
    Note: Saturday & Sunday will come in one alert. Definitely i am confused little bit think so.
    thx
    csm_phil

    Hi csm_phil,
    Another problem in your code is that you're counting one too many in a number of spots. If you're counting from 0, you can only go to length-1 - so
    for(j=0; j<=myThirtyfirst.length; j++){
    should be.
    for(j=0; j<myThirtyfirst.length; j++){
    The way I generally code it is, depending on what I am counting: if I count from 0, I use < when comparing the counter to the length; if I start from 1, I use <= when comparing your counter to the length.
    Now, independent of that, your code is overly complex - as the other posters already said: at least check out the built-in Date object, or that cool Date library Marc referred us to.
    Date and time calculations are very tricky to get right, and lucky for us there is no need to reinvent the wheel!

  • Finding date,day of the whole month

    dear members,
    can i find the date, day of a specific month in a query. Is there any default functionality, or built-in.
    e.g. select date,day
    from .........
    where month='JAN';
    date day
    01-01-2011 sunday
    02-01-2011 monday
    31-01-2011 tuesday
    thanks.
    teefu.

    Dear,
    There is someone here in this otn site who wrote a very nice sql script which gives a kind of calendar. I have sligthly updated his script as follows
    with x
               as (
            select *
              from (
            select to_char(trunc(to_date('01062011','ddmmrrrr'),'mm')+level-1,'iw') wk,
                  to_char(trunc(to_date('01062011','ddmmrrrr'),'mm')+level-1,'dd') dm,
                  to_number(to_char(trunc(to_date('01062011','ddmmrrrr'),'mm')+level-1,'d')) dw,
                  to_char(trunc(to_date('01062011','ddmmrrrr'),'mm')+level-1,'mm') curr_mth,
                  to_char(to_date('01062011','ddmmrrrr'),'mm') mth
            from dual
           connect by level <= 31
           where curr_mth = mth
          select max(case dw when 2 then dm end) Monday,
                 max(case dw when 3 then dm end) Tuesday,
                 max(case dw when 4 then dm end) Wednesday,
                 max(case dw when 5 then dm end) Thursday,
                 max(case dw when 6 then dm end) Friday,
                 max(case dw when 7 then dm end) Saturday,
                 max(case dw when 1 then dm end) Sunday
            from x
           group by wk
           order by wkSorry I didn"t find the original post in which this sql has been initially posted
    Hope this helps
    Mohamed Houri

Maybe you are looking for

  • Error 1 Configuration VIs while Passing Refnum through Shift Register on Mac

    All, I am using LabVIEW 2013 SP1 with Mac OS X (Mavericks). I have a simple shift register VI that initializes a .ini file, reads/writes, and closes. I've done this plenty times on windows with no problem. I wrote a quick VI on Mac and I get Error 1.

  • About RFC and BAPI

    Hello Masters,              What Makes the exact difference between RFC and BAPIs. Both can perfom same thing. BAPI uses the RFCs only. Then how can it justify? Thank you

  • Facetime still isn't working.

    Hi,      didn't see an up to date answer to this question so... My Facetime hasn't worked at all for a while, I've got an iPod touch 5g and Macbook Air running iOS 7.1.2 and OS X 10.9.4 and the other person is updated as well.  I've made sure Facetim

  • Changing Output

    Does anyone know how to change the itunes output device?

  • Quicktime Pro exporting to WMV -- only exports 30 seconds?

    Have 7.6.6 PRO and am exporting to WMV. But I only get 30 seconds of video? Any ideas?