07-09-2010 9:13 AM
I want to make a SUM for a field from KONV table. Making the sum directly doesn't works because konv is a cluster table. What is the code for making the sum from this table?
Thank you.
07-09-2010 9:28 AM
Hi,
You can proceed with normal selection process ie : fetch the data into and internal table and then later
you can loop that particular internal table and collect it into another internal table to sum up the values.
for example :
select * from ( your required field which you want )
from konv
into table it_konv.
if it_konv[] is not initial.
loop at it_konv into wa_konv.
wa_konv to wa_collect.
collect wa_collect to it_collect.
endloop.
collect statement will full fill your requirment
Let me know if you need further information
Regards
Satish Boguda
07-09-2010 9:31 AM
can use this code also :
data : LV_EFFECTIVE TYPE KONV-KWERT .
SELECT KWERT FROM KONV INTO CORRESPONDING FIELDS OF TABLE IT_KONV WHERE KNUMV EQ WA_EKKO-KNUMV
AND KPOSN EQ WA_EKPO-EBELP
AND KSCHL NE 'NAVS'.
IF IT_KONV IS NOT INITIAL.
LOOP AT IT_KONV INTO WA_KONV.
LV_EFFECTIVE = LV_EFFECTIVE + WA_KONV-KWERT .
ENDLOOP .
ENDIF .