Custom table issues - Date field created with character data type
I have a custom table (Z-table) that was created long ago without any data elements and all the fields are of data type character, including the date fields. This table has got huge amount of data.
My task is to fetch the data based on posting date (BUDAT - one of the fields in this table) and delete the data from the table permenantly.
I am not able to fetch the accurate data from the table since the fields of are character data type and the entered date value is considered as a string and not of type date. Since the data is huge, deleting the data based on date is the best possible way to go about this task.
Any sugestions on how to get the data from the table based on date field are most welcome.
Kiran Kumar Valluru replied
First you fetch the records from Z table., now assign date to zdate(say).,
zdate = wa-date.
replace all occurrences of '/' in zdate.
(now u will get ddmmyyyy) ., change this to yyyymmdd., using string operations.
like d = zdate+0(2).
m = zdate+2(2).
y = zdate+4(4).
concatenate d m y into zdate1.
now assign zdate1 to date( which is of type sy-datum ).
date = zdate1.
now u can compare with the required table data you want.,
hope this helps u.,
Thanks & Regards