Hello Deepthi,
What I understood that you have created a new bank statement format and is trying to upload bank statement with that format. The errors for opening and closing balance are standard error messages and are not related to any of your code. Whenever you try to create a bank statement for a bank account, the system always checks the opening balance of that statement which should be the closing balance of the last bank statement created, which is correct. So to avoid this error you should provide the proper opening balance and no code change.
Hope this helps.
Thanks & Regards,
Meghna