Skip to Content
0
Nov 20, 2020 at 04:11 PM

Calculate balance of all records with matching PO & PO line item.

13 Views

Hello Everyone,

I will be grateful for you for your help.

My requirement is I have to calculate all the amount with matching PO(ebeln) and PO line item(ebelp) and if the balance is less than Zero with matching PO and PO line item than I have to delete that record from itab or else if it is not zero than it should be in output.

My code what i have written it is working only by comparing PO(ebeln)


LOOP AT e_final INTO lwa_final.
IF e_final IS NOT INITIAL.

lv_sum = lv_sum + lwa_final-dmbtr.

At new ebeln. "po

At new ebelp. "po item

IF lv_sum LE 0.
DELETE e_final WHERE ebeln EQ lwa_final-ebeln.
ENDif.

ENDAT.

CLEAR lv_sum.

CLEAR lwa_final.

ENDAT.
ENDIF.