The pre-requisite of this solution is, that the vendors of the ERP system are created as supplier locations in SNC. These supplier locations are assigned to a (supplier) business partner created manually in SNC. Please note that this solution is working for systems which use ReplOrd_in and out xml-s. For POERPRON you have to create the enhacements for the corresponding BIF interfaces.
Create an implementation of Enhancement Spot /SCA/BIF_I_REPLORD and copy and paste the following code to method BEFORE_CONVERSION.
This sample code copies the VendorParty number of the XML to the ShipFromLocation on item level and clears the RecipientParty and VendorParty of the XML. The clear of the Party tags is necessary since the vendor passed in the XML is not created as business partner in SNC.
METHOD /sca/if_ex_bif_i_replord~before_conversion. DATA: ls_shipfrom_id TYPE /sca/bif_s_ship_from_location. FIELD-SYMBOLS: <fs_replord_itm> TYPE /sca/bif_s_replorder_item. * Clear Recipient Party CLEAR cs_replorder_notif-message_header-recipient_party. * Copy Vendor Party Internal ID ls_shipfrom_id-internal_id-scheme_agency_id = cs_replorder_notif-replenishment_order-vendor_party-internal_id-scheme_agency_id. ls_shipfrom_id-internal_id-value = cs_replorder_notif-replenishment_order-vendor_party-internal_id-value. * Clear Vendor Party CLEAR cs_replorder_notif-replenishment_order-vendor_party. * Populate Ship_from location LOOP AT cs_replorder_notif-replenishment_order-item ASSIGNING <fs_replord_itm>. IF <fs_replord_itm>-ship_from_location IS INITIAL. <fs_replord_itm>-ship_from_location = ls_shipfrom_id. ENDIF. ENDLOOP. ENDMETHOD.
Create an implementation of Enhancement Spot /SCA/BIF_O_REPLORDC and copy and paste the following code to method AFTER_CONVERSION. This sample code copies the ShipFromLocation number in the outbound XML to the VendorParty. This is necessary since the Vendor Party of the SNC PO is not created in the ERP system.
METHOD /sca/if_ex_bif_o_replordc~after_conversion. DATA: ls_replord_itm TYPE /sca/bif_s_replordcnf_item. * Read ship-from location READ TABLE cs_replorder_conf-replenishment_order-item INTO ls_replord_itm INDEX 1. IF sy-subrc = 0. * populate Vendor Party cs_replorder_conf-replenishment_order-vendor_party-internal_id-value = ls_replord_itm-ship_from_location-internal_id-value. ENDIF. ENDMETHOD.