Skip to Content
author's profile photo Former Member
Former Member

Duplicate Values

hi,

i have a view which gives me duplicate values, is there any way to avoid this.

Using programmatically, u can specify distinct, but how do u do the same in view.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2005 at 11:52 AM

    Hi all,

    Let me explain u in detail.

    i have three tables kna1,knb1 and bsid.

    1. The end user would give me the company code and i need to fetch all customer numbers based on company code.

    Eg., SG which satisfies 30 customer numbers.

    2. I need to pass all 30 customer numbers into table kna1 where it fetches related names,address,postal code etc.,

    3. Now comes the third part where the customer number will be passed to table BSID to check whether any open items exist or not. If open items exist, then i need to display only those customer numbers with address postal code.

    4. Problem is i am getting duplicate vales cos same customer might have many open items.

    4. These can be easily done thru programmatically.

    but how do u implement in view.

    The key areas are:

    kna1 - KUnnr

    knb1 - kunnr and bukrs

    bsid - kunnr and bukrs

    Thanks in advance

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Anandha,

      I think you have two other posts for the same (I could not find them now though).

      Any way, you have to implement this using search help exits.

      Take a look at the following link which explains search help exits,

      http://help.sap.com/saphelp_46c/helpdata/en/cf/21ee52446011d189700000e8322d00/frameset.htm

      Also take a look at fm F4IF_SHLP_EXIT_EXAMPLE,

      you have to filter out the duplicate entries during 'DISP'.

      On another note, see whether you can avoid reading BSID (it is a huge table normally) to determine whether customer has open items. I think if SKFOR in KNKK is not empty that means customer has open items.

      NOTE: You can get credit control area KKBER for a company code from T001 and then use it for selecting from KNKK.

      This way you will have atmost one record.

      Hope this helps..

      Sri

      Message was edited by: Srikanth Pinnamaneni

      Message was edited by: Srikanth Pinnamaneni

      Message was edited by: Srikanth Pinnamaneni

  • Posted on Nov 24, 2005 at 10:36 AM

    Hi Ananda,

    I think you must define your join conditions in such a way that there will be no duplicates, if the view has bee created by you. All the key fields of atleast one table must be included in the join conditon.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2005 at 10:38 AM

    Hi,

    There should be a key which identifies duplicates while updating through view.

    Regards

    KER

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2005 at 10:40 AM

    Hi Anandha,

    Is the view is custome view, then in the table joins

    pass all the keys.It will feth unique records from the tables.

    Hope this will help you.

    Thanks&Regards,

    Siri.

    Kindly Award points if it is useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 24, 2005 at 10:44 AM

    Anandha,

    Problem is in the JOIN condition. Post ur JOIN condition for more help.

    Thanks

    Kam

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 24, 2005 at 12:52 PM

    hi shrikanth,

    Please let me know how to eliminate duplicate entries using function module. I mean how would i get the final internal table or some sort to link it to view.

    In case of program, it is easily done,. buyt through this function module, please help me out.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Anandha,

      You will get the entries in table RECORD_TAB. But the table will not be of your structure so first you have to move the table into another table which you define with your output fields and then use a DELETE ADJACENT DUPLICATES statement and then overwrite RECORD_TAB again.

      For example,

      Let us say you have KUNNR and NAME1 on the display then,

      ***First declare a table in your exit fm as,

      DATA: BEGIN OF t_display OCCURS 0,

      kunnr LIKE kna1-kunnr,

      name1 LIKE kna1-name1,

      END OF t_display.

      ****Then here

      IF CALLCONTROL-STEP = 'DISP'.

      LOOP AT record_tab.

      t_display = record_tab.

      APPEND t_display.

      ENDLOOP.

      SORT t_display BY kunnr.

      DELETE ADJACENT DUPLICATES FROM t_display COMPARING kunnr.

      REFRESH record_tab.

      LOOP AT t_display.

      record_tab = t_display.

      APPEND record_tab.

      ENDLOOP.

      ENDIF.

      Hope this helps..

      Remember RECORD_TAB is just a sequence of characters and your t_display should exactly reflect all the fields on display..

      Sri

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.