Wiki

Scale Your Enterprise

User Tools

Site Tools


bw:adding_and_updating_business_partner_addresses

Adding and Updating Business Partner Addresses

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

SELECT
Address, CardCode, Street, Block, ZipCode, City, Country, State, AdresType,
CASE
WHEN AdresType = 'B' THEN 1 ELSE 0 END AS [AdresTypeEnum],
Address + AdresType AS [RecordBreak]
FROM crd1
WHERE CardCode = 'C99001'
UNION ALL
SELECT
AddressName, CardCode, Address1, Address2, PostCode, City, Country, State,
CASE
WHEN AdresType = 'B' THEN 1 ELSE 0 END
Address + AdresType
FROM versagoData..sbo_address_info
WHERE CardCode = 'C99001'

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

This is an 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.

bw/adding_and_updating_business_partner_addresses.txt · Last modified: 2019/02/19 15:22 by runger