Application Development and Automation 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: 
Read only

Function Module for Date conversion

Former Member
0 Likes
1,190

Hi,

I need to convert the date from this format ( 25.08.2007) to 20070825.

Can you please tell me the function module name for this conversion.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,156

Use CONVERSION_EXIT_PDATE_INPUT

9 REPLIES 9
Read only

Former Member
0 Likes
1,156

hi ,

There is no need of any fm for this.

do like this.

data: date1 type sy-datum,

date2(8) type c.

date1 = sy-datum. ' assume cur date 25.10.2007

move date1 to date2.

write:/ date1,

/ date2.

OUtput:

25.10.2007

20071025

Read only

Former Member
0 Likes
1,156

<b>REPORT ZKUN_TEST .

data : a type string.

a = sy-datum.

WRITE: sy-datum .

skip.

write : / a.</b>

Read only

Former Member
0 Likes
1,156

You pass your internal table date format dd.mm.yyyy to Function module <b>CONVERT_DATE_TO_INTERNAL</b>

to get the date format as yyyymmdd

Read only

Former Member
0 Likes
1,157

Use CONVERSION_EXIT_PDATE_INPUT

Read only

former_member386202
Active Contributor
0 Likes
1,156

Hi,

Use this FM "CONVERSION_EXIT_PDATE_INPUT".

Regards,

prrashant

Read only

Former Member
0 Likes
1,156

HI,

use this..

<b>Data : c(8) type c.

c = sy-datum</b>

With Rgds,

S.Barani

Read only

Sathish
Product and Topic Expert
Product and Topic Expert
0 Likes
1,156

write a sub routine like below:

form convert_date idate type sy-datum

edate type i.

edate3 = idate(0)+2.

edate2 = idate(3)+2.

edate1 = idate(6)+4.

concatenate edate1 edate2 edate3 to edate.

endform.

call this subroutine. this is just a sample program. might require minor changes.

Read only

Former Member
0 Likes
1,156

if u are writing to screen or some file try this way.

write l_date using no edit mask.

Read only

Former Member
0 Likes
1,156
              • <b><i><u>Converting the date</u></i></b> ****************

data: date type sy-datum,

date1(10) type c.

date = sy-datum. ' assume cur date 10.10.2007

move date to date1.

write:/ date,

/ date1.

OUtput:

10.10.2007

20071025