Simulating Release Sales Order Picking in X++

I am writing X++ code that given a text file containing sales order ID, sales line number & quantity details, it checks the stock availability and reserves the stock if ok. My next stage is to simulate the “Release Sales Order Picking” form’s “Release to Pick” functionality, i.e. activating the stock and creating a pick list and ultimately output orders

Can anyone help with the X++ code to help with this or point me in the right direction please?