Answer
Rather than trying to reproduce the Manual Supplier Invoice assistant's own header-then-line API sequence in a custom workflow, check whether the standard RCTI (Recipient Created Tax Invoice) / Self-Billing functionality covers your scenario — it's built specifically to generate a supplier invoice automatically at PO receipt, and is a supported, purpose-built alternative to custom-automating the manual invoice assistant's own multi-step virtual-entity flow.