Javascript for multiple date fields

Hi all-
I have to write javascript for 15 different date fields in a form.
The requirement here is that we convert all date fields on Page 100 from date pickers (editable date fields) to display-only date fields with two controls for the users to set the date.
If the field is empty (no date registered yet), there will be a green checkmark(X). When the user clicks this checkmark, the current date is entered into the field.
If the field is not empty (there is a date already in the system), there will be a red X. When the user click this red X, the date from the date field is removed.
The javascript I am using here is
</script>
<script type="text/javascript">
     function init(){
          var datePickerVal = $v2('P100_TODAYS_DATE');
          if(datePickerVal){
               $x_Show('ToggleDateR');
               $x_Hide('ToggleDateG');
          }else{
               $x_Hide('ToggleDateR');
               $x_Show('ToggleDateG');
     function toggleDateFunc(pValue){
          var sysDate = $v2('P100_DATE');
          if(pValue == 'R'){
               $x_Hide('ToggleDateR');
               $x_Show('ToggleDateG');
               $x_Value('P100_TODAYS_DATE','');
          }else if(pValue == 'G'){
               $x_Show('ToggleDateR');
               $x_Hide('ToggleDateG');
               $x_Value('P100_TODAYS_DATE',sysDate);
     window.onload = init;
</script>
This javascript is working for one date field( 'P100_TODAYS_DATE') but i have 15 different date fields in this page(100) all should have same funtionality. Please help me out how to write a logic to use this function for all the date fields.
Thanks,(apex 3.2)
Greenhorn
Edited by: Greenhorn on Jul 19, 2011 12:30 PM

Hi,
You can do the needful by re-using the code if you can give the item names as P8_DATE1, P8_DATE_hh1, P8_DATE2, P8_DATEhh2 etc..So your item name just differs by a sequence.
Now you write function which will return desired date value taking above items as input. Pass item names to this function, get session state using APEX_UTIL.GET_SESSION_STATE('item_name') API.
Now modify you code as
FOR i IN 1..30
LOOP
v_date_array[i] = f_get_date('P8_DATE'||i, 'P8_DATEhh'||i);
END LOOP;
....Now you have all date valus in array. Just write one update as follows
UPDATE  TABLE1
SET date1 = my_date_array[1], date2 = my_date_array[2]..
WHERE ....Hope it helps :)
Cheers,
Hari

Similar Messages

  • Creating process for multiple Date fields for update or insert in APEX

    hello there,
    could someone please help me?
    i have a form on Apex based on view that is based on three tables and updating and inserting ok using trigger instead of.
    i have a problem now as in my form i have around 75 fileds (items) incuding 30 or more date fields which could be populated or left blank or update later.
    so for each date field i have two boxs; one for date, input as dd/mm/yyyy (text field) and second for time, input as 23:45. All dates will be insert or update manually by user. so as i mentioned not all date fields could be poulated at one stage.
    so i have created some process and validations and all of them work fine but i came accross if date left blank then (:) giving me problem so i have done following further process for each date field. In real table all the date fields have data type date.
    declare
    v_my_var date; -- for first date field
    str_dy VARCHAR2(10);
    dt_indx date;
    str_tm VARCHAR2(20);
    tm_indx date;
    begin
    str_dy := :p4_first_date
    str_tm := str_dy||' '||substr(:p8_first_date_hh,1,2)||':'||substr(:p8_first_date_HH,4,2);
    dt_indx := to_date(str_tm,'DD/MM/YYYY HH24:MI');
    IF str_dy is not null then
    v_my_var :=dt_indx;
    ELSE
    v_my_var := NULL;
    END IF;
    update table 1 set my_date = v_my_var where d_id= :p4_d_id;
    end;
    above code work fine but one date field of course therefore i have to do same code for each date field with changes and initialise variable again and again for each field.
    so i like to ask is there any easy way that is more professional. i was thinking about the procedure and using collection or similar but honestly not much experience on that so could some one please help me?
    I will be very thankful.
    KRgds

    Hi,
    You can do the needful by re-using the code if you can give the item names as P8_DATE1, P8_DATE_hh1, P8_DATE2, P8_DATEhh2 etc..So your item name just differs by a sequence.
    Now you write function which will return desired date value taking above items as input. Pass item names to this function, get session state using APEX_UTIL.GET_SESSION_STATE('item_name') API.
    Now modify you code as
    FOR i IN 1..30
    LOOP
    v_date_array[i] = f_get_date('P8_DATE'||i, 'P8_DATEhh'||i);
    END LOOP;
    ....Now you have all date valus in array. Just write one update as follows
    UPDATE  TABLE1
    SET date1 = my_date_array[1], date2 = my_date_array[2]..
    WHERE ....Hope it helps :)
    Cheers,
    Hari

  • Delimiter for multiple display fields

    Hi ,
    Is there any way in MDM so we can change the delimiter for multiple display fields.
    Suppose for a lookup table code and description both are display fields.In Data manager when we select main table as our current table ,value in that lookup field will appear as code,description ,but as per the requirement it should be hyphen separated i.e code- description.
    Is there any way we can change the delimiter.
    Thanks in Advance
    Regards,
    Neethu Joy

    Hi Neethu,
    No, there is no way to change the delimiter but I can suggest you some workaround.
    Create one more field in same lookup table and mark it as display field. Create one assignment with the expression code&"-"&Description and put it in workflow having trigger action = Record Create and Record Update with Automatic launch action. With this, whenever you modify lookup data i.e. either code or description workflow will automatically update the third filed.
    Just check if this fits in your requirement.
    Regards,
    Jitesh Talreja

  • Error when saving a default format for a date field in 11g

    Getting this error when attempting to save the default for a date field in 11g:
    The current xml is invalid with the following errors: Bad xml instance! <?xml version="1.0"?> <sawsavedformat:metadata xmlns:sawsavedformat="com.siebel.analytics.web/savedformat/v1.1"><sawsavedformat:columnSavedFormats><sawsavedformat:columnSavedFormat xmlns:saw="com.siebel.analytics.web/report/v1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="sawsavedformat:regularColumnSavedFormat" columnName="&quot;Retrospectives&quot;.&quot;Time Dim&quot;.&quot;Two Months Ago&quot;"><saw:displayFormat><saw:formatSpec suppress="suppress" wrapText="true" visibility="visible" hAlign="left" vAlign="top"><saw:dataFormat xsi:type="saw:custom" customFormat="MMMM dd, yyyy" displayTimeZone=""/></saw:formatSpec></saw:displayFormat><saw:tableHeading><saw:displayFormat><saw:formatSpec/></saw:displayFormat></saw:tableHeading><saw:columnHeading><saw:displayFormat><saw:formatSpec/></saw:displayFormat></saw:columnHeading></sawsavedformat:columnSavedFormat></sawsavedformat:columnSavedFormats></sawsavedformat:metadata>
    Line:2, Col:608, Attribute 'displayTimeZone' is not declared for element 'dataFormat'
    Thoughts and suggestions?

    I have a Support Request open with Oracle right now (it's taking a few weeks to resolve) but here's the update:
    OBIEE 10g handles DATE types differently than 11g. Both the support rep and I can't figure out how, but they are different. If you bring the column in as a DATETIME in your Physical Layer you can't save it system-wide, even if you do set a time zone for your account (My Account -> Preferences -> Time Zone). If you bring the column in as DATE you can save it system-wide but you can't display the hours/mins/secs, only the M/D/Y. This has been tested on a 9i and 10g database and produced the same thing on both. The problem never occurred with those same columns using OBIEE 10g.
    Oracle support has not fully admitted this as a bug, but the rep working on this SR said this will probably be fixed in the next release- 11.1.1.4, which is due out late Jan/early Feb of this year. He is trying to reproduce this so he can log it as a bug (which we all are hoping for!) so Oracle can address it.
    For now, I've found that you are stuck with two options: 1) bring the column in as a DATE, display it system-wide as a saved format, but you can't show the time, and 2) don't save that date value with a system-wide formatting and set it manually on every report you need a custom format (don't forget to set your time zone).
    If I hear anything more back from Oracle support I'll update this thread.
    Sorry guys, looks like we're all stranded on this one...

  • After upgrade from 4.6c to ECC6.0 F4 Help is not coming for few date fields

    Hi Friends
    Just now we have completed upgrade project from 4.6c to ECC6.0.
    After upgrade F4 help is not working for some date fields.
    For example its working in MB11,Its not working in va01,vf01 like that.
    In abap side we checked ...not able to find any issues in coding level, because its a standard SAP code.
    So if any solution is there to correct this issue.Kindly help me to resolve this asap.
    Thanks
    Gowrishankar
    Edited by: gowrishankar p on Nov 17, 2009 7:25 AM

    Hi
        Please refer to the SAP note 1278056 and 1278115 - PDS Display: F4-characteristic values are not selectable.  Hope this will resolve your issue.
    Regards,
    JB

  • PDF Form javascript for making readonly field by using button

    Please let me know the PDF Form JavaScript for making selected fields(Text field,Drop down list,..) as read-only by using Button.

    Do you want your button to be made read only?
    One starts with Acrobat JS Reference.
    // make all fields in a form read only;
    var oField; // variable for field being processed;
    // loop through the form fields;
    for (var i = 0; i < this.numFields; i++) {
    // process each field name;
    oField = this.getField(this.getNthFieldName(i)).readonly = true;

  • Multiple Date Fields (Fact Table) - Linking with Time Dimension

    I have a fact table that has multiple date columns.
    I can make a time dimension, but it has to be joined to a particular date column. This becomes difficult because of the limit in having multiple date fields reference one time dimension. I can see possibly
    creating a date table which contains all dates, link to fact as well as time dimension table. I am trying to better visualize the table layout on this one. Or are there possibily better ways of looking at this senerio
    Any idea's

    Figured this one out; going to use one time dimension - what looking too much into the details in regard to this scenerio

  • F4 help for PO date field in VA01 transaction during upgrade

    Hi All,
    We are working on upgrade project 4.6c to ECC 6.
    We came across one scenario.
    F4 help for PO date field is not coming in newer version in VA01 transaction but i checked in older version it is coming F4 help for PO date(calender).
    May i know the reason regarding this.
    Any clues
    Regards
    Jai
    Edited by: Jayanth16 on Nov 12, 2009 6:14 PM
    Edited by: Jayanth16 on Nov 12, 2009 6:22 PM

    Hi,
    User did some changes in include LSDSDF05 due to that F4 help is not coming.
    So i correct that one.
    Regards
    Jai

  • 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);

  • Calendar popup for a date field in ITS service

    Hi
    I am working with SRM EBP module we want to add date help(with calendar function) to existing date fields in Shopping cart and PO screens . I found some HTML and scripts in SYSTEM and BBPGLOBAL(assuming in regular ITS this service might be GLOBAL) services 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 functionality can you help???????????????
    Scenario what we are trying to do
    1) On the shopping cart details there is a require on field
    2) we are trying to add a f4 icon(which we did successfully)
    3) when a click happens on the icon a calendar popup should appear(for this we are trying to identify what standard SAP function we can use if not i got a JavaScript on the web trying to see how to integrate that script)
    Thanks in Advance

    Hi
    I browsed thru other services i found PZLE_06 and there is a date field with popup but difference between ESS and SRM is ESS i saw uses webgui concept and SRM has different approach if you can point me to the html template in one of the service where the calendar function is called that will be helpful i tried no luck i got the funciton issue is integrating it with existing code in HTML i mean calling the javascript from HTML i am not able to .
    Thank You
    Vineela

  • Problem setting maximum characters for a date field.

    Good morning all. I am trying to ensure that a date field on the form I am working on validates if the entry is not more than 8 digits, and if it is more, it should display a message, and return the focus back to the field until it is correct. Below is the code I wrote but it is not working:
      if(DATE1.length>"8"){
        xfa.host.messageBox(Enter eight digits for the date in the format YYYYMMDD or use the drop down calendar.);
    xfa.host.setFocus("form1.Page1.DATE1");
    I do not know why it is not working, i need help. I have this code on the exit event.
    Thanks
    v/r
    Tammy

    Well you are missing the " around the text in your messagebox but even then it doesn't seem to work. I am not a javascript expert so am not sure why but it works in formcalc like this:
    if(Len($) > 8) then
        xfa.host.messageBox("Enter eight digits for the date in the format YYYYMMDD or use the drop down calendar.")
        xfa.host.setFocus("$")
    endif

  • Formatted Search for Delivery Date field in SO not working

    Hi All
    Can anyone help me as to why my formatted search is not working?
    I am currently using SAP B1A SP01 Patch 19.
    I have created a user query as follows:
    SELECT $ [$10.0.DATE] + 5
    When I add this to the delivery field within the Sales Order and bring through the saved query which I set to auto refresh when the Posting Date field changes and to Display Saved Values it doesn't work.
    Any ideas?
    Thanks and best wishes
    Gail

    HI Gail,
    If I am not mistaken you want to add days to the posting date...if that is so then try this out:
    SELECT $[ORDR.DocDate.DATE]+5 From ORDR T0 For Browse
    Set The indicator to Auto Refresh when the fields change
    Nagesh

  • Average value for a Date Field in an OO Alv Grid.

    Hi Abapers.
    I've been searching for some info about averages in OO Alv grid lists but cannot find an answer to what I'm really need. The question is that, for getting an average, a 'C' value must be set in the field DO_SUM of the fieldcatalog structure for a field.
    Now, the problem is that I need the average of a date field (in 'normal' date format). I've tried it several times and read a lot of things but cannot find a real answer: Could it be done the average of a date field (e.g. for dates 01.05.2009, 02.05.2009 and 03.05.2009 the average is 02.05.2009).
    Best Regards.

    Hi,
    It will come along with the standard tool bar.For number fields, you can see it(Mean).

  • How to create a group with multiple data fields

    Post Author: RichS
    CA Forum: Formula
    Using CR XI.  Using CSV input from ODBC text driver.  No problems here.
    There are 3 fields that I want the same group by action.  Is this possible?) 
    If any one of these 3 fields change I want some header information and column fieldnames to display.  The header information I only want displayed on the first page (on the change) and the column fieldnames to display on every page.  I have played around with things like "InRepeatedGroupHeader" and "report group header on each page".  I am not getting all the results that I am looking for though.
    I want report to look like:
    Page header stuff  (to display on every page)  This data consists of some fields that will have static data and will display on every page.  And it consists of 3 non-static fields that I want to group on. 
    Group header stuff that I only want displayed on the first page on a change from one of the 3 fields mentioned above.
    Column headings that I want displayed on every page.
    Details data
    Group footer stuff (details not important for this)
    I get the expected output (column headings displayed on every page, and group header stuff display on the first page on each group change) with one group field.  But I want the group change to happen for all 3 fields.
    It seems simple but I can't find a way to create a "group" so if "field1 or field2 or field3" change, I get the same "group by" action.  I just need to know how to get the expected action.
    I expect that I might have some terms mixed up and/or some important information that would aide you in helping me.  If that is the case please re-post and I will add any missing or mis-stated information.
    Thanks,

    Post Author: V361
    CA Forum: Formula
    I am slightly confused, but perhaps you can create a formula
    Then group on the formula.  If this is not what you want, could you post some sample data, with the desired results.

  • Reg Query For Multiple Text Fields

    Hi all
    I am New to this forum..
    I am developing an application for generating reports.
    In my application i have multiple text fields.
    The user might enter any of the textfields or even enter all the fields.
    In those cases how to use the query when some fields are empty??

    Welcome to the forum.
    It always helps to post a small, simplified example of what it is you're trying to achieve.
    (When posting examples, put the {noformat}{noformat} tag before and after the example, so it will get posted formatted on this forum.)
    In those cases how to use the query when some fields are empty??If your textfields serve as parameters/bind variables for you query, then you could use NVL.
    Something like:select ...
    from some_table
    where col1 = nvl(p_col1, col1)
    and col2 = nvl(p_col2, col2)
    And how about wildcards (the '%' or '_' sign), by the way? Are they allowed as well?
    You also might want to read about this approach:
    http://www.oracle.com/technology/oramag/oracle/09-jul/o49asktom.html                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas. The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop. The MIDI tone "Stammers". How to over come the problem? Thanks in advance Kobi See Code example below: import

  • Track Automation

    Is it possible to copy and paste track automation segments? For example, my main bass is 1/2 of a bar in lenght and I automated the whole segment, but when I just try to copy and paste it, it does not take the automation changes with it. Any suggesti

  • Workflows starting multiple runbooks

    I've create a workflow that is supposed to start when an incident is set to resolved and send an e-mail notification and trigger a runbook that closes the incident. What I notice is that the workflow is running several times against the same incident

  • Restricting Authorizations for GL Account

    Hi We have created 2 profit centers in our company code (Profit Center 1000 and profit center 2000). User for both the profit centers are different. User1 is responsible for profit center 1000 and user2 is responsible for profit center 2000. There ar

  • MSI K7N2 Delta

    I'll be getting a new K7N2 Delta in the next few weeks, will it work with my current memory?(It isn't listed in the MSI site)