‎2020 Nov 03 9:54 AM - edited ‎2024 Feb 03 7:20 PM
Hello guys
I am trying to calculate the total amount/sum of prices of my internal table using subroutines. I only get a table with the prices, but not the prices added up together.
This is what I have so far:
REPORT y_sum.
DATA: it_sum TYPE TABLE OF yreservation,
wa_sum LIKE LINE OF it_sum,
price TYPE yreservation-price,
sum TYPE i.
SELECT *
FROM yreservation
INTO CORRESPONDING FIELDS OF TABLE it_sum
UP TO 500 ROWS.
SKIP 1.
SORT it_sum BY price.
WRITE:/ 'Price', 15 'Gross Payment'.
WRITE:/ sy-uline(70).
PERFORM total USING wa_sum-price CHANGING sum.
FORM total
USING total_price TYPE any
CHANGING total_sum TYPE any.
total_sum = total_sum + total_price.
LOOP AT it_sum INTO wa_sum.
WRITE: / wa_sum-price UNDER 'Price',
sum UNDER 'Gross payment'.
ENDLOOP.
ENDFORM.
I hope you guys can help 🙂
Request clarification before answering.
| User | Count |
|---|---|
| 7 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.