12-01-2008 8:31 AM
Hi
I do have a ZTABLE, with 3 key fields defined earlier. It consists of around 1 lakh records. Later onwards, two of the non keyfields have been made to key fields.
This table is being populated with records at the time of saving a ztransaction.
But some times, the system is updating the same records, some times twice, sometimes thrice, etc. I got to know that all fields (both key fields and non-key fields) of the record are same. That is, records are being updated in to the database table n number of times may be depending of some false logic in the program.
If I tried to enter the same using SM30, it is showing me an error message stating that the record is already existing.
What can be the reson?
12-01-2008 8:38 AM
Hi,
The program might be using INSERT...try with UPDATE it checks the record if exist replace else inserts the new record.
OR
Check the entries for the existence in the Ztable before updating the table.
12-01-2008 9:56 AM
hi there....
since you have updated the table with new key fields at a later point of time.... thats y this error is coming... i would suggest you to first delete all the entries in the the z table, and also write an exception handling code in it. Also check the ztable if the entry you are inserting already exists or not as when we use the insert command , it does not check the valuse that the table already has... you need to chk it individually by using select single command and issue appropriate messages as per the result....
i hope this helps....
regards
12-01-2008 10:43 AM
hi ,
u haev created the other two keys afterwards.. may b this is the issue ..
better create the fields once again by deleting the previous one's ..
also u are using insert statement which will simply insert this will cause multiple entries ..
better to use update statement it will check for duplicate entries and replace the existing ..
hope it will helps ..
regards,
prashanti
12-01-2008 10:45 AM
Hi,
If you think your key field combination is strict enough, then please use MODIFY statement to update your table entries.
this does two things
if record already exists it modifies based on the key field combination
else inserts a new record
Please go through the KEY word documenataion of MODIFY
Please verify the keyfield combination you have working fine or not.
regards
Ramchander Rao.K
12-01-2008 11:42 AM
hi,
did you adjust the table after changing the key fields from SE14???
12-01-2008 10:07 PM
Hi
Once you change the primary key field definition of your custom table, you need to revalidate the data and then reload them again into the table.
Also, while updating you should fully qualify your record by giving values to the key fields.
Regards
Raj