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

select unique records from the table

Hi,

Again question 😊

In the table BSIS there is in field ZOUNR populated with the same value a few times.

I would like to select unique records. and check them in the another table.

The result of the select centence below is, that I get multiple lines for one record. How to enter the select sentence just for unique records?

SELECT * FROM BSIS INTO LW_BSIS

WHERE ( HKONT IN HKONT ) AND

( AUGBL IN AUGBL ).

IF SY-SUBRC = 0.

MOVE-CORRESPONDING lw_bsis TO INT.

ENDIF.

SELECT * FROM EKPO INTO LW_EKPO

WHERE ( EBELN EQ LW_BSIS-ZUONR+0(10) ) AND

( EBELP EQ LW_BSIS-zuonr+10(5) ).

IF SY-SUBRC = 0.

MOVE-CORRESPONDING LW_EKPO TO INT.

ENDIF.

ENDSELECT.

ENDSELECT.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Posted on Nov 21, 2007 at 12:14 PM

    SELECT <b>DISTINCT</b> * FROM BSIS...

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 21, 2007 at 12:16 PM

    Hi,

    Use select DISTINCT

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 12:18 PM

    Hi Saso,

    Instead of using

    SELECT * FROM BSIS INTO LW_BSIS

    WHERE ( HKONT IN HKONT ) AND

    ( AUGBL IN AUGBL ).

    SELECT DISTINCT * FROM BSIS INTO LW_BSIS

    WHERE ( HKONT IN HKONT ) AND

    ( AUGBL IN AUGBL ).

    If it is helpfull pls reward pts.

    Regards

    Srimanta

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 21, 2007 at 12:18 PM

    Hi...

    SELECT <OTHER FIELDS FROM BSIS> DISTINCT(ZOUNR) FROM BSIS

    WHERE <CONDITION>.

    <b>reward if Helpful.</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 01:29 PM

    I found the solution, your replys desn't work.

    This is a solution for this.

    SORT INT by ZUONR.

    DELETE ADJACENT DUPLICATES from int COMPARING ZUONR.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 01:30 PM

    I found the solution, your replys desn't work.

    This is a solution for this.

    SORT INT by ZUONR.

    DELETE ADJACENT DUPLICATES from int COMPARING ZUONR.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 02:10 PM

    I found the solution, your replys desn't work.

    This is a solution for this.

    SORT INT by ZUONR.

    DELETE ADJACENT DUPLICATES from int COMPARING ZUONR.

    Add a comment
    10|10000 characters needed characters exceeded

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.