Format the date in Smartform

Hi Experts,
          Please tell me how to format the date in Smartform...I mean if my date is
'04.03.2007' ..I wanted to print it as 4 March,2007.
Please reply me back..its urgent..

hai
plz check this code
DATA :i_monthname   TYPE TABLE OF t247,
      w_monthname   TYPE t247,
      v_date        TYPE sy-datum,
      v_year        TYPE bkpf-gjahr,
      v_month       TYPE bkpf-monat,
      v_day(2)      TYPE c,
      v_ndate(11)   TYPE c.
CALL FUNCTION 'MONTH_NAMES_GET'
  EXPORTING
    language    = sy-langu
  TABLES
    month_names = i_monthname.
CALL FUNCTION 'CACS_DATE_GET_YEAR_MONTH'
  EXPORTING
    i_date  = sy-datum
  IMPORTING
    e_month = v_month
    e_year  = v_year.
MOVE sy-datum TO v_date.
SHIFT v_date BY 6 PLACES.
v_day = v_date.
READ TABLE i_monthname INTO w_monthname WITH KEY mnr = v_month .
CONCATENATE v_day '-' w_monthname-ktx '-' v_year INTO v_ndate.
WRITE:/ v_ndate , sy-datum.
**Please reward suitable points***
With Regards
Navin Khedikar

