‎2007 Dec 04 9:01 AM
In my input file i got date formats as
20071211
12112007
12-11-2007 and in differnt formats but i want to enter into database as my system format
how to solve this problem
Regards
shanmukha
‎2007 Dec 04 9:05 AM
Hi,
Use FM
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
date_internal = lv_date
IMPORTING
date_external = lv_date1
EXCEPTIONS
date_internal_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.
REgards,
prashant
‎2007 Dec 04 9:14 AM
Hi Prashant,
i have used this FM
but every time it is accepting only in the date format
of DD.MM.YYYY ( my system defaults )
if i enter like yyyy.mm.DD then it is giving like
yy.yy.mmdd ( wrong )
if i enter like DDMMYYY
then it is giving DD.MM.YYYY ( correct )
do you have any other function which can be useful in this regard.....
regards,
Venkatesh
‎2007 Dec 04 9:08 AM
Hi,
usually the date format in the flat file should be unique
then it will be easy for us to update SAP
if the user gives you the second or third format
then use
translate g_date using '- '.
then the date which is 12-11-2007 will be converted to 12 11 2007
then use condense g_date --- output 12112007
change this date to your system date format and then update.
if the user enters first....
then use concatenate statements and then change it according to your
system date format....
<b>but be care full how they are giving it is varying every time
you will be in trouble...</b>
regards,
Venkatesh
‎2007 Dec 04 9:19 AM
Hi Ramesh,
Use the function module
CONVERT_DATE_TO_INTERNAL..
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = V_DATE_EX
IMPORTING
DATE_INTERNAL = V_DATE.Regards,
Satish