Purchase receiving from x++ code

I’m trying to create a class that allows for batch receiving and register pickticket for pos,

All the code samples that I found are using : purchFormLetter.createParmUpdate();

This method is deprecated in AX 2012,

All what I need is to specify the receive now quantity on the PurchLine, then use the chooselines method , and specify the specqty to use receiveNow, correct?

But I got a couple of errors:

  1. The choosedLines display a dialog that allows the user to modify the query, I do not want this dialog to be displayed since it’s a batch job and will be called from a web service

  2. when I specify All for the specqty, it works fine, but when I specify ReceiceNow, it gives an error

I do not have to use any specific AX classed , so if you have any code to receive a specific qty in AX 2012 in any other way, that would also help

I manged to write this code myself, now I have to attack the next problem: ho to write inventory registration code in AX 2012?