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

Handling Date Format While uploading

Former Member
0 Likes
2,144

i m trying to upload date from excel to SAP.Excel sheet is having DD/MM/YYYY ,while SAP hav yyyymmdd.So while uplaoding date is not getting upload properly.

Please tell how to handle this FROMATs......

1 ACCEPTED SOLUTION
Read only

anversha_s
Active Contributor
0 Likes
1,615

hi,

from excel ur reading that field of date.

then use the below FM.

data: datum_in(10) type c value '6/7/2006'.

data: datum(10) type c.

data: datum_out type sy-datum.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

DATE_EXTERNAL = datum_in

IMPORTING

DATE_INTERNAL = datum_out

EXCEPTIONS

DATE_EXTERNAL_IS_INVALID = 1

OTHERS = 2.

*datum0(2) = datum_out4(2).

*datum2(2) = datum_out6(2).

*datum4(4) = datum_out0(4).

write:/ datum_out. "output in desired format

rgds

anver

if hlpful pls mark points

Message was edited by: Anversha s

2 REPLIES 2
Read only

anversha_s
Active Contributor
0 Likes
1,616

hi,

from excel ur reading that field of date.

then use the below FM.

data: datum_in(10) type c value '6/7/2006'.

data: datum(10) type c.

data: datum_out type sy-datum.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

DATE_EXTERNAL = datum_in

IMPORTING

DATE_INTERNAL = datum_out

EXCEPTIONS

DATE_EXTERNAL_IS_INVALID = 1

OTHERS = 2.

*datum0(2) = datum_out4(2).

*datum2(2) = datum_out6(2).

*datum4(4) = datum_out0(4).

write:/ datum_out. "output in desired format

rgds

anver

if hlpful pls mark points

Message was edited by: Anversha s

Read only

Former Member
0 Likes
1,615

Hi, Dheeraj

if while the data is being uploaded into ur itab from excel

just check whether the format in ur itab is dd/mm/yyyy ..

that means in ur itab declaration

date(8) type c

or is there

date type d

is having value 28/10/2006

now to convert it into 20061028

use function module

CONVERT_DATE_TO_INTERNAL

IMPORTING

VALUE(DATE_EXTERNAL) = v_dat

EXPORTING

VALUE(DATE_INTERNAL) = v_dat

this will do ..

just cross check the value in debugging.

regards,

VIjay