0% found this document useful (0 votes)
347 views2 pages

Select For All Entries in SAP ABAP - Select Statements Types

SELECT DISTINCT is an SQL statement used to retrieve unique values from a database table column by eliminating duplicate records. The syntax includes SELECT DISTINCT, the column name, FROM the table name, INTO a internal table, and optional WHERE condition. An example uses SELECT DISTINCT to get distinct material types from the material master table and loops through the internal table to output the unique values.

Uploaded by

Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
347 views2 pages

Select For All Entries in SAP ABAP - Select Statements Types

SELECT DISTINCT is an SQL statement used to retrieve unique values from a database table column by eliminating duplicate records. The syntax includes SELECT DISTINCT, the column name, FROM the table name, INTO a internal table, and optional WHERE condition. An example uses SELECT DISTINCT to get distinct material types from the material master table and loops through the internal table to output the unique values.

Uploaded by

Deepak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

SELECT DISTINCT in SAP ABAP - Select Statements types | Sapnuts.com about:reader?url=https://www.sapnuts.com/courses/core-abap/select-sta...

sapnuts.com

SELECT DISTINCT in SAP ABAP -


Select Statements types | Sapnuts.com
Ashok Kumar Reddy

SELECT DISTINCT is a SQL Select query, which is used to get


distinct values of a column from a database table.

SELECT DISTINCT eliminates duplicates records of a column of a


table.

Syntax for SELECT DISTINCT in SAP ABAP

SELECT DISTINCT <COLUMN> FROM <TABLE> INTO TABLE


<ITAB> WHERE <CONDITION>.

Example for SELECT DISTINCT in SAP ABAP

The below example is used to get distinct MTART(Material type)


from MARA(Material Master) table.

TYPES: BEGIN OF ty_mtart,


mtart TYPE mara-mtart,
END OF ty_mtart.
DATA: it_mtart TYPE TABLE OF ty_mtart,
wa_mtart TYPE ty_mtart.

1 of 2 8/24/2016 2:59 AM
SELECT DISTINCT in SAP ABAP - Select Statements types | Sapnuts.com about:reader?url=https://www.sapnuts.com/courses/core-abap/select-sta...

START-OF-SELECTION.
SELECT DISTINCT mtart FROM mara INTO TABLE
it_mtart UP TO 5 ROWS.

LOOP AT it_mtart INTO wa_mtart.


WRITE:/ wa_mtart-mtart.
ENDLOOP.

Related Lessons

Was this lesson helpful to you? Yes No 4 People out of 4 think this
lesson helpful

2 of 2 8/24/2016 2:59 AM

You might also like