Adding and Updating Business Partner Contacts

Following is an example for adding a new Business Partner contact. In this example, the information for the new address is held in a SQL table named “SBO_Contact_Info,” which is in a database named “VersagoData.”

SELECT
t0.CardCode, t0.Name, t0.Position, t0.tel1, t0.e_maill, t0.CardCode + t0.Name AS [RecordBreak]
FROM bizweaver..OCPR t0
WHERE t0.CardCode = 'C99001'
UNION ALL
SELECT
t0.CardCode, t0.Name, t0.Position, t0.tel1, t0.email, t0.CardCode + t0.Name
FROM VersagoData..sbo_contact_info t0
WHERE t0.CardCode = 'C99001'

The first part of the query returns the existing contact rows for Business Partner code C99001. The second part of the query, after the UNION ALL statement, returns the row of the contract to be added.

This is another example where the rows also use “Change on value …” for the “Create new record on” option. The value created by “RecordBreak” ensures that records are processed for each combination of address name + address type.

The image below shows the mapping for this process.

In this case it is not necessary to map CardCode for the rows, since it is mapped at the header (Business Partners) level.