04-02-2015 10:48 PM
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
04-10-2015 11:57 AM
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
04-10-2015 1:56 PM
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