11-15-2010 11:15 AM
All,
I am getting a text file with column contains the date contains the following values.
070321
070331
I wanted to how to convert this into correct date values.
If i open in this excel and format the column with date then i getting the value as
7/11/2092
7/21/2092
Any info?
a®s
Moderator message: date conversion questions = FAQ, please search for available information before posting.
Edited by: Thomas Zloch on Nov 15, 2010 12:55 PM
11-15-2010 11:28 AM
This is not a kind of question that you ask .
Anyways,
I think you have to use the conversion mask INVDT ( conversion exit )
For example table tcurs & field gdatu
11-15-2010 11:37 AM
The question is:
070321 = 7/11/2092?
070331 = 7/21/2092?
Or is it:
070321 = 21 march 2007? or 07 march 2021?
11-15-2010 11:49 AM
Hi,
Can you please tell me from where are you getting this file.
is this file is given by the FC? If so better you should ask the FC to maintain this in a proper way .
With Regards,
Sumodh.P
11-15-2010 11:52 AM
Hi,
Use below FM to solve your issue.
CONVERT_DATE_TO_INTERNAL.
Code as below:
report zsplit_string.
data:udate1(10) type c.
data:v_date(10) type c.
parameters:udate type char10.
udate1 = udate.
perform convert_date using udate1
changing v_date.
write:/ v_date.
&----
*& Form CONVERT_DATE
&----
text
----
-->P_UDATE1 text
<--P_V_DATE text
----
form convert_date using p_udate1
changing p_v_date.
call function 'CONVERT_DATE_TO_INTERNAL'
exporting
date_external = udate
accept_initial_date = space
importing
date_internal = v_date
exceptions
date_external_is_invalid = 1
others = 2.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
concatenate v_date4(2) v_date6(2) v_date+0(4) into v_date separated by '/'.
endform. " CONVERT_DATE
Regards,
Venkat.