2006 Jun 06 7:32 PM
Hi,
is there any function module available which converts the date into american standard.
e.g. user will pass the date ( 32406 mmddyy ) but they might pass the date "31506" instead of 031506. so it should get converted into 03152006.
pls suggest.
Thanx
Hi,
is there any function module available which converts the date into american standard.
e.g. user will pass the date ( 32406 mmddyy ) but they might pass the date "31506" instead of 031506. so it should get converted into 03152006.
pls suggest.
Thanx
2006 Jun 06 7:33 PM
2006 Jun 06 7:35 PM
move that date to another variable of type n.
data: date1(6) type n.
data: new_date(8).
date1 = '31506'.
concatenate date1+0(4)
'20'
date1+4(2)
into new_date.
write: new_date.
Regards,
Ravi
2006 Jun 06 7:42 PM
Quick sample.
report zrich_0001.
data: date_in(6) type c value '31506'.
data: date_out(10) type c.
data: n(6) type n.
data: d type sy-datum.
n = n + date_in.
d+4(4) = n+0(4).
d+2(2) = n+4(2).
if d+2(2) < 50.
d+0(2) = '20'.
else.
d+0(2) = '19'.
endif.
call function 'CONVERT_DATE_TO_EXTERNAL'
exporting
date_internal = d
importing
date_external = date_out.
write:/ date_out.
Regards,
Rich Heilman
2006 Jun 06 7:36 PM
HI,
write these lines..
Data: Date like sy-datum,
date1 like sy-datum,
date2(10).
lets say your first date is DATE .. so user enters the date like <b>'31506'</b>, write the code as
Move: Date to DATE1.
write: DATE1 to DATE2.
so the DATE2 will have the User format Date, i mean user format is american then date will appear in American Format, if the User date is in German , then date output will appear in the German format
http://www.sap-basis-abap.com/sapab015.htm
Thanks
Sudheer
2006 Jun 06 7:37 PM
Hi Abdul,
Thanks for reply.
I have already tried this FM but i want to pass value 32406 instead of 032406.. and if you pass this value it does not work.
2006 Jun 06 7:41 PM
There is no standard FM exists for this purpose..
Cheers,
Abdul hakim
2006 Jun 06 7:39 PM
thanks ravi but i am already using concatenate statement to resolving this issue and it is working properly but I want to use system standard function module.
any idea?
2006 Jun 06 7:40 PM
There is no standard function module that does that. You have to manually ensure that the leading zero is also there.