cancel
Showing results for 
Search instead for 
Did you mean: 

Remove duplicate entries from dropdownlist in web dynpro abap

former_member201541
Participant
0 Kudos

How to remove duplicate entries from dropdownlist in web dynpro abap? Can someone please help me

I have maintained the data in the z table wherein the records of particular fields are repeated but when i show that record in the Web Dynpro application dropdown list, the user should only be able to view the unique data for selection of that particular field.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

try this code in init method.

use the

Delete adjacent duplicates.

<set the table>

select <f1>  from <table> into TABLE <Itab> whre <condition>.

   DELETE ADJACENT DUPLICATES FROM <Itab> COMPARING <f1>.

     lo_nd_vbap->bind_table( new_items = <itab> set_initial_elements = abap_true ).

Answers (6)

Answers (6)

former_member201541
Participant
0 Kudos

Thank you everyone for your help. My problem got solved. I used the sort table and then deleted the adjacent duplicate entries in that.

ramakrishnappa
Active Contributor
0 Kudos

Please close the discussion by marking the helpful replies as correct answer / helpful answer.

amy_king
Active Contributor
0 Kudos

Hi Ajinkya,


You mention that you maintain the values in a z-table. When you select the values from the z-table, use the SELECT DISTINCT keyword to eliminate duplicate records from the result set. For example,

DATA lt_carrid TYPE STANDARD TABLE OF s_carr_id.

SELECT DISTINCT carrid
           FROM sflight
           INTO TABLE lt_carrid.


Cheers,

Amy

former_member187651
Active Participant
0 Kudos

Hello Ajinkya,

Remove all your duplicate entries from your ITAB, which you use to assign to the node creating Drop down.

Use any of the Following:

Delete adjacent duplicaties from lt_table comparing <field_lable_names>.

or

Loop on itab and delete all duplicate values..

Regards,

Chandan

Former Member
0 Kudos

Just sort the value by key field and use delete adjacent  before binding it to context attribute..

for reference:

Deleting Lines (SAP Library - ABAP Programming (BC-ABA))

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

First sort the table entries based on the key field and then use delete adjacent duplicates for that field.


ramakrishnappa
Active Contributor
0 Kudos

Hi Ajinkya,

As suggested by Jayanthi, it is required to sort the internal table entries based on the key field before deleting adjacent duplicate records. Otherwise you may not get unique records.

Regards,

Rama

Former Member
0 Kudos

Hi Ajinkya,

Before binding the table data to the node of your UI element, First delete duplicate entries in internal table.

Delete adjacent duplicaties from lt_table comparing <field_lable_names>.


Regards,

Ravikiran.K