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: 

Custom table issues - Date field created with character data type

rnb86
Participant
0 Kudos

Hi Experts,

Background:

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.

Problem:

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.

Cheers

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

I have few confusions over here

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.

What is that you mean by 'the entered date value is considered as a string and not of type date.' ?

See the table has the field of type char not of type date, correct?. So did you try comparing like BUDAT = '13052011' ?

Can you give an example of the date which is stored in the table?

5 REPLIES 5

Former Member
0 Kudos

Hi,

I have few confusions over here

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.

What is that you mean by 'the entered date value is considered as a string and not of type date.' ?

See the table has the field of type char not of type date, correct?. So did you try comparing like BUDAT = '13052011' ?

Can you give an example of the date which is stored in the table?

0 Kudos

Hi,

Consider the example,

i entered the value on the table selection screen as budat-low is blank and budat-high as 09/07/2010 and execute it,

the table gives me output records which has date 02/03/2011 and 09/07/2010. This is not correct. I should get the records only of the year 2010. But i get the records of 2011 too which is not what i want. 02/03 is less than 09/07.This is because of the character data type.

The task i need to accomplish is to fetch the records from that custom table based on the date entered on my report selection screen and delete that data from that custom table permenantly. The problme i am facing is with the retrival of records from the table based on the values on the selection screen.

Data is stored in the table in the DD/MM/YYYY format. There are programs that update this table.

Let me know if you have any other questions

Cheers

0 Kudos

Hi.,

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

Kiran

0 Kudos

Hi,

If you have programs which are updating this table, why can't you have a look at these programs? If it is updation, obviously we have to identify the records which needs to be updated. So the same thing you can copy to delete as well, identify the records and delete it.

0 Kudos

Thanks Kiran for the idea.....i think i know how to fix this..