05-04-2009 2:05 PM
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
05-04-2009 3:13 PM
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
05-04-2009 2:13 PM
Hi,
Use keyword Concatenate to change the date pattern
Hope this might help
05-04-2009 2:17 PM
05-04-2009 2:37 PM
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
05-04-2009 2:47 PM
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
05-04-2009 2:49 PM
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,
05-04-2009 3:13 PM
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