‎2006 Nov 16 7:26 AM
Hi All,
I have a table control displaying data from a ztable that has three primary keys.
the Table control is displaying one of the primary keys and rest are hidden.
Now suppose the table control is displaying the following rows
field 1(key) field 2
A arvind
B soni
Now when the user inserts a row with the key A it gives error and deletes the newly entered row.So its working fine.
However when the user enters more than one row at a time with the already existing values i.e
field 1(key) field 2
A arvind
B soni
A something -
New row
B something -
New row
the program deletes the last row (B something ) but not able to delete the another duplicate row (A something) and the program dumps.
It is clear that the table control current line is deleted properly if it is duplicate.But what happens when multiple rows have been entered into the table control.Please let me know how can i know what are the latest entries made in it and how to delete it.
Please also note that the user is allowed to enter the rows at any position of the table control.
I hope you all must have understood my question.
Thanks in advance.
‎2006 Nov 16 7:28 AM
Use the statement Delete adjacent duplicates to remove the duplicate values
Regards
- Gopi
‎2006 Nov 16 7:31 AM
Gopi,
But the delete adjacent duplicates will delete any of the rows,may be the original row will be deleted.
As the row can be insert any where in the table control .
thanks
‎2006 Nov 16 7:40 AM
Hi,
when u enter new row, then in the code u must be checking that the primary field in not that is already entered. Check this for each row of the table control.
i.e.
MODIFY ITAB INDEX TAB_CTRL-CURRENT_LINE.
IF SY-SUBRC <> 0.
APPEND ITAB.
ENDIF.
Regards,
Sonika
‎2006 Nov 16 7:48 AM
hello,
u can do one thing for checking new entries.
1. in your internal table create one more file chr type
2. when you uploading data in internal table put flag like "o" for old
3. that filed should be disabled.
4. for new entries put "n" for new
in this way u can track new entries.
mukesh aggarwal
‎2006 Nov 16 7:55 AM
use transporting along with modify stmt in performance view..
However, even if u modif the key fields, those values will not change.and if u r creating a new entry, y not handle explicitly befor u cud save with a read stmt that includes all key flds... if sy-subrc eq 0, pop a msg that record already exits..
hope this is helpful.lemme no if u need any further
regds
kiran