creating text file from cheque in ax 2012

Hi,

My requirement is creating a text file when the cheque is generated…
for that i create one method and i used that method before CHEQUETMP class insertion like…

this.Fileoperation(chequeTmp);
chequeTmp.insert();

its working fine but when we creating cheque from AP–>paymentjournal–>lines–>function–>generate payment

everything is working fine but that invoice number was showing empty…
i checked in chequeTmp table there is only accountnum field there but i am unable to give that invoice number
means i want to know that invoicenumber from where it is taking…

when i use debbuger also is not working in that chequedp…

can anybody give sugations for this issue

Thanks,

Dipesh.