Hi,
hope the below logic works for you.
1) Create an 2 new internal ITAB2 & ITAB3, pass all the values from ITAB1 to ITAB2.
2) Sort ITAB2 by Code Work Unit Quantity Rate.
3) Delete adjacent duplicate from ITAB2 comparing all the fields.
4) Loop at ITAB2 into wa_itab2.
Loop at ITAB1 into wa_itab1 where Code = wa_itab2-code
and Work = wa_itab2-work
and unit = wa_itab2-unit
and quantity = wa_itab2-quantity
and rate = wa_itab2-rate.
wa_itab3-code = wa_itab1-code.
wa_itab3-work = wa_itab1-work.
wa_itab3-unit = wa_itab1-unit.
wa_itab3-quantity = wa_itab3-quantity + wa_itab1-quantity.
wa_itab3-rate = wa_itab3-quantity + wa_itab1-rate.
clear wa_itab1.
endloop.
if not wa_itab3 is initial.
append wa_itab3 to itab3.
clear wa_itab3.
endif
clear wa_itab2.
endloop.