07-17-2011 7:18 AM
Hi friends,
I created a table control in abap. And when I add a new record, it add to the db table but the previous content becomes double.
help me please.....
Anoop
Moderator Message: Welcome to SCN. I suggest you search the forums for similar issues. I'm sure you will find many similar threads with solutions. Please do not duplicate the forums with redundant information.
Edited by: kishan P on Jul 18, 2011 11:33 AM
07-17-2011 11:17 AM
Hi,
As per my understanding, I have tried to provide a possible solution...
when you do any user-command like enter or click of button, PAI and PBO are triggered. So you would have written a query to fetch data from DB in PAI or PBO. So when you do any action on screen, PAI and PBO are triggered and every time query is fired. So internal table which is bind to the table control has records appended when query is fired every time and record gets double. So you need to execute query and append the records in internal table only once. You can achieve this functionality by writing them in condition and this condition should only execute once when tcode is executed.
Hope it helps..
Thanks & Regards,
Mihir
07-18-2011 5:59 AM
07-18-2011 6:22 AM
Hi,
For table control: It is always a best practice to first check if there exist a record in that table with same data which you are trying to insert now and if it does not, then only insert it. Otherwise just update it.
Thanks,
Venkatesh.
07-18-2011 6:23 AM
Are you directly saving the record to DB or Table control is assigned to internal table and the internal table updates the DB??
And is the duplicate record coming when u click the Add new button ?
This could be probably because you are not clearing your work area before adding teh new row..
if you could give your code, we could help better i think
Suzie