Function module for date format conversion

hi ,
Can someone plzz tell me if there is a SAP standard function module that can convert date of any format to date of a particular format .
Thanks
Sheetal

Hi,
Data: V_date(10) type c.
v_date = 'yyyy/mm/dd'.   " your format.
write : v_date using edit mask '__/__/____'   " this will conver the format
If you want the user specfic format, then use the below code
Data: Date1 type Sy-datym,
         Date2(10) type c.
date1 = Sy-datum
Write: Date1 to Date2.
Write:/ Date2.  " This Date2 will have the user Specif format
Regards
Sudheer

Similar Messages

  • Function module for date format

    Hi,
    what is the function module name to get the date format in <b>(dd.mm.yyyy)</b> from (<b>dd-mon-yyyy)</b>
    Thanx.

    try this Fm
    CONVERSION_EXIT_SDATE_INPUT
    input as dd-mon-yyyy
                28FEB2007
    im assuming mon in literal format.
    output is 20070228
    WRITE STATEMENT WILL DISPLAY THE DATA IN DEFALUT DATE FORMATS OF SU3 .
    <b>Elaborate teh query with an example .</b>
    check this
    regards,
    vijay.

  • Function Modules for Data and Time

    Hi all,
              I need 2 function modules for date and time. when we pass current data(sy-datum) and current time (sy-uzeit) into function modules, shoud get date in <b>dd/mm/yyyy or dd.mm.yyyy</b> and time in<b> HH:MM:SS</b> formats.
    Thanks in advance

    Hi Ranjith,
    i think this will b usefull for you..
    SAP Bar Chart Function Modules and what they are used for
    Function module
    Used for
    BARC_GRAPHIC_PBO
    Starting bar chart at PBO time, using a graphic profile (parameter PROFILE)
    BARC_GRAPHIC_PAI
    Analyzing data returned by the graphic
    BARC_SET_TIME_AXIS
    Setting start and end of time axis
    BARC_SET_OPTIONS
    Setting options
    BARC_ADD_CHART
    Creating a chart
    BARC_SET_CHART_ATTRIB
    Setting chart attributes
    BARC_ADD_SECTION
    Creating a section on the time axis
    BARC_SET_SECTION_ATTRIB
    Setting section attributes
    BARC_ADD_RIBBON
    Adding a ribbon to the time axis
    BARC_SET_RIBBON_ATTRIB
    Setting attributes for ribbons in the chart
    BARC_ADD_GRID
    Adding a time grid
    BARC_SET_GRID_ATTRIB
    Setting grid attributes
    BARC_ADD_LAYER
    Adding a layer (graphic elements)
    BARC_SET_LAYER_ATTRIB
    Setting layer attributes
    BARC_ADD_LINE
    Adding a line
    BARC_ADD_CALENDAR
    Creating a calendar
    BARC_SET_CALENDAR_ATTRIB
    Setting attributes for a calendar
    BARC_ADD_TIME_PROFILE
    Creating time profiles
    BARC_SET_TIME_PROFILE_ATTRIB
    Setting attributes for time profile
    BARC_ADD_INTERVAL
    Adding a time interval
    BARC_SET_INTERVAL_ATTRIB
    Setting time interval attributes
    BARC_ADD_TIME_OBJECT
    Creating a time object
    BARC_CONVERT_DATE
    Creating a date string in bar chart format
    BARC_REVERT_DATE
    Converting a date string in bar chart format to date and time
    BARC_ADD_DATELINE
    Creating a date line
    BARC_SET_DATELINE_ATTRIB
    Setting dateline attributes
    BARC_GET_PROFILE_CONTENTS
    Obtaining profile contents for customizing a chart
    BARC_GET_COLUMN_WIDTH
    Selecting new column width
    BARC_SET_COLUMN_WIDTH
    Setting the column width
    BARC_GET_TEXTINDEX
    Obtaining the text index of a field
    BARC_SET_LABELS
    Positioning the chart display
    BARC_SET_COLUMN_ATTRIB
    Setting column attributes
    BARC_SET_ROW_ATTRIB
    Setting row attributes
    BARC_SET_ROW_HEIGHT
    Setting the line height
    BARC_SET_MAXCHARTS
    Setting the maximum number of charts sent
    <b>If its usefull reward points
    </b>

  • Function Module for data retrival for work order clearence (WCA)

    Hi All ,
      Function Module for data retrival for work order clearence (WCA) for a particular Planning plant and (WCD's).
    Thanks.

    Hi Anne,
    BAPI_PRODORD_GET_DETAIL
    BAPI_PRODORD_GET_LIST
    You can find further FM in Function Group COPRINT and CODR or take F4 on CO* in Function Group
    These will serve your purpose.
    Cheerz.
    Ram

  • Any Function module for Date conversion

    Hi,
    In my output the date is coming like 80999898 but the actual date is 01.01.1900.
    Could you please tell me is there any Function module for that.
    Regards,
    Tushar

    Use the conv. exit CONVERSION_EXIT_INVDT_OUTPUT for this purpose.
    BR,
    Suhas

  • Function Module for DATE Conversion

    Hi All,
    I need some help to know a function module to get the exact date in a year.
    If i give the no. of days and the year.. it has to give me the exact date.
    for eg: if no. of days are 90 and the year is 2006 the output should be 31st MARCH 2006. Like that if i enter any number (< 364 or 363) and the year it has to tell me the date of the count of no.of days.
    Thank You,
    Suresh

    Hi Suresh,
    You can use FM HR_SEN_CALE_DAYS_DATE.
    Here you can pass '01.01.2006' , operator as '+' and in
    IS_DURATION enter the number of days under 'CALDD'.
    For eg:
    Test for function group      HRSEN00CRULE_CALE_DAYS                              
    Function module              HR_SEN_CALE_DAYS_DATE                               
    Import parameters                                                                               
    ID_DATE                         01.01.2006  
      ID_OPERATOR                     +             
      IS_DURATION                         0.0000     0.0000       30.0000                                                                               
    Export parameters               Value                                                                               
    ED_DATE                         30.01.2006                                                                               
    Regards,
    Raj

  • Function Module for Date Conversion - 20060131 - January 31, 2006

    I can write some quick code and use the T015M table, but I figure there must be an existing function module.  I want to convert a system date to a character string.  Ideally, I would like it based on a country field.
    20060131 -> January 31, 2006
    20060131 -> 31 January 2006

    Norman
    Strange I've used edit mask LDATE, function CONVERSION_EXIT_LDATE_OUTPUT, and get the full month name.
    Anyway, here is a little program to see the outputs for different countries. It does need updating for edit mask MODAT, and checking the return code after select and function calls:
    REPORT ZZMATTG004 .
    DATA: D8(20),
          WA_MASK LIKE DD01D-CONVEXIT,
          MONTH_NAMES LIKE T247 OCCURS 12 WITH HEADER LINE.
    TABLES: T005.                          "Countries
    PARAMETERS: DATE LIKE SY-DATUM DEFAULT SY-DATLO.
    SELECT-OPTIONS S_LAND FOR T005-LAND1 NO INTERVALS.
    PARAMETERS: P_LANGU AS CHECKBOX DEFAULT 'X'.
    D8  =  DATE.
    DESCRIBE FIELD DATE EDIT MASK WA_MASK.
    WRITE: 'MASK IS :- ''', WA_MASK NO-GAP, '''' NO-GAP.
    SKIP.
    WRITE:
           / DATE DD/MM/YYYY, 22 'DD/MM/YYYY',
           / DATE MM/DD/YYYY, 22 'MM/DD/YYYY',
           / DATE DD/MM/YY  , 22 'DD/MM/YY',
           / DATE MM/DD/YY  , 22 'MM/DD/YY',
           / DATE DDMMYY    , 22 'DDMMYY',
           / DATE MMDDYY    , 22 'MMDDYY',
           / DATE YYMMDD    , 22 'YYMMDD'.
    SKIP.
    WRITE:
           / D8   USING EDIT MASK '==LDATE', 'LDATE',
           / D8   USING EDIT MASK '==SDATE', 'SDATE',
           / D8   USING EDIT MASK '==IDATE', 'IDATE',
           / D8   USING EDIT MASK '==D3DAT', 'D3DAT',
           / D8   USING EDIT MASK '==PDATE', 'PDATE',
           / D8   USING EDIT MASK '==INVD1', 'INVD1',
           / D8   USING EDIT MASK '==INVDT', 'INVDT'.
    LOOP AT S_LAND.
    * BREAK-POINT.
      SET COUNTRY S_LAND-LOW.
      SELECT SINGLE SPRAS INTO T005-SPRAS FROM T005
             WHERE  LAND1  =  S_LAND-LOW.
      IF  P_LANGU  =  'X'.
        SET LANGUAGE T005-SPRAS.
      ENDIF.
      REFRESH MONTH_NAMES.
      CALL FUNCTION 'MONTH_NAMES_GET'
           EXPORTING
                LANGUAGE              = T005-SPRAS
    *      IMPORTING
    *           RETURN_CODE           =
           TABLES
                MONTH_NAMES           = MONTH_NAMES
           EXCEPTIONS
                MONTH_NAMES_NOT_FOUND = 1
                OTHERS                = 2.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * READ TABLE MONTH_NAMES INDEX DATE+4(2).
      READ TABLE MONTH_NAMES WITH KEY MNR  =  DATE+4(2).
      SKIP.
      WRITE: / 'COUNTRY SET TO', S_LAND-LOW COLOR 2,
             / 'Month name is', MONTH_NAMES-KTX, MONTH_NAMES-LTX,
               'Language (T005) is', T005-SPRAS, '(SYST)', SY-LANGU.
      WRITE:
             / DATE DD/MM/YYYY, 22 'DD/MM/YYYY',
             / DATE MM/DD/YYYY, 22 'MM/DD/YYYY',
             / DATE DD/MM/YY  , 22 'DD/MM/YY',
             / DATE MM/DD/YY  , 22 'MM/DD/YY',
             / DATE DDMMYY    , 22 'DDMMYY',
             / DATE MMDDYY    , 22 'MMDDYY',
             / DATE YYMMDD    , 22 'YYMMDD'.
      SKIP.
      WRITE:
             / D8   USING EDIT MASK '==LDATE', 'LDATE',
             / D8   USING EDIT MASK '==SDATE', 'SDATE',
             / D8   USING EDIT MASK '==IDATE', 'IDATE',
             / D8   USING EDIT MASK '==D3DAT', 'D3DAT',
             / D8   USING EDIT MASK '==PDATE', 'PDATE',
             / D8   USING EDIT MASK '==INVD1', 'INVD1',
             / D8   USING EDIT MASK '==INVDT', 'INVDT'.
    ENDLOOP.
    SET COUNTRY SPACE.
    * SET LANGUAGE T005-SPRAS.
      REFRESH MONTH_NAMES.
      CALL FUNCTION 'MONTH_NAMES_GET'
           EXPORTING
                LANGUAGE              = SY-LANGU
    *      IMPORTING
    *           RETURN_CODE           =
           TABLES
                MONTH_NAMES           = MONTH_NAMES
           EXCEPTIONS
                MONTH_NAMES_NOT_FOUND = 1
                OTHERS                = 2.
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * READ TABLE MONTH_NAMES INDEX DATE+4(2).
      READ TABLE MONTH_NAMES WITH KEY MNR  =  DATE+4(2).
      SKIP.
      WRITE: / 'COUNTRY SET TO', 'SPACE'    COLOR 2,
             / 'Month name is', MONTH_NAMES-KTX, MONTH_NAMES-LTX.
      WRITE:
             / DATE DD/MM/YYYY, 22 'DD/MM/YYYY',
             / DATE MM/DD/YYYY, 22 'MM/DD/YYYY',
             / DATE DD/MM/YY  , 22 'DD/MM/YY',
             / DATE MM/DD/YY  , 22 'MM/DD/YY',
             / DATE DDMMYY    , 22 'DDMMYY',
             / DATE MMDDYY    , 22 'MMDDYY',
             / DATE YYMMDD    , 22 'YYMMDD'.
      SKIP.
      WRITE:
             / D8   USING EDIT MASK '==LDATE', 'LDATE',
             / D8   USING EDIT MASK '==SDATE', 'SDATE',
             / D8   USING EDIT MASK '==IDATE', 'IDATE',
             / D8   USING EDIT MASK '==D3DAT', 'D3DAT',
             / D8   USING EDIT MASK '==PDATE', 'PDATE',
             / D8   USING EDIT MASK '==INVD1', 'INVD1',
             / D8   USING EDIT MASK '==INVDT', 'INVDT'.
    MattG.

  • Function Modules for Date

    Hi ALL,
    I would like to know the various function modules that can be used for calculating dates.Like first day of month,last day.....etc etc.
    Please give me a list of the FM's and not the F4 help option info.
    Cheers

    Hi ,
    Here are a few FM used for date manipulation
    <b>DATE_IN_FUTURE  </b>                   Add / Substract days from a given date
    <b>HR_SGPBS_ADD_TIME_TO_DATE</b>     Find the next date based on input date , addition / sub and month , year ,date
    <b>CONVERT_DATE_TO_EXTERNAL</b>     Convert date to External format
    <b>SG_PS_ADD_MONTH_TO_DATE</b>     Find the next date based on input date , addition / sub and month , year ,date
    <b>DATE_COMPUTE_DATE</b>     For a input date gives the day of the week
    <b>DATE_GET_WEEK</b>For an input date ,gives the week as output
    <b>WEEK_GET_FIRST_DAY</b>     Input year and week output is the first day of the week
    <b>WEEKDAY_GET</b>     Gives the day range , Monday , Tuesday ,…..
    <b>RP_CALC_DATE_IN_INTERVAL</b>     Calculate Future Date
    <b>CALCULATE_DATE</b>     Calculate Future Date
    <b>FIMA_DAYS_AND_MONTHS_AND_YEARS</b>     Difference between two dates
    <b>CONVERSION_EXIT_PDATE_INPUT</b>     It checks if the date is in future , if yes an error is displayed
    Reagrds
    Arun

  • Function modules for data retrieval from diff. tables

    Hi,
    I would just like to ask if there are function modules that can be used to retrieve data from the ff. tables:
    TSAD3T
    KNVV
    ESTRH
    for TSAD3T i need to get the value of title_medi
    for KNVV    i need to get the fields klabc vkorg vtweg
    for ESTRH  i need to get the fields subcat subid.
    Thanks.

    I doubt if you have such a FM

  • Function module for date

    Hello experts.
    my requirement is , I am having a fiscial year ( gjahr) and period ie month (monart) . Now i need afunction module that gives the last date of the month. say if it is january it should give 31 - month-year. I want to populate this date to the budat field. so please tell me how to solve this issue. i want to pass as date-month-year to budat. but i am having year as seperate field and month as seperate field. so please tell me the function module that gives all the three or any other solution to this.
    thanks for all the replies

    populate month, year u have and 01 into w_datum in and it should always give day1 of that month like this.
    concatenate l_year l_month '01' into w_datum_in.
    CALL FUNCTION 'SLS_MISC_GET_LAST_DAY_OF_MONTH'
                EXPORTING
                  day_in            = w_datum_in
                IMPORTING
                  last_day_of_month = w_datum_out
                EXCEPTIONS
                  day_in_not_valid  = 1
                  OTHERS            = 2.
    *reward if solved*

  • Function Module for Date/ Time difference in Working Days

    Hi all,
    Are there any function modules which will calculate the difference between a date AND time, but in working days?
    I can use the FIMA_DAYS_BETWEEN_TWO_DATES_2 FM for the dates, but I need to include times in this as well.
    This is for situations where the 'starting date' is a non-working day, and the 'end date' is a working day.  In this situation I need to take all the hours and minutes into account, which happened on the working day.  To give an example -
    Start date:  04.07.2010 (Sunday - Non working day)
    Start time:  21:12:36
    End date:  05.07.2010 (Monday - Working day)
    End time:  04:47:24
    I realise there is a Time option in this function module, but when I test it, it doesn't seem to be returning the desired results (returns 0 for days and time).  I am using '5' as the I_STGMETH and 'GB' as the I_SKALID. 
    I need a calcuation which will return the time, post midnight on the working day - in this example, 4 hours, 47 minutes (seconds are optional!).
    Can anyone help? - can I still use FIMA_DAYS_BETWEEN_TWO_DATES_2 but with different parameters?
    Thanks
    Mischa
    Edited by: Mischa Gulseven on Jul 20, 2010 10:40 AM

    Hi,
    Thanks but this FM does not seem to account for working days.
    For example, if I use:
    DATE1                           04.07.2010  (non working day)
    TIME1                           04:00:00
    DATE2                           05.07.2010   (working day)
    TIME2                           21:00:00
    It will give the following results -
    DATEDIFF                                                      1
    TIMEDIFF                                                     17
    EARLIEST                        1
    I don't want to account for the non-working day so the result I actually want would be to calculate from midnight on 05.07 to 21:00 on 05.07 which should be 21 hours.
    I suspect I probably need to include the STGMETH and the factory calendar somewhere in the FM?
    Does such a FM exist, or could anyone help me with some ABAP for this?
    thanks
    Mischa

  • Function module for date ranges

    Hi all,
           Is there any function module to display all the dates in between start date and end date. Or provide blocke code for this.
    Ex : If i have given nov 5th 2008 and nov 10th 2008 as input parameters.
           Output should be nov 5th 2008, nov 6th 2008,nov 7th 2008,nov 8th 2008,nov 9th 2008,nov 10th 2008,
    Please help me out in this regard.
    thanks
    naidu

    Hi Omkaram,
           Thank you verymuch for your code. That link is useful for me. I have rewarded you.
           But when i'm using the same code in my function module its not working.
           I have done the debugging the function module is not taking the input.
          Ex : itab[] = lt_date[].
          when i'm doing debugging the input parameter lt_date has no value.
          I dont know why it is.
          Can you help me please.
       Regards
       Naidu

  • Function module for Time zone conversion.

    Hi SDN,
    Can any one tell is there any FM for conversion of time from GMT to CET or any other time zone
    Regards,
    Rahul

    Try these function modules
    STU3_ALERTS_CONV_LOCAL_2_UTC   Converts local time to a given timezone
    STU3_ALERTS_CONV_UTC_2_LOCAL   Converts local time to a given timezone
    TZ_LOCATION_TIMEZONE                     Time zones: Determine time zone for a location                                                                          (land, region)

  • Need function modules for date manupulation

    HI,
    Could you please suggest the function module the below reqiurments
    1) adding days to date.
    ex: 20 days to 25.03.2008 = 15.04.2008
    2) To find the given date is working date or not according to factory calender id.
    3) To find the previous or last working date to the given date(Holiday date) according to the factory calender id.
    It is very urgent requirment. please help me.
    Thanks in advance
    sathish kumar swamy

    hi use this...
    RE_ADD_MONTH_TO_DATE
    DATE_CONVERT_TO_FACTORYDATE
    CALL FUNCTION 'OIL_LAST_DAY_OF_PREVIOUS_MONTH'
         EXPORTING
              I_DATE_OLD = date1
        IMPORTING
             E_DATE_NEW = date1
    data date2 like sy-datum.
    date2 = date1 + 1.
    write date2.
    If you put 27.12.2005 as the input date,   date2 you will get as 01.12.2005.
    Or else you can use the following code:
    v_startdate = sy-datum.
    v_startdate+6(2) = '01'.
    v_enddate = v_startdate.
    if v_enddate+4(2) >= '01' AND v_enddate >= '11'.
       v_endate4(2) = v_enddate4(2) + 1.
    elseif v_enddate = '12'.
      v_enddate+4(2) = '01'.
      v_enddate(4) = v_enddate(4) + 1.
    endif.
    v_enddate = v_enddate - 1.
    regards,
    venkat.

  • Function module for decimal notation conversion

    Hi
    Is there a function module to convert any decimal notation to the
    1,234,567.890 , and if there is , then a sample code will be very useful
    Thank you

    Hi,
    Please try FM C14N_NUMERIC_FORMAT.
    or try this.
    data: c(100) type c.
    data: length type i.
    data: offset type i.
    c = '1223,54'.
    length = strlen( c ).
    offset = length - 3.
    translate c+offset(1) using ',.'.
    write:/ c.
    Regards,
    Ferry Lianto

Maybe you are looking for

  • I just updated my MacBook Pro and it's been installing n restarting more than an hr now .....what do I do now?

    I just updated my MacBook Pro and it's been installing n restarting more than an hr now .....what do I do now?

  • Unable to execute Custom SQL operation using DB Adapter

    The SQL function i used is insert into QueueTable1 (select * from TQueueTable2) I executed this successfully in PL/SQL developer But while using DBadapter in BPEL. Its failing. No instance is created. I think the query is executed but haven't receive

  • Financial Reporting Books Table of Content

    Hi, i've created a financial reporting book and i want to/have to insert a title page (pdf file). The table of content is always created in front of this title page. I tried to modify xml statements in the book file but there isn't a setting which de

  • RFC - XI- Soap

    Hi, I am Integrating Sap (RFC ) with Webservice ( Soap) using SAP XI. While Executing I am getting Folowing Error In RWB Received XI System Error. ErrorCode: ADAPTER.SOAP_EXCEPTION ErrorText: soap fault: Server did not recognize the value of HTTP Hea

  • Cannot see entries in RSA1 sources system list

    Hi As part of the post processing of the system copy from PXX to Xxx I scheduled a test run for the BDLS conversion PxxCLNT100 to XxxCLNT100.But as this was running too long I aborted this by doing "Stop transaction". Then I started the actual BDLS r