problem when updating a table from report

Hi,

I have created a table and updating it with a report and every thing is working fine.

But if i run the report for thesecond time due to primary key in the updating table it is not allowing me to see the report.

So my problem is how to run report any number of times without any problem.

What is the code i need to write ti get this

thank u

Each time you run the report it should be looking for a new primary key to insert by OR if the RecVar.INSERT fails, then modify. What is the primary key? What is the purpose of updating records in a table every time the report is run?

Digitechkid is right, you can void the errors by using:

IF NOT l_recVariable.INSERT THEN

l_recVariable.MODIFY;

or simply:

IF NOT l_recVariable.INSERT THEN;

But he also right that the error indicates that you are probably trying to do the wrong thing in the first place. Think about what you want to happen. Do you want a new record inserted every time the report runs - if so use a different primary key. Do you want the report to insert if it doesn’t exst and update if it does, if so use the first option suggested. Do you want to insert if the record doesn’t exist and do nothing otherwise? Then you need to just put the IF statement around the insert to trap the error.