Help Required ---  TO_CHAR function for formatting DATE

Tue, 20 Jan 2004 17:39:11 GMT.
I want the output in the above mentioned format . Can any one help me ,Please.
I tried some thing like this.......
select to_char(sysdate,'Dy, DD Mon yyyy HH24:MI:SS') from dual; and them Append GMT to it. Is this correct the way ? :D.

You can append the results of the following (assuming the database timezone is GMT):
select dbtimezone from dual;

Similar Messages

  • Help! using FM for formating date with to_char()

    Hi,
    Basically my requirement is to format the date in specific format (i.e. DD MM YYYY HH24:MM) and it should avoid the padding zeros.
    Ex: 03-Jun-2009 10:01 should be displayed as 3 Jun 2009 10:01.
    I was using the below query
    to_char(sr.recievedat, 'FMDD Mon yyyy HH24:MI')...
    But the thing is it removing the padding zeros from minuites aswell, which i dont require.
    For example,
    Ex1: 03-Dec-2009 18:10    3 Dec 2009 18:10
    *04-Dec-2009 19:01 4 Dec 2009 19:1.. It should be 4 Dec 2009 19:01*
    Can some body help me how to control the FM to restrict the padding to some places
    Thanks
    Phani

    Hi try this
    sql> select to_char(sr.recievedat, 'FMDD Mon yyyy fmHH24:MI') from dual;example
    SQL> select to_char(to_date('01-jan-2009 7:01:06','dd-mon-rrrr HH:MI:SS'), 'FMDD Mon yyyy fmHH24:MI'
    ) from dual;
    TO_CHAR(TO_DATE('01-JAN
    1 Jan 2009 07:01

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

  • 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

  • Function Modules for Format Date, Month Name and Quarter value.

    Hi All,
    1. I am getting the date field from the Flatfile, so i need to format the date to YYYYMMDD. Is there any Function module for that in BW.
    2. Based on the above Formated Date i have to find out the Name of the Month like JANUARY, FEBUARY etc.
    3. Based on the same above Formated Date i need to find out the Quarter like 1, 2 etc.
    Could you please let me know if any function modules are there for the above questions in BW not in ABAP, why i mention is some Function modules are there in ABAP but not in BW.
    Thanks in advance.
    Regards,
    srinivas

    Hi ,
    1.If your input date format is MMDDYYYY then Use SDATE as conversion routine in trans strucutre to convert into YYYYMMDD.
    2.By passing year as input parameter for the following FM you would get all the months with text.Using READ statement in routine you can get month name
    MONTH_NAMES_GET
    3.For Quarters you can use the following FM:
    TSTR_PERIODS_QUARTERS
    hope it helps...
    regards,
    Raju

  • Need help in to_char function

    Hi All,
    I'm using below sql query to get sysdate with time stamp.
    select to_char(sysdate,'YYYYMMDD HH24:MM:SS') from dual
    This gives me below result:  20130816 05:08:49
    Strangely, when I keep on running the same query, I notice after 60 seconds are complete, time stamp starts with  20130816 05:08:01 again.
    Am i missing something here..
    Thanks in advance

    Karthick_Arp wrote:
    Keep a simple thing in mind. Date stored in the DB does not have any format. Format need to be applied while you display. The default date format is specified by the NLS_DATE_FORMAT parameter. You have used TO_CHAR to display date in a specific format. But the problem is that you have converted DATE into string. So if its just for display purpose then set the NLS_DATE_FORMAT, do not use TO_CHAR.
    With respect to your issue You need to represent Minute as MI. You have represented it as MM (Month) That's why you see 08 always.
    " the problem is that you have converted DATE into string"
    No, the problem was that he was explicitly using an incorrect format mask, specifying months where he should have specified minutes.
    The problem inherently cannot be the result of converting a DATE into a string.  Dates are always converted to strings for presentation, either implicitly by using the controlling setting of NLS_DATE_FORMAT (which can be set at several levels) or explicitly by using the to_char function.  Oracle will always convert.  It has to.  Internally, a date is binary gibberish.  But computer screens and printers can only show strings of characters, so the DATE will be converted to a character string, by hook or by crook.  And the method of oracle making that conversion is exactly the same.  The only thing that varies is how the user chooses to make that specification.  And "not choosing" (by not using the to_char function) is still choosing ... choosing to rely on nls_date_format.

  • Help required !! For MRP at Storage location level

    Hi ,
    we need to have separate MRP fro two storage locations with direct procurement from Storage locations. Right now we have MRP run at Plant level for all the storage locations. we donot want the materials in these two storage locations to be planned at Plant level only with Separate storage locations. Plant level MRP will run for the other storage locations .
    I have created separate MRP areas for the storage locations & activated MRP for MRP Areas client level. material masters for the two storage locations have been asigned the MRP areas & maintained the MRP area data in material master .
    When we run the MD01, the Planned orders are getting created at both MRP areas plus at the Plant level.we donot want the planned orders creation at Plant MRP area level-only at the storage location level for those two storage locations MRP areas.
    Can anybody guide me -how to achieve that ? Did we miss any configuration?
    I tried to maintain scope of planning & getting error for parallel processing .
    Do i need to maintain parallel procesing with servers ?
    Pls need your input on this. Any help will be highly appreciated .
    Thank you in advance.
    Regards,
    Krish.

    Hi Krish,
    Go to following IMG path and check out your settings -
    IMG>>>Production>>>MRP>>>Master Data>>>>MRP Areas>>>
    (1) Activate MRP for MRP Areas    -
      Is that activated?
    (2)Define MRP areas>>>> Do setting s as per Storage Location
    Then run MRP.
    MRP Areas
    In this IMG activity you define whether MRP is to be carried out with MRP areas. In addition, you define the MRP areas for each plant in which you would like to carry out this type of materials requirements planning.
    The MRP area represents an organizational unit which carries out materials requirements planning independently. The results of the planning run are displayed specifically for each MRP area. An MRP area can include one or several storage locations of a plant or stock with a subcontractor.
    You can assign a material to various MRP areas.
    Basically, there are three types of MRP areas:
    Plant MRP Area
    Initially, the plant MRP area includes the plant with all its storage locations and stock with subcontractors. When you have defined MRP areas for storage locations and for subcontractors and you have assigned the materials, the plant MRP area is reduced by exactly this number of subcontractors and storage locations, as they are now to be planned separately.
    MRP Areas for Storage Locations
    You can define an MRP area that consists of a particular storage location by creating an MRP area and assigning the storage location to it. Material requirements for this storage location are then planned separately from the rest of the plant. You can also group several storage locations into one MRP area by creating an MRP area and assigning the storage locations. These storage locations are then planned together.
    MRP Areas for Subcontractors
    You can also define an MRP area for each subcontractor. Using an MRP area, it is possible to plan the components to be provided in subcontracting, by defining an MRP area for each subcontractor and assigning the components to be provided. You can therefore plan the requirements to be provided for these components for one subcontractor separately from the usual requirements.
    Up to now, MRP at plant level had been carried out. The various requirements were combined in the planning run and procurement elements were created for these pegged requirements with unknown sources.
    The introduction of MRP areas enables you to carry out material requirements planning and know the source of the pegged requirements and to be able to distinguish between them. The source of the pegged requirements can be, for example, production on a particular assembly line or a subcontract order.
    Material requirements planning for each MRP area allows you to have specific control over the staging and procurement of important in-house production parts and purchased parts for each shop floor and assembly area.
    Hope this will give you more idea about the same.
    Satish

  • Looking for Calendar functionality for a Date Variable

    Hi Experts,
    Currently iam creating a WEBI Report where the source system is SAP BI System. I have a BEx Query with some characteristics at the row level and keyfigures at the column level. I have a Date Interval Variable (Based on 0DATE and optional), where the user will input the From and To date to execute the query. I have created the universe on top of this query, but date inteval variable appears as a character in the form of LOV. When i use this universe and buid the report in WEBI, the User Prompt for date is appearing as List of date values for this date interval variable, where as my requirement is to have date calendar for this date interval variable.
    I did some r&d on top of this, when the date varibale as single value and optional, iam able to get the date calendar, but when i use the Date interval Varibale it takes as a character. I searched the forum, but i didn't find any solution.
    Is it possible to have a date calendar for a date interval variable in BEx?? or its is only for single value date varibale.
    Kindly suggest
    Regards
    Santosh

    Hi,
    you stated it correctly that the calendar shows up in case of a keydate and in case of a single value but not in case of a range.
    in addition the underlying characteristic needs to be type DATS
    Ingo
    Edited by: Ingo Hilgefort on Dec 8, 2009 1:35 PM

  • Help required: Configure output for goods issue

    Dear All,
    My requirement is to trigger an output type for a goods issue only when the goods movement
    scenario involves cross company accounting. What is the TCode for doing the requirement setting
    for goods issue output.
    Thanks.

    Hi,
    Please check it out,is there any standard requirement is there for your scenario,if it is not there as ABAP people to write one requirement in VOFM and assign to this condition type.

  • Unusual result with TO_CHAR function on a date

    Can anybody explain to me why I see two different results if I use the following SQL in PL/SQL Developer (Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)? I'm not sure if I have a wrong setting in Oracle or PL/SQL Developer, or if I'm just misunderstanding how the TO_CHAR function works. Many thanks.
    select sysdate, to_char(sysdate, 'dd/mm/yyyy hh:mm:ss') as FORMATTED_DATE from dual
    Results:
    SYSDATE
    10/02/2009 16:52:32
    FORMATTED_DATE
    10/02/2009 04:02:32

    select sysdate, to_char(sysdate, 'dd/mm/yyyy hh:mm:ss') as FORMATTED_DATE from dual
    Results:
    SYSDATE
    10/02/2009 16:52:32
    FORMATTED_DATE
    10/02/2009 04:02:32It should not be -> mm it should be mi .
    Got me?
    Regards.
    Satyaki De.

  • TO_CHAR Function for dates in UTF8 database

    Hi,
    Our database is UTF8 enabled infact we are using AL32UTF8 encoding. When we are running the following query then the results are displayed in Japanese instead of English for the 'DAY' and 'DY' clause.
    SELECT TO_CHAR(SYSDATE,'DAY') DAY,TO_CHAR(SYSDATE,'YEAR') YR,TO_CHAR(SYSDATE,'DY') DY,TO_CHAR(SYSDATE,'MON') MON FROM DUAL;
    DAY YEAR DY MON
    &#28779;&#26332;&#26085; TWO THOUSAND SIX &#28779; JAN
    Can anyone please tell me what is the reason behind this. Our other nls parameters are like;-
    SQL> sho parameter nls
    NAME TYPE VALUE
    nls_calendar string
    nls_comp string
    nls_currency string
    nls_date_format string
    nls_date_language string
    nls_dual_currency string
    nls_iso_currency string
    nls_language string AMERICAN
    nls_length_semantics string BYTE
    nls_nchar_conv_excp string FALSE
    nls_numeric_characters string
    nls_sort string
    nls_territory string AMERICA
    nls_time_format string
    nls_time_tz_format string
    nls_timestamp_format string
    nls_timestamp_tz_format string
    Thanks & Regards,
    Sudipta

    The date literals I used are in the
    ISO standard for date notation of YYYY-MM-DD so are internationally unambiguous.  The only circumstance I can envisage in which it would not return the rows expected would be the extremely unlikely one where all the rows with dates in the range happen
    to have a date of 7 March 2015, and all have a non-zero time of day element.  There is no such thing in Access as a date value, only a date/time value so #2015-03-07# in fact represents the point of time at midnight at the start of 7 March 2015. 
    Any rows with date/time values of that date, but with a non-zero time of day would consequently fall outside the range.
    The above is so unlikely that I can't believe it to be the case, but the bullet-proof syntax would be:
        strCondition = "dtAllocation  >= #2015-02-06# " & _
              "AND dtAllocation < #2015-03-07#+1"
    i.e. all date/time values on or later than the start of the first day of the range (#2015-02-06 00:00:00#) and before the start of the day following the end of the range (#2015-03-08 00:00:00#)
    Assuming that the dtAllocation column is of date/time data type, and is returned as such in the report's RecordSource, not as a formatted string expression, I can see no reason on the information available why the above should not work, so if the report is
    still not returning any data some other reason not apparent to us must be suspected.  We are not in a position to debug the report, however, so what that might be I can't say.
    Ken Sheridan, Stafford, England

  • Help to find function for month btween date

    i need a function that i bring begda and endda and give the month btween.
    like
    begda = 01012007
    endda  =  01062007
    i get 01012007,01022007,01032007.....until 01062007
    i reward
    thankes

    Hi Shnya,
    Use Transaction SU3.
    Click on tab "DEFAULTS" (Middleone)
    In the section Date Format --the very first format is DD.MM.YYYY
    Select it and save it.
    Regards,
    Dev

  • UDF(user defined function) for standard date transformate function,

    Hi All,
    Hope you are doing good !!!
    I have a requirement where i need to write an UDF(user defined function). Please help me in writing the code for below logic-
    I am getting my Input as 111213 where 11 denotes HH 12 denotes mm 13 denotes ss. I need ti insert : between hh:mm:ss
    Please help me achieving a code for below logic
    I have used standard date transformate function, there i am getting spaces as separator in my input resulting an errors i am sending without spaces.
    Regards,
    Vijay Kumar.

    Hello,
    I am getting my Input as 111213 where 11 denotes HH 12 denotes mm 13 denotes ss. I need ti insert : between hh:mm:ss
    Please help me achieving a code for below logic
    I have used standard date transformate function, there i am getting spaces as separator in my input resulting an errors i am sending without spaces.
    What do you mean by spaces? Can you try the mapping below?
    inputDate -> replaceString -> dateTrans(inputDateFormat: HHmmss outputDateFormat: HH:mm:ss) -> target
    Constant: -> /
    Constant:-> /
    Hope this helps,
    Mark

  • Help needed in BAPI for uploading data in FB01 -  Urgent!!!

    Hi,
        i need to post a document in FB01.
    i am getting the following details from the user in a .CSV file.
    Vendor no, vendor name, amount, document date, posting datem reference vendor line item text and Gl account line item text.
    i am using BAPI BAPI_ACC_DOCUMENT_POST to post the document.
    Now my req is if the amount is in negative then
       use posting key 31 against the vendor and 40 for GL account
    if its positive amounts
      use posting key of 24 against vendor and 50 against the GL account.
    Now by default, when the amount is negative the function is working fine.
                    but when its is positive its posting 21 against vendor and 50 against GL account. but i need 24 against vendor
    can any one tel me, where should i pass these value in the BAPI?
    or is there any other way of doing it?
    Regards,
    Niyaz

    Hi,
    the posting keys 31/21 (01/11 and 40/50) are hard coded and cannot be populated from the  interface. This is because a different posting key could have a different posting logic from what is implemented in the BAPI.
    So unless you want to do some modifications here, you have to use the fixed PKs. Pls. let me know if you are interested in where exactly the PKs are defined (hardcoded). I have this noticed for myself earlier but my notices are on another PC
    Hope that helps, points welcome
    Csaba

  • Some help required with logic for a dynamic sql query

    i have below code but not sure how to resolve this problem - what i need is to be able to dynamically
    the problem:
    i have a rabbge of paratmeters coming in from a form and need to be able to create a dynamic query string to go into a prepared statement object.
    the problem i have is there are 2 fields year range and year.
    if year range is none i need to create the query string as such :
    where the value of year can be serached on exactly
    str.append("VOLUME_YEAR = ? ");the probelm is if the year range is 5 or year range is 10 i dont know how to maipulate the query string to be able to set the string such that i can then place the year value in the place holder in preparedStatement.setInt(1, year)
    how can i create the intial query string ie.- what are the possible things that i can do. - i'm thinking of things like putting some type of between or such type query statement - but not at all sure how the syntax would go - ie. how would i use the year value and how would i create this dynamic part of the query string so that the JDBC regonises it?
    thanks for any help.
    public String setVolumeYearQuerySt(String year, String yearRange, StringBuffer str){
              String volumeYearQueryString = null;
              Sring doAction= null;
              if (yearRange.equals("None")){str.append("VOLUME_YEAR = ? ");}
              else if(yearRange.equals("5 Years")){doAction = "Nothing";}
              else if (yearRange.equals("10 Years")){doAction = "Nothing";}
              return volumeYearQueryString;
              }

    Saish - thanks a lot for the code example.
    Although, i think its far too advanced for me to understand and try to manipulate it and fit my problem. I'm pretty new to programming as you can probably see from my simple if else type statements. But i'm going to give it a try and see how it goes.
    could you please be kind enough to demonstrate how i could use the above syntax to do the following. --
    i have a year being entered in form .  in the database there is a column year volume which contains year in single year value format and also in a year range  value format - thus as in below - how could i do this -
    eg.
    user can enter a value in the year field a single value or a range value - then he can select +/-5 or 10 yrs range on that value - the DB holds the values as single values and ranges as below -
    one suggested apporach is as follows if a single user is alloweed to enter only a single value in the filed and select a query range +/- 5 etc..
    volume year of �1926-1928� and the user enters �1927�, the query has to find all records where
    look for records that are �less than or equal to� 1927.  It then has to check to see if it contains a range.  For those that it finds containing a range, it has to work out what the �upper� year is and check to see if that is �greater than or equal� to 1927.  If it is, then that is a possible matchanother approach that is suggested is to have a drop down with all years from databse and user is only llowed to select value from drop down and following logic is suggested :
    Because volumes can be received as ranges (e.g. 1964-1966), some extra coding is required where the user asks for a Year Range (such as + or � 5).
    Using the Year selected from the dropdown list, split it into 2 values, a low year and a high year. For example, if �1965-1968� is selected from the year dropdown, split it into �1965� and �1968� for the low year and high year respectively. If �1964� is selected from the year dropdown, split it into �1964� and �1964�. Now take the Year Range that the user has entered into account. For example, if the user has entered 5, subtract 5 from the low year and add 5 to the high year. Using these values, include the following search criteria in the query to the database:-
    (<low year>     BETWEEN
                 left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
         AND     right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1))
    OR     (<high year>     BETWEEN
                 left (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1)
         AND     right (VOLUME_YEAR, charindex ('-',VOLUME_YEAR + '-') - 1))regards - i think if i could solve the first approach that would be something good as its most user freindly
    thanks

Maybe you are looking for