Specify a date range for a date field.

Hi folks,
I have cobbled together some javascript using code that someone provided in response to my thread about setting a maximum length between two dates as reference.
My aim is to enforce a minimum date of 01/01/2014 and a maximum date of 31/12/2014. Any date entered that are outside of tis range should result in a warning message.
When I use the below code, I find that the warning message pops up before I ahve even had a chnace to enter any dates, and also when I enter an invalid date it pops up over and over until the program crashes.
Can anyone tell me how I can fix this?
Cheers.
function Scand(cFormat, cString) {
var oDate = util.scand(cFormat, cString);
if(oDate == null) app.alert("Error converting date " + cString + " with format of " + cFormat, 0, 0);
return oDate;
function GetField(cName) {
var oField = this.getField(cName);
if(oField == null) app.alert("Proposed Completion date cannot be more than 180 days after Commencement Date. Please revise " + cName);
return oField;
var date1 = (GetField('Field 30')).value;
var cDateFormat = 'dd-mm-yyyy'; // adjust to match input field's format;
var oDate1 = Scand(cDateFormat, date1)
var nDate1 = Math.floor(oDate1.getTime() / (1000 * 60 * 60 * 24))
if(nDate1 < 01-01-2014) app.alert('Date cannot be earlier than 01/01/2014');
if(nDate1 > 31-12-2014) app.alert('Date cannot be later than than 31/12/2014');
this.getField("Proposed Completion Date").setFocus();
event.rc = false;

When putting in Epoch time, do I just literally replace the dates in if(nDate1 < 01-01-2014) with the Epoch time value e.g. if(nDate1 < 1388531238)   because now its not calculating correctly, or am I misunderstanding what it is?  I tested by putting in today's date 19/02/2014 and still got the alert saying that it was before 1/01/2014...

Similar Messages

  • DMS :Select Range for User defined fields in Classification Tab in CV04N

    Dear All,
    We have added User Define Fields Date field in Classification Tab in CV04N Transaction But it has single search (parameter) where we need to have Date range selection (Like Select Option) for the documents.
    I request you to suggest me some solution whether it is possible to achieve with any standard configuration as it is very critical to the Business .
    I would appreciate for your quick response and support.
    Thanks in Advance,
    Regards,
    Vishal.

    Dear Ravindra,
    Actually My requirement is when we enter the exact date in the input field its giving the documents submitted on that date.But when i give date range its not displaying the any documents where the document submited in between those two dates.
    Ex: I have submitted the document ( in CV01N ) for the approval on 10.05.2010(this is the same field in classification).
    In the CV04N transaction ,classification tab if I enter date as 10.05.2010 its giving the document submitted on that date.but if I enter the two dates 01.05.2010 and 20.05.2010 where document is been created B/W the input dates.
    Please suggest how to fulfill my business requirement ,I also request to check any configuration for the user defined fields can solve this problem instead of selecting single value when it can select the range of values.
    Thanks for your earlier reply.
    Regards,
    Vishal.

  • Specify a range for a Numeric Field

    I have a numeric field in a form. I want to restrict the valid entries to 0 - 30 only. I have tried using some script tips I found online, but all I get are errors. Is there anyway to do this without using a script? If script is the only way, I would certainly appreciate help. Thanks in advance!
    - Rick

    On the Exit event of the field put you can put something like the following (make sure the Script Editor is set to JavaScript):
    if (this.rawValue < 0 || this.rawValue > 30) {
              xfa.host.messageBox("Amount needs to be between 0 and 30.", "Error: Wrong Amount");
              this.rawValue = null;

  • ERS number range for France (reference field) ECC 5.0

    Hi,
    We have done the required settings for the vendor wise sequential reference number in ERS invoices for France.
    1. create number group
    2. create number range
    3. assign number range in company code additional data
    4. assign number range group in 'tax number 4' in vendor master
    Still, the sequential number is not updated in the ERS vendor invoices. And MM document number is getting updated in the reference field.
    What could be wrong? Any clue?
    Regards,

    I got the same problem.
    I have OSS but could not find any notes relating to this.
    Looking for help too.

  • External number range for SUSPO in SUS-MM

    Hello there,
    I'm running ECC 6.0 with SUS-MM 5.0 (SRM server 5.5). When transferring ECC purchase orders from ECC 6.0 to SUS-MM the resulting SUSPO is created using internal number assignment.
    Thus I'm having an ECC purchase order 45xxxxxxxx referring to a SUSPO 30xxxxxxxx.
    I do have an external number range of 45xxxxxxxx in SUS-MM.
    Any suggestions/comments very much appreciated.
    Cheers,
    Franz

    Hi ,
    This is what i got from HELP
    >
    Define Number Ranges for Purchase Orders
    Use
    In this IMG activity, you specify the number ranges for purchase orders in SAP Supplier Self-Services (SAP SUS).
    Only carry out this IMG activity if you create purchase orders locally in SAP SUS.
    Activities
    1. Choose Changes Intervals -> Insert Interval.
    2. Specify at least one number range.
    Note that you must enter the number ranges specified here when you edit the transaction types. For more information, see
    Vorgangsarten festlegen.
    3. If you set the External indicator, suppliers can enter their own numbers in SAP SUS. If  you do not set the indicator, the system generates numbers automatically  (internal number assignment).
    Further notes
    To export number range objects,  go to the Maintain Number Ranges screen and choose Interval -> Transport.
    Note that,  before the target system imports the number range objects from the source system it deletes all of the intervals for the selected number range objects. This means that after the import, the target system only contain intervals that were exported from the source system.
    You cannot transport or convert dependent tables.
    >
    so according to this , it should be possible to have external number , please check wether you have maintained customizing for SUS purchase order numbers at correct place.
    reward poins if usefull

  • How to set a date range for date field ?

    Dear Experts,
    Scenario:
    I have a query in validating the date field in my BSP application. My application is for maintain infotype 0023 Other/Previous Employers online by employees in the company.
    As per our design we are maintaining the all employment details of the employee both ( with in the current company / previous employment outside the company) in the same infotype.
    Every employee will have a hiring date within the SAP HR system. We consider this date as the cutoff date between current and previous employment in our application. When the employee updating the details wia BSP page I need to check the following.
    Record inside current company: Validation that, the user should only able to enter BEGIN DATE (BEGDA)  greater than or equal HIRING DATE and END DATE(ENDDA) should be greater than FROM  DATE (BEGDA).
    Record outside current Company: Validation that, the user should only able to enter BEGIN DATE (BEGDA)  less than or equal HIRING DATE and END DATE (ENDDA) should be greater than FROM  DATE (BEGDA) and less than HIRING DATE.
    Technical Requirement:
    How to set a date range for date field, i.e. how we can limit the date range in a HTMLB date field? Can this it be achieved via standard functionality of HTMLB?
    Following is the code to describe date field in my application.
        <htmlb:inputField id= "ENDDA_NEW_IN"
                          type= "date"
                    doValidate= "TRUE"
                      showHelp= "TRUE"
                      disabled= "FALSE"
                         width= "183"
                         style= "cssTextAreadate"
                         value= "<%='99991231'%>"/>
    Thanks a lot in advance for your assistance and help.
    Cibinu2026
    Edited by: cibin kuruvilla on Nov 12, 2008 11:13 AM

    Hi,
    This functionality is known to be very important and is a key part of the next major release of the JRC planned for the first half of 2008.
    Regards,
    <p>Blair Wheadon</p>
    <p>Product Manager, Crystal Reports</p>

  • How can I set a date range for a Date/Time Field in LiveCycle ES2?

    I need to set a specific date range for a form set up in LiveCycle ES2. Cannot see where i allows me to do that without a code entered.

    Hi,
    You can't set a start and end date for the date/time field, the best you can do is validate the range after the user has selected it.
    An alternate is to make your own date / time field, like this sample http://adobelivecycledesignercookbookbybr001.blogspot.com.au/2013/05/an-alternative-date-p icker-for.html
    Regards
    Bruce

  • Specifying a Date Range for Interactive Reports

    Hi All,
    I'm currently working on Oracle Application Express 11. We have created an application with a standard reports page. On this page there are the following items:
    HTML Region 1: (Parameters)
    Start Date: (Date Picker)
    End Date: (Date Picker)
    Amount: (Displays Read-Only Amount)
    HTML Region 2: (Specify Report)
    Violation Reports (link 1)
    Correct Reports (link 2)
    Fault Reports (link 3)
    All Reports (link 4)
    I would like to know if it's possible that I could enforce the following scenarios on a user:
    If a user clicks a link without specifying a date range, then an error message is displayed prompting the user to specify Start Date & End Date.
    If a user specifies a Start Date that is outside the table's date range, then an error message is displayed prompting the user to enter a valid Start Date. For instance, if the first ever date on the database table is 17/JUL/97 then if a user specifies 16/JUL/97 as his/her Start Date then an error message will be displayed prompting the user to specify a start date from 17/JUL/97 onwards.
    Is this possible? Please advice!
    THANK YOU IN ADVANCE
    Kamo

    Hi Kamo,
    In order for the dates to be used on the reports (which is what I assume you are trying to do?), the user must submit the page to get the dates into the session. Given that, you could have Validation on your page that checks the criteria you need when the page is submitted. You could also have your Region 2 conditional on the dates not being NULL - that way, the user can not click on a link until both dates have been entered and submitted.
    Andy

  • Reg:how disaplay selection range for date field

    hi all
    can you please  let me know how to write  the code in wdabap  to display a date field with range option.i mean in abap we use at selection screen  ,but coming to wdabap can you  help how to write the code in wdabap.
    Thanks in advance
    Deepika

    To simplify the requirement, let me consider the followign understanding:
    1. You need few fields in the selection screen. They need to be select options and some parameter fields.
    2. The user clicks the button. You need to read teh user entered data.
    Once, you have teh data in your code, assign it to the context node - attributes. later, you need to decide what you shoudl do with that data.
    Sol: 1. To obtain fields into selection screen, use the component "wdr_select_options" and *** the interface view into your window. Make the view as default.
    Now,  you need to build the select options. Firstly create a method or insert the code in init().
    DATA: lr_componentcontroller TYPE REF TO ig_componentcontroller,
            l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
    create the used component
      l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
      wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
    init the select screen
      wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
      wd_this->m_handler->set_global_options(
                                  i_display_btn_cancel  = abap_false
                                  i_display_btn_check   = abap_false
                                  i_display_btn_reset   = abap_true
                                  i_display_btn_execute = abap_false ).
    Adding a block (type Tray) to the select-options
      wd_this->m_handler->add_block(
        i_id         = `BSC01`
        i_block_type = if_wd_select_options=>mc_block_type_tray
        i_title      = `Selection Screen` ).
    Adding a parameter field to the created block
    Create a reference to the type of customer number KUNNR
      CREATE DATA lr_field TYPE kunnr.
    Sets the airline code initial value
      ASSIGN lr_field->* TO <fs_field>.
    Add the parameter to the group
      wd_this->m_handler->add_parameter_field(
        i_id           = `KUNNR`
        i_within_block = `BSC01`
        i_obligatory   = abap_true
        i_value        = lr_field ).
    FREE lr_field.
    Adding a select-options field to the created block
    Create a reference to the material number range table
      lr_field = wd_this->m_handler->create_range_table( `MATNR` ).
    Add the select-option to the group
      wd_this->m_handler->add_selection_field(
        i_id           = `MATNR`
        i_within_block = `BSC01`
        it_result      = lr_field ).
      FREE lr_field.
    The code with method "set_global_options" is used to make the buttons visible or disappear.
    Its convinient to create your own button with an action instead or subscribing to the action of exceute button.
    Sol. 2: Read the data.
      FIELD-SYMBOLS:
        <fs_sel_item> LIKE LINE OF lt_sel_item,
        <fs_kunnr>   TYPE kunnr,
        <fs_matnr>   TYPE ranges_matnr.
        wd_this->m_handler->get_value_of_parameter_field(
          EXPORTING i_id = 'KUNNR'
          RECEIVING r_value = p_kunnr ).
    Get the selection-screen items
          wd_this->m_handler->get_selection_fields(
            IMPORTING et_fields = lt_sel_item ).
    Retrieve the values from the select-options items
          LOOP AT lt_sel_item ASSIGNING <fs_sel_item>.
            CASE <fs_sel_item>-m_id.
              WHEN `MATNR`.
                ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_matnr>.
             WHEN < Other sel-option'
           ENDCASE.
         ENDLOOP.
    Obtain a reference to your context node and assign the field symbols to the attributes.
    Finally, you would have the data in your nodes. Now, you need to handle the coe as per your req.
    Regards,
    Sharath
    Edited by: Sharath M G on Aug 27, 2010 9:45 AM

  • EasyDMS - search by date range for characteristics of type date

    Hi Folks,
    I have a characteristic of type date in the additional data of a DMS document. If I enter the date (for example validity date) as 08/31/2009 and search using cv04n and give a date range for the characteristic (i.e. 01/01/2009 - 12/31/2009), the search result will bring up the document.
    However, I cannot do this from the EasyDMS find function. I need to specify an exact date. This is not very helpful for user who need to find documents with a validity date between 01/01/2009 - 12/31/2009 for example. Is there a way users can search for date range in EasyDMS find function?
    Thanks,
    Lashan

    To search a date range with EasyDMS Client you have to set the registry key
    \HKEY_CURRENT_USER\Software\SAP\EasyDms\Generel\DateSearchPick to Value 0
    Then you can use the input field like in SAP-Gui. (01.01.2009-31.01.2009)
    If you set the value to 1 or the key is not defined you can only search for one specified date.
    If you don't find this key on your PC create it as dword.
    Maybe you must restart you PC for takeing effect.
    Hope this will help you.
    Regards Wolfgang

  • Select-options for date field.

    Hi all,
    i need to give select options for Date field.How can i give that.
    Thanks & Regards
    Ravi.

    Hi Ravi,
    Use the Component WDR_SELECT_OPTIONS to include select options in Web Dynpro ABAP. Follow these steps:
    1. In your Component , "Used Componet" tab add Component WDR_SELECT_OPTIONS . Component Use can be any name that you want to give, eg SELECT_OPTIONS
    2. Go to the View where you want to include the Date Select Options. I am assuming that you already have an Attribute of Type DATS in your context.
    3. View: Properties Tab:Create Controller Usage and select
    SELECT_OPTIONS     WDR_SELECT_OPTIONS                   
    SELECT_OPTIONS     WDR_SELECT_OPTIONS     INTERFACECONTROLLER
    4. View Layout Tab:Include a View Container. In this view container we will show the Date Select Options.
    5. View Attributes Tab: Create Following two attributes:
    M_HANDLER type IF_WD_SELECT_OPTIONS
    M_WD_SELECT_OPTIONS type IWCI_WDR_SELECT_OPTIONS
    6: View Methods Tab: Create a method eg CREATE_SELECTION_SCREEN. Call this method in the WDDOINIT of the view.
    7:CREATE_SELECTION_SCREEN: Write following Code:
    * Data Declaration
      data:
            lt_range_table TYPE REF TO DATA.
      data:
            lr_componentcontroller TYPE REF TO IG_COMPONENTCONTROLLER,
            lr_componentusage TYPE REF TO IF_WD_COMPONENT_USAGE.
    * Execution
    *  Create Used Component
      lr_componentusage = wd_this->wd_cpuse_select_options( ).
      if LR_COMPONENTUSAGE->HAS_ACTIVE_COMPONENT( ) is initial.
        lr_componentusage->create_component( ).
      endif.
    *  Get pointer to interface controller of select options
      wd_this->M_WD_SELECT_OPTIONS = wd_this->wd_cpifc_select_options( ).
    * initialize selction screen
      wd_this->M_HANDLER = wd_this->M_WD_SELECT_OPTIONS->init_selection_screen( ).
    *  Create Range Table for: Date
      CALL METHOD WD_THIS->M_HANDLER->CREATE_RANGE_TABLE
        EXPORTING
          I_TYPENAME     = 'DATS'
        RECEIVING
          RT_RANGE_TABLE = lt_range_table.
    * Add Selection Field for: Date
      CALL METHOD WD_THIS->M_HANDLER->ADD_SELECTION_FIELD
        EXPORTING
          I_ID                         = '<name of date attribute in the context>'
    *      I_WITHIN_BLOCK               = MC_ID_MAIN_BLOCK
    *      I_DESCRIPTION                =
    *      I_IS_AUTO_DESCRIPTION        = ABAP_TRUE
          IT_RESULT                    = lt_range_table
    *      I_OBLIGATORY                 = ABAP_FALSE
    *      I_COMPLEX_RESTRICTIONS       =
    *      I_USE_COMPLEX_RESTRICTION    = ABAP_FALSE
    *      I_NO_COMPLEX_RESTRICTIONS    = ABAP_FALSE
    *      I_VALUE_HELP_TYPE            = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_NONE
    *      I_VALUE_HELP_ID              =
    *      I_VALUE_HELP_MODE            =
    *      I_VALUE_HELP_STRUCTURE       =
    *      I_VALUE_HELP_STRUCTURE_FIELD =
    *      I_HELP_REQUEST_HANDLER       =
    *      I_LOWER_CASE                 =
    *      I_MEMORY_ID                  =
    *      I_NO_EXTENSION               = ABAP_FALSE
    *      I_NO_INTERVALS               = ABAP_FALSE
    *      I_AS_CHECKBOX                = ABAP_FALSE
    *      I_AS_DROPDOWN                = ABAP_FALSE
    *      IT_VALUE_SET                 =
    *      I_READ_ONLY                  = ABAP_FALSE
    *      I_DONT_CARE_VALUE            =
    *      I_EXPLANATION                =
          I_TOOLTIP                    = 'Select Date'.
    8: To Fetch Data entered in the selection field, write following code on action of button click:
      data:
            lt_date type REF TO DATA.
    FIELD-SYMBOLS:
                     <fs_date> TYPE table.
      *  retrieve Date from Select Options
      CALL METHOD WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD
        EXPORTING
          I_ID           = '<attrib_name>'
        RECEIVING
          RT_RANGE_TABLE = lt_date.
    *  assign Date Field Symbol
      ASSIGN lt_date->* to <fs_date>.
    9: Windows Window Tab: In the View Conatiner, embed the WND_SELECTION_SCREEN view from SELECT_OPTIONS component Usage of  WDR_SELECT_OPTIONS component.
    Regards,
    Reema.

  • I want to print a calendar by specifying the date range

    I want to be able to print from ICal in a 4 week block but not by month. Our calendar is updated regularly and I want to be able to print out the forward 4 weeks, not this month which gives me dates already past.
    And I do not want to print out 4 individual weeks.
    I know how to print Month and Week but these don't do it for me.
    How can I specify a date range?
    Cheers
    Rusty

    Hello @jgolf ,
    I would like to direct your attention to the following post by PrintApper .
    HP Apps Service Retired on several printers
    Aardvark1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!

  • Calendar Functionality for a date field in HTML of  a ITS service

    Hi
    I am working with SRM EBP module we want to add date help(with calendar function) to existign date fields in Shopping cart and PO screens . I found some HTML and Javascripts in SYSTEM and BBPGLOBAL services (named as calendar)but not sure which ones to use if anyone used date functionality or even have access to Standard SAP ITS screens that already have date field with calendar fuctionality can you help???????????????
    Thanks in Advance

    Hi
    Let me first thank you for the quick response and timely help you provided calendar popup works great but one minor issue i am not able to click on the date entry and bring the field back into the field not sure if this funcitonality is in show_calendar.
    I would really appreciate if you get time to look at below i am almost there with your help......thanks again
    Here are the steps I did
    I have a HTML page  SAPLBBP_SC_UI_ITS screen 300 in SRM module , I created a new HTML page (zcalendar.html) in the same internet service BBPSC01 as suggested and I included in my HTML page SAPLBBP_SC_UI_ITS screen 300 and also I added below code to add a icon and a href call to the show_calendar function.
    Code works great I get the popup but when I double click on the date it is not selecting the date into the field back .
    Any thoughts??????
    <!-- Start ghantavine -->
    `include (~service="bbpsc01", ~name="zcalendar.html")`
    <!-- End ghantavine -->
    <!--    10/24/05 ghantavine--delivary date  -->
    `TR()`
        `if (GS_SCR_BASIC_I-DELIV_DATE.visible)`    
         `TR()`                                    
           `if (gs_scr_basic_i-deliv_date.disabled)`
              `TD(class="label", nowrap="x",
    active="")``TXT_BASIC_I-DELIV_DATE.label` 
              `TD(class="label", nowrap="x", active="")``gs_scr_basic_i-deliv_date.value`
            `else`  
                `TD(class="label", nowrap="x", active="")`<label
    for="`GS_SCR_BASIC_I-DELIV_DATE.name`">`TXT_BASIC_I-DELIV_DATE.label`</label>     
                `TD(class="data",  nowrap="x")`  
                <input type="text" id="GS_SCR_BASIC_I-DELIV_DATE"
    name="GS_SCR_BASIC_I-DELIV_DATE"  value="`GS_SCR_BASIC_I-DELIV_DATE.value`"
    maxlength="010" size="008">          
           <a href=http://mail.yahoo.com/config/login?/"_javascript:show_calendar();">
           <img id="anchor1" src="`mimeurl(~service="bbpglobal",
    ~name="images/button/f4.gif", ~language="", ~theme="99")`" />
           </a>
             `end`
          `TR()` `Lines()`
        `end`
    <!--      10/24/05 ghantavine--delivary date    -->
    below is the showcalendar code
    Hi , u save this as a html file and call this show_calendar fn  from Onclick button of your Calendar image .
    //  For generating the calendar
    var weekend = [0,6];
    var weekendColor = "#e0e0e0";
    var fontface = "Verdana";
    var fontsize = 2;
    var gNow = new Date();
    var ggWinCal;
    isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
    isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
    Calendar.Months = ["January", "February", "March", "April", "May", "June",
    "July", "August", "September", "October", "November", "December"];
    // Non-Leap year Month days..
    Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    // Leap year Month days..
    Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    function Calendar(p_item, p_WinCal, p_month, p_year, p_format) {
         if ((p_month == null) && (p_year == null))     return;
         if (p_WinCal == null)
              this.gWinCal = ggWinCal;
         else
              this.gWinCal = p_WinCal;
         if (p_month == null) {
              this.gMonthName = null;
              this.gMonth = null;
              this.gYearly = true;
         } else {
              this.gMonthName = Calendar.get_month(p_month);
              this.gMonth = new Number(p_month);
              this.gYearly = false;
         this.gYear = p_year;
         this.gFormat = p_format;
         this.gBGColor = "white";
         this.gFGColor = "black";
         this.gTextColor = "black";
         this.gHeaderColor = "black";
         this.gReturnItem = p_item;
    Calendar.get_month = Calendar_get_month;
    Calendar.get_daysofmonth = Calendar_get_daysofmonth;
    Calendar.calc_month_year = Calendar_calc_month_year;
    Calendar.print = Calendar_print;
    function Calendar_get_month(monthNo) {
         return Calendar.Months[monthNo];
    function Calendar_get_daysofmonth(monthNo, p_year) {
         Check for leap year ..
         1.Years evenly divisible by four are normally leap years, except for...
         2.Years also evenly divisible by 100 are not leap years, except for...
         3.Years also evenly divisible by 400 are leap years.
         if ((p_year % 4) == 0) {
              if ((p_year % 100) == 0 && (p_year % 400) != 0)
                   return Calendar.DOMonth[monthNo];
              return Calendar.lDOMonth[monthNo];
         } else
              return Calendar.DOMonth[monthNo];
    function Calendar_calc_month_year(p_Month, p_Year, incr) {
         Will return an 1-D array with 1st element being the calculated month
         and second being the calculated year
         after applying the month increment/decrement as specified by 'incr' parameter.
         'incr' will normally have 1/-1 to navigate thru the months.
         var ret_arr = new Array();
         if (incr == -1) {
              // B A C K W A R D
              if (p_Month == 0) {
                   ret_arr[0] = 11;
                   ret_arr[1] = parseInt(p_Year) - 1;
              else {
                   ret_arr[0] = parseInt(p_Month) - 1;
                   ret_arr[1] = parseInt(p_Year);
         } else if (incr == 1) {
              // F O R W A R D
              if (p_Month == 11) {
                   ret_arr[0] = 0;
                   ret_arr[1] = parseInt(p_Year) + 1;
              else {
                   ret_arr[0] = parseInt(p_Month) + 1;
                   ret_arr[1] = parseInt(p_Year);
         return ret_arr;
    function Calendar_print() {
         ggWinCal.print();
    function Calendar_calc_month_year(p_Month, p_Year, incr) {
         Will return an 1-D array with 1st element being the calculated month
         and second being the calculated year
         after applying the month increment/decrement as specified by 'incr' parameter.
         'incr' will normally have 1/-1 to navigate thru the months.
         var ret_arr = new Array();
         if (incr == -1) {
              // B A C K W A R D
              if (p_Month == 0) {
                   ret_arr[0] = 11;
                   ret_arr[1] = parseInt(p_Year) - 1;
              else {
                   ret_arr[0] = parseInt(p_Month) - 1;
                   ret_arr[1] = parseInt(p_Year);
         } else if (incr == 1) {
              // F O R W A R D
              if (p_Month == 11) {
                   ret_arr[0] = 0;
                   ret_arr[1] = parseInt(p_Year) + 1;
              else {
                   ret_arr[0] = parseInt(p_Month) + 1;
                   ret_arr[1] = parseInt(p_Year);
         return ret_arr;
    // This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists.
    new Calendar();
    Calendar.prototype.getMonthlyCalendarCode = function() {
         var vCode = "";
         var vHeader_Code = "";
         var vData_Code = "";
         // Begin Table Drawing code here..
         vCode = vCode + "<TABLE BORDER=1 BGCOLOR=\"" + this.gBGColor + "\">";
         vHeader_Code = this.cal_header();
         vData_Code = this.cal_data();
         vCode = vCode + vHeader_Code + vData_Code;
         vCode = vCode + "</TABLE>";
         return vCode;
    Calendar.prototype.show = function() {
         var vCode = "";
         this.gWinCal.document.open();
         // Setup the page...
         this.wwrite("<html>");
         this.wwrite("<head><title>Calendar</title>");
         this.wwrite("</head>");
         this.wwrite("<body " +
              "link=\"" + this.gLinkColor + "\" " +
              "vlink=\"" + this.gLinkColor + "\" " +
              "alink=\"" + this.gLinkColor + "\" " +
              "text=\"" + this.gTextColor + "\">");
         this.wwriteA("<FONT FACE='" + fontface + "' SIZE=2><B>");
         this.wwriteA(this.gMonthName + " " + this.gYear);
         this.wwriteA("</B><BR>");
         // Show navigation buttons
         var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
         var prevMM = prevMMYYYY[0];
         var prevYYYY = prevMMYYYY[1];
         var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
         var nextMM = nextMMYYYY[0];
         var nextYYYY = nextMMYYYY[1];
         this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "'" +
              ");" +
              "\"><<<\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\"><<\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\">><\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "'" +
              ");" +
              "\">>><\/A>]</TD></TR></TABLE><BR>");
         // Get the complete calendar code for the month..
         vCode = this.getMonthlyCalendarCode();
         this.wwrite(vCode);
         this.wwrite("</font></body></html>");
         this.gWinCal.document.close();
    Calendar.prototype.showY = function() {
         var vCode = "";
         var i;
         var vr, vc, vx, vy;          // Row, Column, X-coord, Y-coord
         var vxf = 285;               // X-Factor
         var vyf = 200;               // Y-Factor
         var vxm = 10;               // X-margin
         var vym;                    // Y-margin
         if (isIE)     vym = 75;
         else if (isNav)     vym = 25;
         this.gWinCal.document.open();
         this.wwrite("<html>");
         this.wwrite("<head><title>Calendar</title>");
         this.wwrite("<style type='text/css'>\n<!--");
         for (i=0; i<12; i++) {
              vc = i % 3;
              if (i>=0 && i<= 2)     vr = 0;
              if (i>=3 && i<= 5)     vr = 1;
              if (i>=6 && i<= 8)     vr = 2;
              if (i>=9 && i<= 11)     vr = 3;
              vx = parseInt(vxf * vc) + vxm;
              vy = parseInt(vyf * vr) + vym;
              this.wwrite(".lclass" + i + " {position:absolute;top:" + vy + ";left:" + vx + ";}");
         this.wwrite("-->\n</style>");
         this.wwrite("</head>");
         this.wwrite("<body " +
              "link=\"" + this.gLinkColor + "\" " +
              "vlink=\"" + this.gLinkColor + "\" " +
              "alink=\"" + this.gLinkColor + "\" " +
              "text=\"" + this.gTextColor + "\">");
         this.wwrite("<FONT FACE='" + fontface + "' SIZE=2><B>");
         this.wwrite("Year : " + this.gYear);
         this.wwrite("</B><BR>");
         // Show navigation buttons
         var prevYYYY = parseInt(this.gYear) - 1;
         var nextYYYY = parseInt(this.gYear) + 1;
         this.wwrite("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', null, '" + prevYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\" alt='Prev Year'><<<\/A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
         this.wwrite("[<A HREF=\"" +
              "javascript:window.opener.Build(" +
              "'" + this.gReturnItem + "', null, '" + nextYYYY + "', '" + this.gFormat + "'" +
              ");" +
              "\">>><\/A>]</TD></TR></TABLE><BR>");
         // Get the complete calendar code for each month..
         var j;
         for (i=11; i>=0; i--) {
              if (isIE)
                   this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
              else if (isNav)
                   this.wwrite("<LAYER ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
              this.gMonth = i;
              this.gMonthName = Calendar.get_month(this.gMonth);
              vCode = this.getMonthlyCalendarCode();
              this.wwrite(this.gMonthName + "/" + this.gYear + "<BR>");
              this.wwrite(vCode);
              if (isIE)
                   this.wwrite("</DIV>");
              else if (isNav)
                   this.wwrite("</LAYER>");
         this.wwrite("</font><BR></body></html>");
         this.gWinCal.document.close();
    Calendar.prototype.wwrite = function(wtext) {
         this.gWinCal.document.writeln(wtext);
    Calendar.prototype.wwriteA = function(wtext) {
         this.gWinCal.document.write(wtext);
    Calendar.prototype.cal_header = function() {
         var vCode = "";
         vCode = vCode + "<TR>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sun</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Mon</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Tue</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Wed</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Thu</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='14%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Fri</B></FONT></TD>";
         vCode = vCode + "<TD WIDTH='16%'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sat</B></FONT></TD>";
         vCode = vCode + "</TR>";
         return vCode;
    Calendar.prototype.cal_data = function() {
         var vDate = new Date();
         vDate.setDate(1);
         vDate.setMonth(this.gMonth);
         vDate.setFullYear(this.gYear);
         var vFirstDay=vDate.getDay();
         var vDay=1;
         var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
         var vOnLastDay=0;
         var vCode = "";
         Get day for the 1st of the requested month/year..
         Place as many blank cells before the 1st day of the month as necessary.
         vCode = vCode + "<TR>";
         for (i=0; i<vFirstDay; i++) {
              vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(i) + "><FONT SIZE='2' FACE='" + fontface + "'> </FONT></TD>";
         // Write rest of the 1st week
         for (j=vFirstDay; j<7; j++) {
              vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" +
                   "<A HREF='#' " +
                        "onClick=\"self.opener.document." + this.gReturnItem + ".value='" +
                        this.format_data(vDay) +
                        "';window.close();\">" +
                        this.format_day(vDay) +
                   "</A>" +
                   "</FONT></TD>";
              vDay=vDay + 1;
         vCode = vCode + "</TR>";
         // Write the rest of the weeks
         for (k=2; k<7; k++) {
              vCode = vCode + "<TR>";
              for (j=0; j<7; j++) {
                   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" +
                        "<A HREF='#' " +
                             "onClick=\"self.opener.document." + this.gReturnItem + ".value='" +
                             this.format_data(vDay) +
                             "';window.close();\">" +
                        this.format_day(vDay) +
                        "</A>" +
                        "</FONT></TD>";
                   vDay=vDay + 1;
                   if (vDay > vLastDay) {
                        vOnLastDay = 1;
                        break;
              if (j == 6)
                   vCode = vCode + "</TR>";
              if (vOnLastDay == 1)
                   break;
         // Fill up the rest of last week with proper blanks, so that we get proper square blocks
         for (m=1; m<(7-j); m++) {
              if (this.gYearly)
                   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) +
                   "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'> </FONT></TD>";
              else
                   vCode = vCode + "<TD WIDTH='14%'" + this.write_weekend_string(j+m) +
                   "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>" + m + "</FONT></TD>";
         return vCode;
    Calendar.prototype.format_day = function(vday) {
         var vNowDay = gNow.getDate();
         var vNowMonth = gNow.getMonth();
         var vNowYear = gNow.getFullYear();
         if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
              return ("<FONT COLOR=\"RED\"><B>" + vday + "</B></FONT>");
         else
              return (vday);
    Calendar.prototype.write_weekend_string = function(vday) {
         var i;
         // Return special formatting for the weekend day.
         for (i=0; i<weekend.length; i++) {
              if (vday == weekend<i>)
                   return (" BGCOLOR=\"" + weekendColor + "\"");
         return "";
    Calendar.prototype.format_data = function(p_day) {
         var vData;
         var vMonth = 1 + this.gMonth;
         vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
         var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();
         var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
         var vY4 = new String(this.gYear);
         var vY2 = new String(this.gYear.substr(2,2));
         var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;
    /*     switch (this.gFormat) {
              case "MM\/DD\/YYYY" :
                   vData = vMonth + "\/" + vDD + "\/" + vY4;
                   break;
              case "MM\/DD\/YY" :
                   vData = vMonth + "\/" + vDD + "\/" + vY2;
                   break;
              case "MM-DD-YYYY" :
                   vData = vMonth + "-" + vDD + "-" + vY4;
                   break;
              case "MM-DD-YY" :
                   vData = vMonth + "-" + vDD + "-" + vY2;
                   break;
              case "DD\/MON\/YYYY" :
                   vData = vDD + "\/" + vMon + "\/" + vY4;
                   break;
              case "DD\/MON\/YY" :
                   vData = vDD + "\/" + vMon + "\/" + vY2;
                   break;
              case "DD-MON-YYYY" :
                   vData = vDD + "-" + vMon + "-" + vY4;
                   break;
              case "DD-MON-YY" :
                   vData = vDD + "-" + vMon + "-" + vY2;
                   break;
              case "DD\/MONTH\/YYYY" :
                   vData = vDD + "\/" + vFMon + "\/" + vY4;
                   break;
              case "DD\/MONTH\/YY" :
                   vData = vDD + "\/" + vFMon + "\/" + vY2;
                   break;
              case "DD-MONTH-YYYY" :
                   vData = vDD + "-" + vFMon + "-" + vY4;
                   break;
              case "DD-MONTH-YY" :
                   vData = vDD + "-" + vFMon + "-" + vY2;
                   break;
              case "DD\/MM\/YYYY" :
                   vData = vDD + "\/" + vMonth + "\/" + vY4;
                   break;
              case "DD\/MM\/YY" :
                   vData = vDD + "\/" + vMonth + "\/" + vY2;
                   break;
              case "DD-MM-YYYY" :
                   vData = vDD + "-" + vMonth + "-" + vY4;
                   break;
              case "DD-MM-YY" :
                   vData = vDD + "-" + vMonth + "-" + vY2;
                   break;
              default :
                   vData = vMonth + "\/" + vDD + "\/" + vY4;
    vData = vY4vMonthvDD ;
    //vData = vDD"."vMonth"."vY4;
         return vData;
    function Build(p_item, p_month, p_year, p_format) {
         var p_WinCal = ggWinCal;
         gCal = new Calendar(p_item, p_WinCal, p_month, p_year, p_format);
         // Customize your Calendar here..
         gCal.gBGColor="white";
         gCal.gLinkColor="black";
         gCal.gTextColor="black";
         gCal.gHeaderColor="darkgreen";
         // Choose appropriate show function
         if (gCal.gYearly)     gCal.showY();
         else     gCal.show();
    function show_calendar() {
              p_month : 0-11 for Jan-Dec; 12 for All Months.
              p_year     : 4-digit year
              p_format: Date format (mm/dd/yyyy, dd/mm/yy, ...)
              p_item     : Return Item.
         p_item = arguments[0];
         if (arguments[1] == null)
              p_month = new String(gNow.getMonth());
         else
              p_month = arguments[1];
         if (arguments[2] == "" || arguments[2] == null)
              p_year = new String(gNow.getFullYear().toString());
         else
              p_year = arguments[2];
         if (arguments[3] == null)
              p_format = "MM/DD/YYYY";
         else
              p_format = arguments[3];
         vWinCal = window.open("", "Calendar",
              "width=300,height=250,status=no,resizable=no,top=100,left=100");
         vWinCal.opener = self;
         ggWinCal = vWinCal;
         Build(p_item, p_month, p_year, p_format);
    Yearly Calendar Code Starts here
    function show_yearly_calendar(p_item, p_year, p_format) {
         // Load the defaults..
         if (p_year == null || p_year == "")
              p_year = new String(gNow.getFullYear().toString());
         if (p_format == null || p_format == "")
              p_format = "MM/DD/YYYY";
         var vWinCal = window.open("", "Calendar", "scrollbars=yes");
         vWinCal.opener = self;
         ggWinCal = vWinCal;
         Build(p_item, null, p_year, p_format);

  • Date range using "Date Field" from basic component

    Hello Everyone,
    I have been trying to create date range option available on the dashboard based on 2 Date Filed component.
    Backend for this Dashboard is BW with using BEx query. I have a info object (Z_Date)
    Now I want to have 2 date box using Date Field component 1. Start Date 2. End Date.
    I have tried following
    1. Start Date - on Select
    DS_1.setFilter("Z_Date", {"low":StartDate.getDate()});
    2. End Date - on Select
    DS_1.setFilter("Z_Date", {"High":EndDate.getDate()});
    both the scripts do not have any problem but it doest work as it is suppose to be.
    I have also tried based on following How to write script for DATE Range
    But no luck so far.
    Please share if any one have achieved date range working as mentioned.
    Thanks,
    Rajan

    Hi,
    Set Default Date in Both Date Prompts initially .
    1. Start Date - on Select
    var startDate = StartDate.getDate();
    var endDate = EndDate.getDate();
    var varRange = startDate + " - " + endDate;
    DS_1.setFilterExt("Z_SDPCD", varRange);
    2. End Date - on Select 
    var startDate = StartDate.getDate();
    var endDate = EndDate.getDate();
    var varRange = startDate + " - " + endDate;
    DS_1.setFilterExt("Z_SDPCD", varRange);
    Or
    Select Dates First Then Provide a Button (Done) .
    And write code On Click Event of that Button
    var startDate = StartDate.getDate();
    var endDate = EndDate.getDate();
    var varRange = startDate + " - " + endDate;
    DS_1.setFilterExt("Z_SDPCD", varRange);

  • F4 ( Search Help ) for date field  on the selection screen

    Hi Freinds,
    i have used WDR_SELECT_OPTIONS In my component, i have one date field on selection screen(BUDAT), for this date field i want seach help 
    this is my code
    create a range table for Posting Date
    lt_range_table = wd_this->m_handler->create_range_table(
                                                              i_typename = 'BUDAT' ).
    add Posting Date  to the selection
    wd_this->m_handler->add_selection_field( i_id = 'BUDAT'
         i_value_help_type = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
                                               I_VALUE_HELP_ID = '??????'
                                               I_DESCRIPTION = 'Posting Date'
                                               it_result = lt_range_table ).
    can any one help me
    Thanks
    Srini

    hi sarbjeet 
    i created search help in dictionary and i used that search help in my program, but still its now working , any other ideas
    Thnx
    srini

  • When we give wildcard for date field

    can we give wild card for date field in range table.
    my code is this
    RAnges r_erdat for mara-erdat
    r_erdat-sign = 'I'.
    r_erda-option =  'CP'.
    r_erdat-low = '2009'.*
    append r_erdat.
    select erdat from mara
      INTO CORRESPONDING FIELDS OF TABLE itab
      where erdat
      in
       r_erdat.
    Moderator Message: Basic date questions are not allowed.
    Edited by: kishan P on Oct 5, 2010 10:46 AM

    <<Don't answer questions that break the rules. Date questions are not permitted>>
    Hi,
           Instead you can take the entire range for that particular year.
    r_erdat-sign = 'I'.
    r_erda-option = 'BT'.
    r_erdat-low  = '20090101'.   <- begin date
    r_erdat-high = '20091231'.   <- end date
    append r_erdat.
    Regards,
    Srini.
    Edited by: Matt on Oct 5, 2010 12:46 PM

Maybe you are looking for