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: 

Date Conversion

Former Member
0 Kudos

Hi all,

I have a requirement to convert date from tcurr table which gives date as gdatu *(79919698). I need to convert it to a dd.mm.yyyy.

Please assist.

Mpangi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

I Apologies for last post .By mistake I thought that you need to change only the format and thats why I posted the last code .

Any way I did it .

First you need to substract the date from 99999999.

Then you need to convert it in current format by moving it into a variable of type SY-DATUM.

Check the code - -

DATA : w_date TYPE tcurr-gdatu VALUE '79919698',
       w_converted TYPE sy-datum.

w_date = 99999999 - w_date .  " Getting original date

MOVE w_date TO w_converted .  " Converting date to current user format
WRITE w_converted.

Note : In user profile the date should be in dd.mm.yyyy format.

Otherwise the date will come on current user format

Regards

Pinaki

6 REPLIES 6

Former Member
0 Kudos

Hi,

Use keyword Concatenate to change the date pattern

Hope this might help

ThomasZloch
Active Contributor
0 Kudos

Try function module CONVERSION_EXIT_INVDT_OUTPUT.

Thomas

Former Member
0 Kudos

Hi,

u can either use EDIT MASK '__.__-____' OPTION WHEN U loop the internal table

and display the date field on the basic list .

or

use FM CONVERSION_EXIT_INVDT_OUTPUT.

or

DATA:
   w_dat  TYPE tcurr-gdatu.

SELECT gdatu FROM tcurr INTO w_dat.
ENDSELECT.

write: w_dat.

THANKS

Ravi

Former Member
0 Kudos

Hi ,

Make the user date format dd.mm.yyyy.

Then write this code to convert it.

DATA : w_date TYPE d VALUE '20091220',
       w_converted TYPE sy-datum.
MOVE w_date TO w_converted .
WRITE w_converted.

Regards

Pinaki

0 Kudos

Hi,

Substract this date from 99999999 and then use function module CONVERT_DATE_TO_EXTERNAL to convert it into external format or use function module CONVERSION_EXIT_INVDT_OUTPUT.

KR Jaideep,

Former Member
0 Kudos

Hi ,

I Apologies for last post .By mistake I thought that you need to change only the format and thats why I posted the last code .

Any way I did it .

First you need to substract the date from 99999999.

Then you need to convert it in current format by moving it into a variable of type SY-DATUM.

Check the code - -

DATA : w_date TYPE tcurr-gdatu VALUE '79919698',
       w_converted TYPE sy-datum.

w_date = 99999999 - w_date .  " Getting original date

MOVE w_date TO w_converted .  " Converting date to current user format
WRITE w_converted.

Note : In user profile the date should be in dd.mm.yyyy format.

Otherwise the date will come on current user format

Regards

Pinaki