0

I have an itab which has the fields kunnr, bukrs, prodgrp & amound. I have the below lines:

150 1000 adsl  10
150 1000 adsl1 15
150 1000 adsl2 20
150 8000 vdsl  25
150 8000 vdsl1 10
200 1000 adsl1 80
200 1000 adsl2 80

I want to do the following: At the end of each customer sum the amount and if it is less than the amount that put the user in selection screen, delete the lines of itab. If it is bigger leave them. This itab at the end of the program will be displayed. Any idea on how to do it in a quick way?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
ekekakos
  • 563
  • 3
  • 20
  • 39

1 Answers1

0

Instead of deleting in the current itab, I would use a new itab and only add the aggregations that match your condition.

Take a look at this answer showing how to aggregate your data in a new itab, and use your user input threshold (pa_user_threshold) before the append.

IF pa_user_threshold >= lf_sum.
   APPEND ls_agg TO lt_agged.
ENDIF.
futu
  • 868
  • 6
  • 12