Invoice register and invoice approval - using code

I am looking into the possibility of posting an invoice register through code. Has anyone done this before? Having done the invoice register I want to post an invoice approval journal, using the created invoice register. Can this be done through code? Are there any problems in trying to do both actions through code?