Application Development and Automation 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: 
Read only

Table Control Logic Required

arvind_soni
Participant
0 Likes
563

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.

5 REPLIES 5
Read only

gopi_narendra
Active Contributor
0 Likes
539

Use the statement Delete adjacent duplicates to remove the duplicate values

Regards

- Gopi

Read only

0 Likes
539

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

Read only

former_member632991
Active Contributor
0 Likes
539

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

Read only

Former Member
0 Likes
539

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

Read only

Former Member
0 Likes
539

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