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

Former Member
0 Likes
312

how can you find duplicate entries in a column of table control?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
296

HI

You need to sort your itab before passing data to table control.

If you are entering data in your table control then

at flow-logic of screen

PAI

Loop at itab.

module check-duplicate-entry.

endloop.

module check-duplicate-entry.

read table itab with key (compare all keys with itab-key fields)

if sy-subrc = 0.

duplicate entry found.

endif.

Regards

Aditya

2 REPLIES 2
Read only

Former Member
0 Likes
297

HI

You need to sort your itab before passing data to table control.

If you are entering data in your table control then

at flow-logic of screen

PAI

Loop at itab.

module check-duplicate-entry.

endloop.

module check-duplicate-entry.

read table itab with key (compare all keys with itab-key fields)

if sy-subrc = 0.

duplicate entry found.

endif.

Regards

Aditya

Read only

RemiKaimal
Active Contributor
0 Likes
296

Hi,

Before the Table control is assigned Data, use a similar ligic as follows :


TYPES:
BEGIN OF strtab,
  carrid TYPE s_carr_id, "------ column whose duplicate entry needs to be found
END OF strtab.

DATA  it_tab TYPE TABLE OF strtab.

SELECT carrid FROM spfli "------ your table 
              INTO CORRESPONDING FIELDS OF TABLE it_tab
              GROUP BY carrid HAVING COUNT( * ) > 1.

it_tab will have the values in the column that has duplicate entries.

Cheers,

Remi