loop at it_code_det.
read table it_qpct with key codegrp = it_code_det-fegrp
code = it_code_det-fecod.
select single * from qpct where codegruppe = it_code_det-urgrp and
code = it_code_det-urcod.
p0 = ( it_code_det-count / total ) * 100.
cp = cp + p0.
write:/2 sy-vline,(8) it_code_det-fegrp color col_key,sy-vline, (5)
it_code_det-fecod color col_key ,sy-vline,(40) it_qpct-kurztext color
col_key,sy-vline,
(8) it_code_det-urgrp color col_key,sy-vline,
(5) it_code_det-urcod color col_key,sy-vline,
(40) qpct-kurztext color col_key,sy-vline,
(2) it_code_det-st color col_heading,sy-vline,
(4) it_code_det-oteil color col_key,sy-vline,
(6) it_code_det-count color col_key,sy-vline,
(6) p0 color col_key,sy-vline,
(7) cp color col_key,sy-vline.
total1 = total1 + p0.
clear qpct.
clear p0.
clear it_qpct.
endloop.
This is the code.Some fields might have no values.That is not a problem. It will be printed with empty space.But empty line appears in b/w records.