Post sales order with selected lines

Hi, Just wondering if someone can put me in right direction. I need to post sales order in AX using x++. Below is the code which is working fine. Nevertheless, this code post the full sales order (All Lines). Whereas, we only want to invoiced those lines where due date is in past. Can someone please help. salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice); salesTable = SalesTable::Find(“SO-001”); SalesFormLetter.update(SalesTable,systemDateGet(), SalesUpdate::All, AccountOrder::None, false, false); Regards,