‎2006 Sep 08 3:17 PM
hi to all
help in this issue
LOOP AT IT_FINAL.
IT_FINAL-CHANGE = IT_FINAL-CHANGE + IT_FINAL-DIFF.
IT_FINAL-PER = ( IT_FINAL-DIFF * 100 ) / IT_FINAL-CHANGE.
MODIFY IT_FINAL.
CLEAR IT_FINAL.
ENDLOOP.
here iam getting percentage per each record but i need percentage for whole change how can i achieive it
thanks in advance
kiran kumar.
‎2006 Sep 08 3:20 PM
If you need the total percentage u need to calculate the same after the loop.
‎2006 Sep 08 3:20 PM
If you need the total percentage u need to calculate the same after the loop.
‎2006 Sep 08 3:21 PM
HI,
Sort the table on Change and use at end of change.
PSEUDO CODE
SORT IT_FINAL BY CHANGE.
LOOP AT IT_FINAL.
..
IT_FINAL-CHANGE = IT_FINAL-CHANGE + IT_FINAL-DIFF.
MODIFY IT_FINAL.
..
AT END OF CHANGE .
IT_FINAL-PER = ( IT_FINAL-DIFF * 100 ) / IT_FINAL-CHANGE.
MODIFY IT_FINAL.
CLEAR IT_FINAL.
END AT.
Regards,
Raghav
‎2006 Sep 08 3:21 PM
LOOP AT IT_FINAL.
*--in this loop we are calculating total values of all the records of V_CHANGE and V_DIFF
v_CHANGE = v_change + ( IT_FINAL-CHANGE + IT_FINAL-DIFF ).
v_diff = v_diff + IT_FINAL-DIFF.
ENDLOOP.
*--here we are calculating percentage with the above summed values.
v_PER = ( v_DIFF * 100 ) / v_CHANGE.define the variable V_CHANGE,V_DIFF AND v_per AS PER THEIR datatypes.
regards
srikanth
Message was edited by: Srikanth Kidambi
‎2006 Sep 08 3:21 PM
‎2006 Sep 08 4:22 PM
HI RICH,
clear tmp_change.
LOOP AT IT_FINAL.
tmp_change = tmp_change + IT_FINAL-DIFF.
ENDLOOP but here additon of change is not happening it is not statyinf in work area it is clearing.
thanks in advance
‎2006 Sep 08 3:23 PM
You'll need an another LOOP to collect the whole data.
LOOP AT IT_FINAL. "+line
TOTAL = TOTAL + IT_FINAL-DIFF. "+line
ENDLOOP. "+line
and then your code...
LOOP AT IT_FINAL.
IT_FINAL-CHANGE = IT_FINAL-CHANGE + IT_FINAL-DIFF.
IT_FINAL-PER = ( IT_FINAL-DIFF * 100 ) / IT_FINAL-CHANGE.
IT_FINAL-total_PER = ( IT_FINAL-DIFF * 100 ) / TOTAL. "+line
MODIFY IT_FINAL.
CLEAR IT_FINAL.
ENDLOOP.
Best regards
Tamá
‎2006 Sep 08 4:06 PM
Hi,
data lv_total type p,
lv_change type p.
LOOP AT IT_FINAL.
IT_FINAL-CHANGE = IT_FINAL-CHANGE + IT_FINAL-DIFF.
IT_FINAL-PER = ( IT_FINAL-DIFF * 100 ) / IT_FINAL-CHANGE.
lv_total = lv_total + it_final-per.
lv_change = lv_change + IT_FINAL-CHANGE.
MODIFY IT_FINAL.
CLEAR IT_FINAL.
ENDLOOP.
lv_total = (lv_total * 100 ) / lv_change.
Regards
Amole