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

Select Statement

Former Member
0 Likes
659

Hi Experts,

How can I write a select Statement to select all the fields from REGUP.

With distinct Vendor no’s ( LIFNR ) and the condition must check the Addition field LAUFI = ‘XXXX’.

Thanks & Regards

Rajendra

8 REPLIES 8
Read only

srinivas_akiri
Active Participant
0 Likes
628

Hi

Try as below.

select distinct *

from REGUP

into table itab

where LAUFI = ‘XXXX’.

Read only

Former Member
0 Likes
628

select * from REGUP into itab where LAUF1 = 'XXXX'.

Sort itab by LIFNR.

delete adjacent duplicates from itab comparing LIFNR.

Read only

Former Member
0 Likes
628
SELECT DISTINCT * FROM REGUP INTO TABLE ITAB WHERE LAUF1 = 'XXXX'.

Message was edited by:

chandrasekhar jagarlamudi

Read only

Former Member
0 Likes
628

hi,

u can use select distinct.

performance wise.

select * from regup into table t_regup where lauf1 = 'XXXX'.

DELETE ADJACENT DUPLICATES FROM t_regup comparing lifnr.

santhosh

Read only

Former Member
0 Likes
628

Hi,

you can use a select distinct statement (check abap help for examples)

But this would probably be performance unfriendly for the database.

It's probably faster to just select into table.

and place the logic for finding unique lifnrs in the loop.

Or what I always do is download the content of the table to excel and use excel to search for unique records.

Kind regards, Rob Dielemans

Read only

Former Member
0 Likes
628

Rajendra,

you have no other way. you have to select all the data and use Delete adjacent duplicates. don't forget to sort before using delete adjacent duplicates.

and Option DISTINCT is ruled out on Pooled and cluster tables. since REGUP is not transparent table.

Regards

Vijay

Read only

Former Member
0 Likes
628

Hi Rajendra,

I think there is no way to have this in a single statement.

The simplest way is to select all rows with condition LAUFI = ‘XXXX’.

& thereafter DELETE ADJACENT DUPLICATES...

Read only

Former Member
0 Likes
628

Hi,

Use this statement

select * from REGUP into table t_regup where lauf1 = 'XXXX'.

Sort itab by lifnr.

delete adjacent duplicates from t_regup comparing LIFNR.

Regards,

Kumar