Application Development 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: 

date conversion from flat file to ztable

Former Member
0 Kudos

hi all,

i have a problem i have to read data from a <b>FLAT FILE </b> and save it into <b>ZTABLE</b>.

but one problem is there..DATE field in flat file has data in form of dd/mm/yyyy and domain taken in ztable is in format yyyy/dd/mm.

how to do this conversion.

regards.

7 REPLIES 7

former_member188685
Active Contributor
0 Kudos

Hi,

Try to use this FM <b>CONVERT_DATE_TO_INTERNAL</b> to convert it to internal format.

Regards

vijay

Former Member
0 Kudos

DATA date1(8) VALUE '31012006'.
DATA date2(8).
DATA date LIKE sy-datum.

date2+4(2) = date1+0(2).
date2+0(4) = date1+4(4).
date2+6(2) = date1+2(2).

WRITE date2 TO date.

Regards,

Wenceslaus.

Former Member
0 Kudos

use <b>SHIFT</b> command and store it into 3 variable and then finally update in to ztable

or use FM <b>CONVERT_DATE_TO_INTERNAL</b>

Regards,

Srinu

Former Member
0 Kudos

hi,

Try this function module

CONVERT_DATE_TO_INTERN_FORMAT

regards,

srinivasarao.oleti

former_member181962
Active Contributor
0 Kudos

Hi Shraddha,

reshuffle using concatenate statement.

data: v_date(10).

concatenate file_date+6(4) '/'

file_date+0(2) '/'

file_date+3(2)

into v_date.

ztable-date = v_date.

Regards,

Ravi

hymavathi_oruganti
Active Contributor
0 Kudos

convert the date to character and using concatenate

manipulate as u want.

ex: d type date. (let it be of type dd/mm/yyyy),

data: d1(10).

concatenate d6(4) '/' d1(2) '/' d+3(2) into d1.

Former Member
0 Kudos

Hi Sharadha,

You can use the function module CONVERT_DATE_TO_INTERNAL

Consider a sample code implementation.



CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
      EXPORTING
        date_external            = v_date " dd/mm/yyyy 
      IMPORTING
        date_internal            = v_date  "yyyyddmm 
      EXCEPTIONS
        date_external_is_invalid = 1
        OTHERS                   = 2.
 

Hope this solves your problem.

Regards,

Arun Sambargi.