How To Update Contacts on Business Partner Master Data

Modified on Sat, 14 Jun at 11:02 AM

Maintaining accurate contact information for your customers and vendors is critical—but doing so efficiently at scale is just as important. If you're working in SAP Business One and need to update or add Contact Employees in bulk, the Data Transfer Workbench (DTW) can save you time.

This guide walks you through how to update existing contact employees or add new ones to an existing Business Partner using DTW, step by step.


✅ What You’ll Need

  • Access to SAP Business One (either MS SQL or HANA version)

  • A basic understanding of how DTW works

  • The Business Partner CardCode(s) you want to update and the additional fields you want to change

  • Query access (via SQL or HANA Studio) to get the correct line numbers


Step 1: Identify Existing Contact Employees and Their Line Numbers

Before you can update or add contact employees, you need to determine their LineNum values. These are required by DTW to know which row to update or where to insert new data.

The below queries will give you the Customer Code, Contact Code, Contact Name and calculate the Line Num for you. 


The "Where" Clause allows you to specify a specific Business Partner you are looking to do this for but you can remove it to get a complete list of all contacts in SAP Business One. 


⚠️ Important: You can add more columns into the SELECT portion of the query as necessary, but it is critical that you do not change the ORDER BY section, as doing so will result in incorrect LineNum values, which may cause your DTW update to overwrite the wrong records. 


For Microsoft SQL Server:

SELECT 
    CardCode,
    CntctCode,
    Name,
    ROW_NUMBER() OVER (PARTITION BY CardCode ORDER BY CntctCode) - 1 AS LineNum
FROM 
    OCPR
WHERE 
    CardCode = '<YourCardCode>'
ORDER BY 
    CardCode, CntctCode

For SAP HANA:


SELECT 
    "CardCode",
    "CntctCode",
    "Name",
    ROW_NUMBER() OVER (PARTITION BY "CardCode" ORDER BY "CntctCode") - 1 AS "LineNum"
FROM 
    "OCPR"
WHERE 
    "CardCode" = '<YourCardCode>'
ORDER BY 
    "CardCode", "CntctCode"


The first result will have LineNum = 0, the second = 1, and so on.


✏️ Scenario 1: Update Existing Contact Employees

If you're updating names, emails, phone numbers, or other fields for contacts that already exist:

  1. Run the query above to find existing contact employees for the Business Partner.

  2. In your DTW import template (typically ContactEmployee), populate the LineNum field based on the query results:

    • First contact in the list = LineNum 0

    • Second contact = LineNum 1

    • And so on.

  3. In DTW, select “Update Existing Data” in Step 2 of the wizard.

  4. Complete your import as usual.

✅ Done! Your existing contact employees should now reflect the updates you've made.


➕ Scenario 2: Add New Contact Employees to an Existing Business Partner

If you're looking to add new contacts instead of updating existing ones:

  1. Run the same query to find the current highest LineNum.

  2. In your DTW import file, assign the next sequential LineNum(s) for new contacts:

    • If the highest existing LineNum is 2, the new contact should be LineNum = 3.

    • Continue the sequence for multiple additions.

  3. In DTW, choose “Update Existing Data” (yes, even though you're adding, this is still the right choice).

  4. Complete the import process.

? Note: New contacts will always be appended at the end of the existing list.


Tips and Reminders

  • Don't skip the LineNum: Omitting it or using the wrong number can result in DTW errors or unexpected data overwrites.

  • Always test in a sandbox environment first, especially if you’re doing a large volume update.

  • Back up your data before running updates—just in case.


Final Thoughts

Using DTW to manage contact employees in SAP Business One is a huge time-saver—once you get the LineNum logic down. Whether you’re refreshing outdated info or scaling up your contact list, DTW is your go-to tool for making bulk changes cleanly and quickly.

Got stuck or want help automating this even further? Reach out to our team—we’re always happy to help.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article