Application Development and Automation 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: 
Read only

about data format

Former Member
0 Likes
559

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

4 REPLIES 4
Read only

former_member386202
Active Contributor
0 Likes
529

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

Read only

0 Likes
529

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

Read only

Former Member
0 Likes
529

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

Read only

Former Member
0 Likes
529

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