... Here you can find sample code how to re-explode purchase requisition BOM in few lines. report zabexplprbom.
parameters: p_banfn type eban-banfn,
...
... Then when we have list of all business documents we can insert link to it to PO with cl_alink_connection=>insert. Importing: I_PURCHASE_REQUISITION Type EBAN-BANFN
I_PURCHASE_ORDER Type ...
... so you can use this one without checking if reset of rejection can be done or not.
Importing: I_BANFN TYPE EBAN-BANFN -> Purchase Requistion number Changing: C_FACTORY TYPE REF TO IF_PURCHASE_REQ_FACTORY ...
... by checking EBAN table. You have to use OO PR objects to be able to do so. Bellow you can find a method how to check if you can reset the rejection of the requisition done in the WF. Importing: ...
... Importing I_EBELN TYPE EBELN -> Purchase Order number
I_COMMIT TYPE C -> Do you want to do the commit? Tables T_EBAN STRUCTURE EBAN -> Table with PR lines ...