Application Development and Automation 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: 
Read only

ABAP Distinct Right

0 Likes
908

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

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
Read only

Sandra_Rossi
Active Contributor
0 Likes
793

You can't with ABAP releases before 7.40.

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

Or use native SQL.

Read only

matt
Active Contributor
793

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

Read only

Sandra_Rossi
Active Contributor
0 Likes
793

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