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: 

Delete adjacent duplicates

0 Kudos

Writing a query using tables VBRK & VBRP.  Require VBRP-VGBEL in the query.  VBRP-VGBEL is always the same on all line items.  I just want the report to show 1 line.  I have tried different coding but still get multiple lines.  I think my issues is I need some coding around the VBRP-POSNR.

Not sure what I am missing.  If VBRK-VBELN eq VBRP-VBELN then return one line.

Data: ls_vbrp like standard table of vbrp with header line.

Select VBELN into corresponding fields of table ls_vbrp from vbrp

where vbeln eq vbrk-vbeln.

sort ls_vbrp by vbeln descending.

delete adjacent duplicates from ls_vbrp comparing vbeln.

I've tried including vgbel and only using vgbel. I've tried up to 1 rows.  I have tried adding VBRP-VGBEL as an additional field instead of using the table and the field appears blank.

Any assistance would be greatly appreciated.

Pamela

2 REPLIES 2

thanga_prakash
Active Contributor
0 Kudos

Hello Pamela,

Use SELECT SINGLE as below and try.

SELECT SINGLE vbeln FROM vbrp INTO CORRESPONDING FIELDS OF TABLE ls_vbrp WHERE vbeln EQ vbrk-vbeln.

Regards,

TP

guilherme_frisoni
Contributor
0 Kudos

Hi Pamela,

your code is correct, when using DELETE DUPLICATES you will get only one of each VBELN records.

The code your are testing is the same you pasted here?

Regards,

Frisoni