How to print Opening Balance and Closing Balance for all vendors ?

For one vendor am able to print opeing balance(OB) and closing balance(CB) as follows…

in display method debitamountMST amsumming up alldebit then doing all calculation.

At end i created one programmable section after body (VendTrans)…

so in fetch() after super i am executing

element.execute(2);

Now the problem is for first vendor it’s showing opening balance correctly but after that the same value it is printing for all vendors.

Even at end closing balance is printing which is wrong.Each vendor should have different OB and CB.

How can i achieve this…