I would like to sum the values inside my internal table by name, article, date (year) and price, but the problem is that my collect statement is not working. I think this has something to do with my date value which is of YYYY-MM-DD, therefore the collect statement makes a difference between 2014-10-12 and 2014-11-12 and inserts them as two different values.
How can I change the collect statement, so that it knows "2014-10-12" is the same as "2014-11-12".
My table
Hans - Mouse - 80 - 2014-12-01
Hans - Mouse - 80 - 2014-05-01
Albert - Keyboard - 50 - 2015-05-04
Albert - Keyboard - 80 - 2015-10-06
Albert - Keybaoard - 100 - 2016-01-01
What I want
Hans - Mouse - 160 - 2014
Albert - Keyboard - 130 - 2015
Albert - Keybaoard - 100 - 2016
My Code
SELECT * FROM gv_table INTO CORRESPONDING FIELDS OF wa_table
WHERE date(4) BETWEEN '20140101' AND '20160101' <-- date(4) is not working. It gives me an error
COLLECT wa_table INTO lt_table.
ENDSELECT.
Or do I have to loop a second time thru my lt_table and do another collect?
EDIT
I have a global table:
Hans - Mouse - 60 - 2014-12-02
Hans - Mouse - 50 - 2014-12-02
Peter - Keyboard - 40 - 2014-03-02
What I want my local table to look like:
Hans - Mouse - 60 - 2014
Hans - Mouse - 50 - 2014
Peter - Keyboard - 40 - 2014
And then aggregate it:
Hans - Mouse 110 - 2014
Peter - Keyboard - 40 - 2014