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

date declaration query

Former Member
0 Likes
929

Hi ,

can any one tell me how to declare field for date . i have an excel sheet in which the date is like this

06/15/2006

when i declared internal table like

erdat like sy-datum its taking 6/15/200

can any body tell how to get the enite thing please let me know.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
882

swathi,

Declare

data erdat(10) type c.

it will take 06/15/2006.

rgds,

TM.

8 REPLIES 8
Read only

Former Member
0 Likes
882

Hai Swathi

declare like this

sy-datum '20060615'.

Thanks & regards

Sreeni

Read only

Former Member
0 Likes
883

swathi,

Declare

data erdat(10) type c.

it will take 06/15/2006.

rgds,

TM.

Read only

Former Member
0 Likes
882

Then Swathi, you have to convert the date in the excel sheet to yyyymmdd format and then pass it to the sy-datum like variable.

Read only

Former Member
0 Likes
882

declare it as char

data : erdat(10).

Read only

Former Member
0 Likes
882

Hi

Yes, thats because sy-datum is of type DATS having length 8. You need to declare a character field of length 10, upload your data and then move it to a date field.

Internally the date field will store the date as yyyymmdd so you can do something like this:

concatenate c16(4) c10(2) c1+3(2) into date. (where c1 is the char field)

Regards

Shounak

Read only

Former Member
0 Likes
882

Hi Swathi,

Date declaration should be done as:

Ex:

date TYPE d VALUE '19980601'.

Regards.

Laxmi

Read only

Former Member
0 Likes
882

Thanks guys.

I got the problem solved by declaring like

data : erdat(10) type c.

Thanks each and everyone for your valuable inputs.

Read only

Former Member
0 Likes
882

Hi,

in your flat file change your date format <b>20060615</b>

or

in your internal table try to declare the erdate as

like this

data : begin of itab occurs 0,
        ....
<b>       erdat(10),</b>
      end of itab.

Regards

vijay