Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert the date format to Character Format

Former Member
0 Kudos
1,662

Dear Experts,

Does any one has idea about converting the date format to character format.

For example the date format is 06/01/2006 (MM/DD/YYYY)

and the character format is 79939369

Please help ASAP.

Regards,

Shankar

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
731

You can use the conversion routine function module CONVERT_DATE_TO_INTERNAL, this will convert from 08/01/2006 to 20060801 then you can move the 20060801 value to a character type field.

Regards,

Rich Heilman

ashok_kumar24
Contributor
0 Kudos
731

HI Shankaran Jayakumaran ,

There are mnay ways to do it

Try the following procedures

-


data : v_date like sy-datum value '20060725'.

data : v_char_date(8) type c.

v_char_date = v_date.

write 😕 v_char_date.

-


FM : HR_IN_CHG_INR_WRDS

parameters : date like sy-datum.

data : data(8) type c.

data = date.

-


Try the following FM-

CONVERT_DATE_TO_EXTERNAL

CONVERT_DATE_TO_INTERNAL

here u pass the date formats and the dates u want to change , for both source and target.

-


Good Luck

Thanks

Ashok

0 Kudos
731

Use the Function module <b>CONVERT_DATE_TO_INTERNAL</b>

  CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
       EXPORTING
            DATE_EXTERNAL            = External date
       IMPORTING
            DATE_INTERNAL            = Internal Date
       EXCEPTIONS
            DATE_EXTERNAL_IS_INVALID = 1
            OTHERS                   = 2

Former Member
0 Kudos
731

Hi Experts,

Thanks for your valuable inputs. But i have found a new FM to suit my requirements. Please find the below Information.

For example date 01/30/2006 will be 79939869.

The FM is

CONVERSION_EXIT_INVDT_INPUT

Regards,

Shankar

0 Kudos
731

Shankaran, one question. What will you now do with the value '79939869'. I am very curious what this means.

Regards,

Rich Heilman

Former Member
0 Kudos
731

Hi Rich,

There is one table available for storing the Transaction Currency. i.e.) TCURR.

In this Table you will have the date field stored in character format, which is nothing but Inverted Date Format.

Please let me know if there is any other queries. Please award me some points.

Regards,

Shankar

0 Kudos
731

Just wondering why the date would be stored this way when most other fields in the system at stored as DATS fields. What table are you referring to.

About Points, I would if I could, since you are the original poster only you can award points for this thread.

Regards,

Rich Heilman

Former Member
0 Kudos
731

Rich,

This is a system table which stores the Daily Closing Exchange Rate, but the date is stored in the Inverted Date format.

Regards,

Shankar