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: 

'CONVERT_DATE_TO_INTERN_FORMAT'

Former Member
0 Kudos

hi abapers,

when i am entering the input value in parameter the value of the output is entirely different.it just split the date without convert the date. help me please.

thank you.

PARAMETERS:P TYPE D.

DATA:DATS LIKE SY-DATUM.

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

datum = p

dtype = DATS

  • IMPORTING

  • ERROR =

  • IDATE =

  • MESSG =

  • MSGLN =

.

write (10) P USING EDIT MASK '____/__/__'.

8 REPLIES 8

Former Member
0 Kudos

use the fm:

CONVERT_DATE_TO_INTERN_FORMAT

SAMPLE USAGE:

call function 'CONVERT_DATE_TO_INTERN_FORMAT'

exporting datum = '12/12/2006'

dtype = 'DATS'

importing idate = v_date. "v_date should be of type sy-datum or chracter field of length 8

Former Member
0 Kudos

enter your date in the format like this:

enter the date: 12122007

output will be : 12/12/2007

copy and paste the following code.

i have changed the last line..read it carefully..

Reward points if helpful...

PARAMETERS:P TYPE D.

DATA:DATS LIKE SY-DATUM.

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

datum = p

dtype = DATS

  • IMPORTING

  • ERROR =

  • IDATE =

  • MESSG =

  • MSGLN =

.

write (10) P USING EDIT MASK '__/__/____'.

Former Member
0 Kudos

Hi,

pls give us ur input date format.

here is a working sample code: '9/2/2003' to 20030209
data : urdate(10) type c,
mydate type d.

*move '9/2/2003' to urdate.
 urdate = '9/2/2003'.

CALL FUNCTION 'RP_FORMATING_DATE'
EXPORTING
DATE_I = urdate
* BIRTH_DATE = 'X'
IMPORTING
DATE_O = mydate
* EXCEPTIONS
* DATE_INVALID = 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.
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
DATUM = mydate
DTYPE = 'DATS'
IMPORTING
* ERROR =
IDATE = mydate
* MESSG =
* MSGLN =
.
write : mydate.

Hope it was helpful.

Regards,

Anjali

Former Member
0 Kudos

Use function module 'CONVERT_DATE_TO_INTERN_FORMAT'

With datum = <date_value>

dtype = 'DATS'.

Former Member
0 Kudos

Hi MAnjula,

Now paste this code..

PARAMETERS:P TYPE D.

DATA:DATS LIKE SY-DATUM,

<b> date type d.</b>

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

datum = p

dtype = DATS

<b> IMPORTING</b>

  • ERROR =

<b> IDATE = date</b>

  • MESSG =

  • MSGLN =

.

write (10) date using EDIT MASK '____/__/__'.

former_member588853
Active Contributor
0 Kudos

Hi,

please look at the changes in bold.

PARAMETERS:P TYPE D.

DATA:DATS LIKE SY-DATUM.

<b>

data : idate type DATUV.</b>

CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'

EXPORTING

datum = p

dtype = DATS

<b> IMPORTING</b>

  • ERROR =

<b>IDATE = idate</b>

  • MESSG =

  • MSGLN =

.

write (10) <b>idate</b> USING EDIT MASK '____/__/__'.

rewards if useful,

regards,

nazeer

0 Kudos

hi abapers,

sorry i thik i didnt explain u properly.for ex.when i am entering the input in parameter as '03/03/2007'.the output is '0303/20/07'.this is a wrong answer.

i want 2007/03/03.help me please.

Former Member
0 Kudos

hi abapers,

sorry i thik i didnt explain u properly.for ex.when i am entering the input in parameter as '03/03/2007'.the output is '0303/20/07'.this is a wrong answer.

i want 2007/03/03.help me please.