How to create Debit note and Credit note through X++code in ax2009

How to create Debit note and Credit note through X++code in ax2009