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: 

collect operation to calculate quantity

vikash_pathak
Participant
0 Kudos

Hi ABAPER's,

i have to add quantity field( BDMNG) value against BAUGR and BDTER field value ,

how to use collect statement in new ABAP 7.5 to add quantity values?

Please share the solution.

Thanks

    TYPES: BEGIN OF TY_DATA,
             MATKL     TYPE -MARA-MATKL,
             MATNR     TYPE MARA-MATNR, "RESB-BAUGR
             Quantity TYPE RESB-BDMNG,
             MONTH     TYPE CHAR2, "RESB-BDTER+4(2)
             YEAR      TYPE CHAR4, "RESB-BDTER+0(4)
           END OF TY_DATA,
           TT_DATA TYPE HASHED TABLE OF TY_DATA
           WITH UNIQUE KEY MATKL MATNR,<br>
4 REPLIES 4

horst_keller
Product and Topic Expert
Product and Topic Expert

0 Kudos

it will not work simply, because he has the field MATKL in the table. As it does not specify this column for the collect, the logic could not work. He needs to create another table from this one.

0 Kudos

Hi,

I am updating entries to final table from two different tables MARA and RESB , in that scenario the first collect example will not work.

any other solution?

Thanks

0 Kudos

You should provide your code, if it is a SELECT statement you could do a SUM, GROUP BY ... or better a CDS