2009 May 19 6:02 AM
Hello,
I am working on loading program which downloads the application server CSV file to internal table.
In the CSV file there is a field date in the format (22/05/2008). When I move this to my internal table field date, it is truncating to '22/05/20'. How to solve this issue.
Can I load into internal table with the same format?
Please help me.
Thanks,
Shreekant
2009 May 19 6:16 AM
Hi, Rangrej
As all Suggested assign first this date to char type filed length 10 and using following way you can assign this to type date.
Test Sample Code Bellow.
TYPES: BEGIN OF ty_test,
cdate(10),
date LIKE sy-datum,
END OF ty_test.
DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
it_test-cdate = '22/05/2008'. APPEND it_test.
it_test-cdate = '23/05/2008'. APPEND it_test.
it_test-cdate = '24/05/2008'. APPEND it_test.
it_test-cdate = '25/05/2008'. APPEND it_test.
it_test-cdate = '26/05/2008'. APPEND it_test.
LOOP AT it_test.
it_test-date+0(4) = it_test-cdate+6(4).
it_test-date+4(2) = it_test-cdate+3(2).
it_test-date+6(2) = it_test-cdate+0(2).
MODIFY it_test INDEX sy-tabix.
ENDLOOP.Best Regards,
Faisal
Hi, Rangrej
As all Suggested assign first this date to char type filed length 10 and using following way you can assign this to type date.
Test Sample Code Bellow.
TYPES: BEGIN OF ty_test,
cdate(10),
date LIKE sy-datum,
END OF ty_test.
DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
it_test-cdate = '22/05/2008'. APPEND it_test.
it_test-cdate = '23/05/2008'. APPEND it_test.
it_test-cdate = '24/05/2008'. APPEND it_test.
it_test-cdate = '25/05/2008'. APPEND it_test.
it_test-cdate = '26/05/2008'. APPEND it_test.
LOOP AT it_test.
it_test-date+0(4) = it_test-cdate+6(4).
it_test-date+4(2) = it_test-cdate+3(2).
it_test-date+6(2) = it_test-cdate+0(2).
MODIFY it_test INDEX sy-tabix.
ENDLOOP.Best Regards,
Faisal
2009 May 19 6:04 AM
Hi,
Try to get it to into char field of length 10.Date field has 8 length so it is truncating.
Regards,
Nithya
2009 May 19 6:05 AM
I guess you have declares it with sy-datum.
Declare like this, this if you want ' / ' in between also.
Data : date(10) type c.
2009 May 19 6:06 AM
Hi,
Pl. check the declaration of the date field in your itab, say if it is dd/mm/yy
thanks\
Mahesh
2009 May 19 6:06 AM
Hi,
u might have declared the variable type as date/sy-datum, instaed declare it as char with length 10.
After the data is moved into ur variable , then u can move it date field using " WRITE....To...' or offsets.
regards,
Naveen
2009 May 19 6:12 AM
Hi,
Please check below code.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename_string
filetype = 'ASC'
has_field_separator = 'X'
dat_mode = 'I'
TABLES
data_tab = it_input
2009 May 19 6:16 AM
Hi, Rangrej
As all Suggested assign first this date to char type filed length 10 and using following way you can assign this to type date.
Test Sample Code Bellow.
TYPES: BEGIN OF ty_test,
cdate(10),
date LIKE sy-datum,
END OF ty_test.
DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
it_test-cdate = '22/05/2008'. APPEND it_test.
it_test-cdate = '23/05/2008'. APPEND it_test.
it_test-cdate = '24/05/2008'. APPEND it_test.
it_test-cdate = '25/05/2008'. APPEND it_test.
it_test-cdate = '26/05/2008'. APPEND it_test.
LOOP AT it_test.
it_test-date+0(4) = it_test-cdate+6(4).
it_test-date+4(2) = it_test-cdate+3(2).
it_test-date+6(2) = it_test-cdate+0(2).
MODIFY it_test INDEX sy-tabix.
ENDLOOP.Best Regards,
Faisal
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |