Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Distinct Right

0 Kudos

Hi,

I want to create a Select Distinct Statement, which looks only the last 2 digits of the affected column. Generally there is a DISTINCT RIGHT Option in SQL, but this doesn't work in ABAP.

I hope you can help me.

Here is an example:

Column1

0023

1126

2123

6723

6626

The result should be:

23

26

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos

You can't with ABAP releases before 7.40.

For >= 7.40 sp 5 cf ABAP documentation - SQL string functions

Or use native SQL.

matt
Active Contributor

By native SQL, it's best to use CL_SQL_STATEMENT, rather than EXEC...

Sandra_Rossi
Active Contributor
0 Kudos

SUBSTRING valid from ABAP >= 7.40 sp 5 cf ABAP documentation - SQL string functions