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,110

I need a Fnction Module which converts the date which is in the format 20020918(YYYYMMDD)

to 18.09.2002 (DD.MM.YYYY)

Pls suggest me one.

Thanks in advance.

8 REPLIES 8
Read only

Former Member
0 Likes
971

Hi john

Please try to use

FM : HRGPBS_HER_FORMAT_DATE

Best Regards

Wiboon

Read only

gopi_narendra
Active Contributor
0 Likes
971

You can do it this way.

date10(2) = date6(2).

date12(2) = date4(2).

date14(4) = date0(4).

date1 is in DDMMYYYY format

date is in YYYYMMDD format

<b>OR

You can use this FM : <i>CONVERSION_EXIT_PDATE_OUTPUT</i></b>

Regards

Gopi

Read only

Former Member
0 Likes
971

Use FM CONVERT_DATE_TO_INTERN_FORMAT .

Pass DTYPE as 'DATS'.

Please reward points if useful.

Regards,

Taranam

Read only

varma_narayana
Active Contributor
0 Likes
971

hi

Call the FM CONVERT_DATE_TO_EXTERNAL..

this will convert from internal format (YYYYMMDD) TO external format as per the user profile.

You can also check the FMs CONVERSION_EXIT_LDATE_OUTPUT

CONVERSION_EXIT_SDATE_OUTPUT

CONVERSION_EXIT_PDATE_OUTPUT

<b>reward if Helpful</b>

Read only

Former Member
0 Likes
971

FM: CONVERSION_EXIT_PDATE_OUTPUT

Read only

Former Member
0 Likes
971

Hello,

You can also do ABAP coding to get successful result

Please check the code below as an alternative solution

DATA : L_TEMP TYPE SY-DATUM.

eg : L_BUDAT contains date in the format 20020918

L_TEMP0(2) = L_BUDAT6(2). "passed date

L_TEMP2(2) = L_BUDAT4(2). "passed Month

L_TEMP4(4) = L_BUDAT0(4). "passed year

L_BUDAT = L_TEMP.

Now L_BUDAT contains date as 18092002

CLEAR L_TEMP.

You can go to SE#&

Put DATECONV* -> press F4 and -> lots of function modules related to date conversion will pop up...Pls see the description if any suits your need

Reward if helpful

Regards

Byju

Read only

Former Member
0 Likes
971

Hi,

If you want always the date formate dd.mm.yyyy then while moving the date value use like below

concatenate date6(2) '.' date4(2) '.' date+0(4) into date1.

or if you want the user setting format then use the write statement.

Regards,

Satya.

Read only

Former Member
0 Likes
971

Use FM CONVERT_DATE_TO_INTERN_FORMAT .

and fill appropriate parameters