Similar Messages

  • Need help in formatting the Date - Date does not

    Need help in formatting the Date - Date does not formats and give Not a valid month error in the below scenario.
    select oc.ST_PGM_MGR, r.ag_dnum, get_major_work_type(r.perf_eval_rtng_id) "v_work_code", r.ag_dnum_supp "supp", r.intfinal, to_char(r.formdate,'MM/DD/YYYY') "formdate", to_char(r.servfrom,'MM/DD/YYYY') "srv_from", to_char(r.servto,'MM/DD/YYYY') "srv_to", descript, add_months(to_char
    --- Bellow line of Code on trying to format it to mm/dd/yyyy gives the error
    (r.formdate, 'DD-MON-YYYY'),12) "formdate2"
    from  table REdited by: Lucy Discover on Jul 7, 2011 11:34 AM
    Edited by: Lucy Discover on Jul 7, 2011 1:05 PM

    Your syntax is wrong - look at the post above where this syntax is given:
    to_char (add_months(r.formdate,12), 'MM/DD/YYYY') "formdate2"Look at the formula from a logical perspective - "inside out" to read what is happening -
    take formdate, add 12 months
    add_months(r.formdate, 12)then apply the to_char format mask - basic syntax
    to_char(date, 'MM/DD/YYYY')Compare to your syntax:
    to_char(add_months(r.formdate, 'MM/DD/YYYY'),12) "formdate2"You will see your format string inside the call to add_months, and your 12 inside the call to to_char.
    Good luck!

  • IS it possible to Format the data to CXML format in Java ?

    Hi all,
    I am new to Java programming. I am an SAP ABAP Developer and in my SAP CRM E-Commerce Web Shop coding, I have to do coding in Java.
    My current requirement is that I have some set of data and I have to format this data to CXML format in Java. IS this possible?
    Can I format the data to CXML format in Java? Are there standard API's to do this? Please let me know how should I procced with the coding?
    Apart from formatting the output to CXML format, I have to also post this data to an external market place...How can I do this?
    Please help me with relevant information. your help will be highly appreciated.
    Regards,
    Jessica Sam

    It should be possible to format the data, yes. If there's a "standard API" it should be one that comes out of that SAP CRM thing, so look there.
    As for "posting to an external marketplace", that's far too vague a concept to be able to answer. You should start by getting the specs about "how to post" from that marketplace.

  • How to pull the data into smartform after designing layout?

    how to pull the data into smartform after designing layout?

    call the smartform in your Driver program and pass your output internal tables in the smartforms paramaters
    Check the below Sample code.
    FORM label_print.
      DATA : g_fm_name TYPE rs38l_fnam,
             g_output  TYPE ssfcompop,
             g_control TYPE ssfctrlop,
             g_form TYPE tdsfname VALUE 'ZPRINT_LABELS',
             g_dest TYPE rspopname,
             g_printer TYPE rspoptype..
      REFRESH : i_out[],i_qals[].
      SELECT matnr maktx
             INTO TABLE i_out
             FROM makt
             FOR ALL ENTRIES IN i_mseg
             WHERE matnr = i_mseg-matnr
             AND   spras = sy-langu.
      SELECT prueflos objnr ersteldat erstelzeit matnr revlv charg mengeneinh
             INTO TABLE i_qals
             FROM qals
             FOR ALL ENTRIES IN i_mseg
             WHERE matnr = i_mseg-matnr
             AND   charg = i_mseg-charg.
    *FM to accept the device type and returns the short name of the output device
      CALL FUNCTION 'EFG_GET_PRINTER'
        EXPORTING
          x_no_dialog  = ' '
          x_obligatory = 'X'
        IMPORTING
          y_tddest     = g_dest
        EXCEPTIONS
          cancelled    = 1
          failed       = 2
          OTHERS       = 3.
    *device type name for the output device
      SELECT SINGLE patype                                  "#EC CI_NOFIELD
             FROM tsp03d
             INTO g_printer
             WHERE padest = g_dest.
    *printer setting
      g_control-no_dialog = 'X'.
      g_output-tdarmod = '1'.
      g_output-tdcopies = '001'.
      g_output-tddest = g_dest.
      g_output-tdprinter = g_printer.
      g_output-tdnewid = 'X'.
      g_output-tdimmed = 'X'.
      CLEAR wa_mseg.
      LOOP AT i_mseg INTO wa_mseg.
        READ TABLE i_out INTO wa_out WITH KEY matnr = wa_mseg-matnr.
    check for the status and filter the records
        CLEAR : wa_qals.
        LOOP AT i_qals INTO wa_qals WHERE matnr = wa_mseg-matnr
                                    AND charg = wa_mseg-charg.
          CALL FUNCTION 'STATUS_TEXT_EDIT'
            EXPORTING
              objnr            = wa_qals-objnr
              spras            = sy-langu
            IMPORTING
              line             = l_status
            EXCEPTIONS
              object_not_found = 1
              OTHERS           = 2.
          IF l_status CS 'LTCA' OR l_status CS 'SKIP'.
            DELETE i_qals.
          ENDIF.
        ENDLOOP.
        SORT i_qals BY ersteldat DESCENDING erstelzeit DESCENDING.
        IF i_qals IS INITIAL.
          l_msg = text-002.
        ELSE.
          READ TABLE i_qals INTO wa_qals INDEX 1.
          SELECT prueflos vbewertung
                 INTO TABLE i_qave
                 FROM qave
                 WHERE prueflos = wa_qals-prueflos
                 AND   kzart = 'L'.
          IF sy-subrc <> 0.
            l_msg1 = text-003.
          ENDIF.
          SORT i_qave.
          CLEAR : wa_qave.
          IF NOT i_qave IS INITIAL.
            READ TABLE i_qave INTO wa_qave INDEX 1.
            IF wa_qave-vbewertung = 'A'.
              l_msg = text-002.
            ELSEIF wa_qave-vbewertung = 'R'.
              l_msg1 = text-003.
            ELSE.
              l_msg1 = text-003.
            ENDIF.
          ENDIF.
        ENDIF.
        CLEAR : wa_ser03.
        READ TABLE i_ser03 INTO wa_ser03 WITH KEY mblnr = wa_mseg-mblnr.
    *Calling Smartform
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname           = g_form
          IMPORTING
            fm_name            = g_fm_name
          EXCEPTIONS
            no_form            = 1
            no_function_module = 2
            OTHERS             = 3.
        LOOP AT i_objk INTO wa_objk WHERE obknr = wa_ser03-obknr.
    *Calling FM generated from the smartform
          DATA : l_date(10) TYPE c,
                 l_date1(10) TYPE c,
                 l_date2(10) TYPE c,
                 l_date3(10) TYPE c,
                 l_hyphen(1) TYPE c VALUE '-'.
          CLEAR : l_date,l_date1,l_date2,l_date3.
          l_date1 = wa_mseg-vfdat+0(4).
          l_date2 = wa_mseg-vfdat+4(2).
          l_date3 = wa_mseg-vfdat+6(2).
          CONCATENATE l_date1 l_hyphen l_date2 l_hyphen l_date3 INTO l_date.
          CALL FUNCTION g_fm_name
            EXPORTING
              control_parameters = g_control
              output_options     = g_output
              user_settings      = ' '
              g_matnr            = wa_mseg-matnr
              g_mat_text         = wa_out-maktx
              g_batch            = wa_mseg-charg
              g_rev              = wa_qals-revlv
              g_edate            = l_date
              g_lot              = wa_qals-prueflos
              g_qty              = wa_mseg-erfmg
              g_uom              = wa_mseg-erfme
              g_serial           = wa_objk-sernr
              g_smsg             = l_msg
              g_fmsg             = l_msg1
            EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 4
              OTHERS             = 5.
          CLEAR  g_output-tdnewid.
        ENDLOOP.
        IF sy-subrc <> 0.
          CLEAR : l_date,l_date1,l_date2,l_date3.
          l_date1 = wa_mseg-vfdat+0(4).
          l_date2 = wa_mseg-vfdat+4(2).
          l_date3 = wa_mseg-vfdat+6(2).
          CONCATENATE l_date1 l_hyphen l_date2 l_hyphen l_date3 INTO l_date.
          CALL FUNCTION g_fm_name
            EXPORTING
              control_parameters = g_control
              output_options     = g_output
              user_settings      = ' '
              g_matnr            = wa_mseg-matnr
              g_mat_text         = wa_out-maktx
              g_batch            = wa_mseg-charg
              g_rev              = wa_qals-revlv
              g_edate            = l_date
              g_lot              = wa_qals-prueflos
              g_qty              = wa_mseg-erfmg
              g_uom              = wa_mseg-erfme
              g_serial           = wa_objk-sernr
              g_smsg             = l_msg
              g_fmsg             = l_msg1
            EXCEPTIONS
              formatting_error   = 1
              internal_error     = 2
              send_error         = 3
              user_canceled      = 4
              OTHERS             = 5.
          CLEAR g_output-tdnewid.
        ENDIF.
      ENDLOOP.
      IF sy-subrc = 0.
        MESSAGE i000(zm).
      ENDIF.
    ENDFORM.                    " label_print

  • Convert String to Date and Format the Date Expression in SSRS

    Hi,
    I have a parameter used to select a month and year  string that looks like:    jun-2013
    I can convert it to a date, but what I want to do is,  when a user selects a particular month-year  (let's say "jun-2013")
    I  populate one text box with the date the user selected , and (the challenge Im having is)  I want to populate a text box next to the first text box with the month-year  2 months ahead.    So if the user selects 
    jun-2013   textbox A will show  jun-2013 
    and textbox B will show  aug-2013..
    I have tried:
    =Format(Format(CDate(Parameters!month.Value  ),  
    "MM-YYYY"  )+ 2  )   -- But this gives an error
    This returns the month in number format   like "8"    for august...
    =Format(Format(CDate(Parameters!month.Value  ), 
    "MM"  )+ 2  )
    What is the proper syntax to give me the result    in this format =  "aug-2013"  ???
    Thanks in advance.
    MC
    M Collier

    You can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
    In your case, the code would be something like:
    var sDate = "2013-01-10";
    // Convert string to date
    var oDate = util.scand("yyyy-mm-dd", sDate);
    // Convert date to new string
    var sDate2 = util.printd("mm/dd/yyyy", oDate);
    // Set a field value
    getField("date2").value = sDate2;
    The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started.

  • Error While Formatting the Date with Timestamp  Format in MS WORD Template

    Hey
    I have a requirement where i need to change the date from " 2009-08-11T20:51:47.000-05:00 " to 08-AUG-2009:8:51:47 PM
    For this i SQL wrote
    CAST(DAYOFMONTH("- Protocol Product"."Date Created") AS VARCHAR(2)) || '-' || CAST(MONTHNAME("- Protocol Product"."Date Created") AS CHAR(3)) || '-' || CAST(YEAR("- Protocol Product"."Date Created") AS CHAR(4))DATE,
    "- Protocol Product"."Date Created" to get the first part i.e "08-AUG-2009" and for the second part i was just changing the date in MS Word h:mm am/pm and its not showing the correct time its showing 11-Aug-2009 1:51 AM insteas of 8:51 PM
    Is there any way to get the Format i need by using the SQL
    Any Help Appreciated
    ~Srix

    I used the following XSL and its Working !
    <?xdoxslt:xdo_format_date($_XDOXSLTCTX, "YOUR COLUMN",'DD-MMM-YYYY HH12:MI:SS AM')?>

  • Formatting the date in an output file

    Greetings Abapers
    I am writing a program which outputs a file in csv format. Currently the date is shown in the file as 20080609000000 but i would like it to be shown as 09.06.2008. Help anyone?

    it seems that you have concatenated timestamp  with  year .
    just concatenate  w_a+6(2)
                               w_1+2(2)
                               w_a(4)
                     into   w_b .
    now move this field w_b  to excel

  • How to get the day as numeric value without formatting the date?

    Hello,
    to reduce the costs of a sql-statement I need to get the day of a date-value as number (to compare it to a numeric value) without any formatting. Every formatting results in a full table scan of the table with the date field. Is there any function to solve this problem?
    Oracle version is 11g.
    Thanks Carsten

    CarstenDD wrote:
    select T1.SYSID from T2,T1
    where T2.SysT1 = T1.SYSID
    and T2.Date1 < '01.03.2011' --German date format
    and to_number(to_char(T2.Date2,'DD')) = 1
    and T2.Inactive = 0
    The explain plan shows a full table scan on T2. With EXTRACT(DAY FROM T2.Date2) there is no difference.It probably would and should in any case.
    Look at your predicates, which of them would reduce the resultset to a fair size compared to the total number of records in the table?.
    - You may have a huge number of records when you say date less than
    - Of these perhaps one seventh have day = 1
    - My guess is that most have Inactive = 0
    Besides, you should not rely on implictit char to date conversion, always use TO_DATE
    How many records are in the table? - How many will that query return?
    Regards
    Peter

  • Formatting the date in the title of a worksheet

    Hi!
    I am displaying the date on which the report is run in the title of my worksheet. The version of Discoverer Desktop that I am using to do is 10g i.e. 10.1.2.48.18
    The date displayed is in the following format : DD-MON-RR
    Is it possible to use any other format mask?
    Thanks n rgds,
    Aparna

    Hi,
    You cannot set the NLS parameters from Discoverer admin.
    You can ask your DBA to change the system NLS parameter using:
    alter system set nls_date_format = 'DD-MON-YYYY'
    or you could try setting the nls parameter for the session by including the following command in a logon trigger:
    alter session set nls_date_format = 'DD-MON-YYYY'
    Rod West

  • Formatting the date in a report

    I have a report in which i have the date at the top left. This is currently displayed as:
    Wed Oct 05
    But I would like it to be in the following format:
    October 5th, 2005
    Any ideas?

    create a Formula Column as Character datatype with appropriate length/width. Then in the PL/SQL section of that formula column write:
    V_formatted_date  varchar2(25);
    BEGIN
    v_formatted_date := (select trim(to_char(sysdate,'Month'))||' '||ltrim(lower(to_char(sysdate,'ddth')),0)||
    trim(to_char(sysdate,', YYYY')) from dual);
    RETURN(v_formatted_date);
    END;And use this formula column as a source for the field in the layout where you want to show that formatted date.
    P.S. In the example I used sysdate, use your original date variable instead.
    Thanks.

  • Format the date in varchar type to mm/dd/yyyy

    Hi,
    I have a column originally in date format. Later on, I changed it to nvarchar and all the existing date changed to this format "yyyy-mm-dd 00:00:00". How could I update all those dates to mm/dd/yyyy format. Should I use the expression?
    Thanks. 

    I would highly recommend you change it back to a date/time type as this is what you are storing.
    MS Sql Server has MANY ways to return dates and times formatted as you want so depending on what you want to see and how you want to see it having the data as date time is infinity better. Case in point is your current predicament.
    Sorting and filtering and comparisons on date/time types is more efficient and less error prone
    Date/time types already have built in validation, trying to enter a date of february 30 is not possible or 27 hours etc.
    You can execute date/time functions like adding a year or subtracting a month which is very useful when you start to make use of the dates/times
    Writing code against databases where dates/times are stored as strings is a horrible experience that I do not wish on anyone!
    I currently have to maintain a DB that was originally created by my predecessor with date and times everywhere as varchar and it is a nightmare, Don't Do It especially if you have the chance now to revert back!!! :)
    -Igor

  • SSRS Chart to format the date in ascending order

    Hi All;
    I need to sort the dates on Horizontal axis in ascending order
    hence in category group - sorting - i had used teh below formula
    =format(CDate(Fields!goalstartdateValue.Value),"MMM yyyy")
    but it still displays the date as below
    Any help much appreciated
    Thanks
    Pradnya07

    Does it work if you use
    CDate(Fields!goalstartdateValue.Value)
    instead.

  • Windows Desktop Search 4.0 How do I Format the Date Column in the Results?

    Is there a way to modify the date column in the Results pane of Windows Desktop Search 4.0?
    It's running on a Windows 2003 Enterprise server.
    I have users that need to modify files that arrived today and yesterday after 5:00 PM.  The date column only displays the time on files with today's date.  Is there some registry setting I can tweak to get this column to always show Date and Time?
    Cordially,
    RN

    Hi,
    For the Windows Desktop Search, i think you may ask in:
    http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/home?forum=windowsdesktopsearchhelp
    Regards.
    Vivian Wang

  • I need to display the data of smartform in the printed paper (Invoice)

    Hi Experts,
    I have a requirement where i need to print the invoice. The paper is already printed with respective Text. When this printed paper is placed to the printer, I need to print my data in the respective places.
    The standard output type is rd00.
    For this i have created a separate output type with customized program and smartform.
    I have taken the exact measurement of the paper and designed my smartform layout accordingly, But when i print my data it is not at all fitting at the space provided.
    Please help me on this.
    It would be great. If you can provide me your email id, I can forward the scanned copy of the printed paper.
    Thanks in advance.
    Regards,
    Abdur Rafique

    thats an issue of page size then, either in your printer type or in your form you have a not according paper size declared.
    Hi Floren,
    How should I declare what paper size is this? Where do i need to make the changes? My Actual Paper is a invoice stationary paper.
    The measurement of the paper is below.
    Total width is 24.2 cm
    Total Height is 27.8 cm
    Data starts from
    Upper MArgin 0.5 cm
    Total Left Margin - 2.2cm  (This paper has punched holes on both right hand left side) including this hole measurement.
    If i exclude the whole measurement, it comes to 0.85 cm.
    Total Right MArgin - 2cm (This includes the hole measurement) 
    If it excludes the measurement, it comes to  0.6 cm.
    Bottom Margin
    is 0.3 cm
    The actual data should be printed in is 20.2 cm width and height is 27.6 cm( In this the header of measurement 3.6cm is printed already with text and at the footer 2.2 cm is already printed with the text.
    This is the page size of my paper. Please suggest me how should i go on.
    Thanks and Regards,
    Abdur Rafique

  • Changing the data format in bi publisher chart

    Hello Everyone,
    By default, after summation , the value of the measure in chart shows in decimal if digit is 2 or 3. Can I format the values in BI publisher chart? I am using 11.1.1.6.4 and i do not see way to format the data value inside the chart.
    Thanks,
    uday

    thumb up for helping... :|

Maybe you are looking for