Skip to Content

Remove duplicate entries from dropdownlist in web dynpro abap

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

7 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 21, 2014 at 11:52 AM

    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 ).

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 21, 2014 at 01:25 PM

    Hi,

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


    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    Apr 21, 2014 at 11:58 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 22, 2014 at 05:36 AM

    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))

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 22, 2014 at 06:33 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 22, 2014 at 04:51 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 23, 2014 at 03:53 AM

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

    Add comment
    10|10000 characters needed characters exceeded