Custom service for posting purchase invoice


I’ve a Purchase Order and packing slips are already in AX.

i have purch id and packingslip id as a parameter for a PO.i need to invoice the PO through service.

Imagine a scenario where a PO-xyz has multiple packing slips with the some quantity and you are posting an invoice for only one of those packing slips.

I think using the purchFormLetter_invoice.update(…) will do the trick, but I’m looking for the right way to do this.

I have to do this through a service.

Can anybody help me out.