Hi Sivashankar,
Before the BAPI is called, try to check the line item numbers(field ITEMNO_ACC) in the structure ACCOUNTGL or whatever you are using in debugging. The item numbers must be incremental.
Also, clear the internal table before posting the next document.
Hope this helps