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: 

select distinct fields into itab

Former Member
0 Kudos

Is it possible to create a select distinct statement for a structure where only one field should be distinct.

example:


data: ta_vbrk type standard table of vbrk. 

select vbeln vkorg vtweg (distinct kunag)
  into corresponding fields of ta_vbrk
  where auart = 'xxxx'
     and vtweg = 'yy'

My goal is to fill out the four fields ta_vbrk record but only for the kunag once.

I hope that's clear. It's hard to state when you don't know how to do it

1 ACCEPTED SOLUTION

rainer_hbenthal
Active Contributor
0 Kudos

If you have

A B E

F G E

X Y E

M N F

How should the result look like having only column3 as a distinct value?

? ? E

? ? F

5 REPLIES 5

rainer_hbenthal
Active Contributor
0 Kudos

If you have

A B E

F G E

X Y E

M N F

How should the result look like having only column3 as a distinct value?

? ? E

? ? F

0 Kudos

Hi Rainer,

Thanks for replying.

In your example, I would want

A B E

M N F

0 Kudos

Hi Rainer,

Thanks for replying.

In your example, I would want

A B E

M N F

0 Kudos

Select all rows and then do a delete duplicates on column3 afterwards. There is no such functionality in SQL. Do not forget to sort the internal table before deleting the duplictaes.

0 Kudos

Yup. That's what I did. I was just hoping to minimize the traffic across the network. But, I guess it's not possible.