hello venkatramesh,
heres is my code below
LOOP AT it_afko INTO wa_afko.
wa_final-aufnr = wa_afko-aufnr.
wa_final-igmng = wa_afko-igmng.
wa_final-plnbez = wa_afko-plnbez.
wa_final-gamng = wa_afko-gamng.
p_short = wa_afko-gamng - wa_afko-igmng.
wa_final-p_short = p_short.
CLEAR wa_aufm.
loop at it_aufm INTO wa_aufm.
wa_final-erfmg = wa_aufm-erfmg.
wa_final-matnr = wa_aufm-matnr.
wa_final-erfme = wa_aufm-erfme.
wa_final-charg = wa_aufm-charg.
wa_final-werks = wa_aufm-werks.
wa_final-lgort = wa_aufm-lgort.
wa_final-bwart = wa_aufm-bwart.
CLEAR wa_resb.
* if wa_aufm-erfme EQ 'KG'.
if wa_aufm-bwart NE '101'.
loop at it_resb INTO wa_resb WHERE aufnr = wa_afko-aufnr ."and wa_aufm-bwart NE '101'.
* READ TABLE it_resb INTO wa_resb WITH KEY aufnr = wa_afko-aufnr.
* IF sy-subrc = 0.
* if wa_aufm-bwart NE '101'.
IF wa_resb-shkzg = 'S'.
wa_final-bdmng = wa_final-kzear - wa_resb-bdmng.
ELSEIF wa_resb-shkzg = 'H'.
wa_final-bdmng = wa_final-kzear + wa_resb-bdmng.
ENDIF.
IF wa_resb-shkzg = 'S'.
wa_final-enmng = wa_final-kzear - wa_resb-enmng.
ELSEIF wa_resb-shkzg = 'H'.
wa_final-enmng = wa_final-kzear + wa_resb-enmng.
ENDIF.
p_rsb = wa_final-bdmng - wa_final-enmng.
wa_final-posnr = wa_resb-posnr.
* wa_final-matnr = wa_resb-matnr.
wa_final-bdter = wa_resb-bdter.
wa_final-p_rsb = p_rsb.
CLEAR wa_aufm.
MODIFY it_final FROM wa_final INDEX sy-tabix TRANSPORTING bdmng enmng posnr bdter p_rsb .
ENDLOOP.
ENDIF.
APPEND wa_final to it_final.
CLEAR wa_final.
ENDLOOP.
ENDLOOP.
*SORT it_final ASCENDING.
*delete ADJACENT DUPLICATES from it_final.
can u modify this code for me
i ll be thankful to you.