Dear All,
"Determine the proportion of the stage distance to the total shipment distance.
To calculate the proportion, determine the distance for each stage (VTTS-DISTZ) and add all the distance for all stages. Then for each stage, divide the stage distance to the total distance to get the proportion".
Will you please let me know to do this calculation?
Thanks in Advance,
Ranjan
data: begin of itab occurs 0,
distz like vtts-distz,
prop like vtts-distz,
end of itab.
data: gv_distz like vtts-distz,
lv_distz like vtts-distz.
select distz into lv_distz from vtts.
gv_distz = gv_distz + lv_distz .
itab-distz = lv_distz .
append itab.
clear:lv_distz .
endselect.
loop at itab.
itab-prop = gv_distz / itab-distz .
modify itab.
endloop.
select TKNUM
TSNUM
DISTZ
into table itab
where tknum in s_tknum.
loop at itab.
clear v_distz.
loop at itab where tknum = itab-tknum.
v_ditsz = v_distz + itab-distz.
endloop.
itab_new-tknum = itab-tknum.
itab_new-tsnum = itab-tsnum.
itab_new-avg_distz = itab-distz / v_distz.
append itab_new.
clear itab_new.
endloop.
Regards,
Ravi
Add a comment