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 distinct fields into itab

Former Member
0 Likes
639

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

rainer_hbenthal
Active Contributor
0 Likes
605

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

rainer_hbenthal
Active Contributor
0 Likes
606

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

Read only

0 Likes
605

Hi Rainer,

Thanks for replying.

In your example, I would want

A B E

M N F

Read only

0 Likes
605

Hi Rainer,

Thanks for replying.

In your example, I would want

A B E

M N F

Read only

0 Likes
605

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.

Read only

0 Likes
605

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