Enterprise Resource Planning Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Tonekaboni
Explorer
4,148

Introduction

It’s a common headache in SAP Business One: a company shows up in both ledgers—vendor and customer—and the net position isn’t obvious during day-to-day work. In SAP Business One, link the two records using the 'Connected Customer/Vendor' field in BP Master Data (Accounting) so the relationship is explicit in the system. Once the records are linked, the standard tools—Dunning, Aging, and Internal Reconciliation—become much more useful for seeing the combined relationship. The foundational aspects of handling these dual-role scenarios are valuable topics within the SAP Business One community. This article provides practical tips to enhance your control over these relationships.

In practice, most teams want faster, on‑form visibility and safeguards. Here's what actually delivers that. This article delves into practical custom enhancements you can implement in SAP Business One. We'll cover how to empower users through:

  • Adding dynamic User-Defined Fields (UDFs) with live balance queries to critical forms like Outgoing Payments.
  • Implementing automated alerts to stay informed about key connected BP statuses.
  • Introducing transaction validations (via SBO_SP_TransactionNotification) to prevent issues, such as unnecessary payments to vendors who are also indebted to us as customers.

Connecting Business Partners

To link a customer and a vendor in SAP Business One, you can use the 'Connected Customer/Vendor' field within the accounting tab in Business Partner Master Data.

💡    The [ConnBP] database field in the OCRD table (Business Partner Master Data table) stores this link, and connect two distinct BP records.

Connected Vendor/Customer field in BP Master DataConnected Vendor/Customer field in BP Master Data


Standard SAP Business One Tools for Managing Connected BPs

1.    Dunning Wizard: This tool can be configured to consider the connected relationship, providing a comprehensive report for both the primary BP and its connected counterparts by selecting the relevant options in the Dunning Wizard.

Dunning Wizard for connected BPsDunning Wizard for connected BPs

2.    Customer/Vendor Aging Reports: These reports can also display all related documents for connected business partners, offering a unified view.

Customer/Vendor Aging ReportsCustomer/Vendor Aging Reports

3.    BP Internal Reconciliation: After reviewing the status of connected BPs (e.g., via Aging Reports or your custom query), the Internal Reconciliation feature can be used. While standard internal reconciliation typically applies to transactions within a single BP account, understanding the consolidated picture can guide manual journal entries or offsetting transactions that effectively reconcile the net position between a connected customer and vendor when submitting financial documents.

BP Internal ReconciliationBP Internal Reconciliation

Internal ReconciliationInternal Reconciliation

Going Beyond Standard Tools: Custom Enhancements for Superior Control

Beyond the built‑in functions, a few small customizations can give you tighter control in daily business:

1.    Custom Queries for Real-time Tracking & Proactive Alerts: You can create specific SQL queries to get an immediate overview of these relationships. This query can then be added to a user's 'My Menu' for quick access.

SELECT
    V.CardCode,
    V.CardName,
    C.CardCode,
    C.CardName,
    C.Balance AS CustomerBalance,
    V.Balance * -1 AS VendorBalance,
    V.Balance + C.Balance AS NetBalance
FROM OCRD V
INNER JOIN OCRD C ON V.CardCode = C.ConnBP
WHERE V.CardType = 'S' AND C.CardType = 'C'
ORDER BY V.CardCode;

🔗    This query provides a real-time snapshot of vendor-customer balances, aiding decision-making. The full code is on GitHub.

Connected BP Balance QueryConnected BP Balance Query
Set up the balance query as a scheduled Alert: if the connected customer is overdue beyond your limit and the vendor has a payment due, AP gets a notification.

Setting up alerts for connected BP balancesSetting up alerts for connected BP balances

Messages/Alerts OverviewMessages/Alerts Overview

💡   For scheduled alerts, ensure the SAP Business One Job Service (Alerts) component is installed and running on your server, and that Alert Management is enabled in General Settings.

2.    Implementing Transaction Validations via Stored Procedure

To prevent potential issues, such as making a large payment to a vendor who, as a connected customer, has a significant overdue balance, you can implement validations directly within SAP Business One transactions.

You can do this by adding a rule in the SBO_SP_TransactionNotification stored procedure: when an Outgoing Payment is added for a vendor, check the connected customer's overdue balance and block it if it's over your set limit. For example, when an Outgoing Payment is being added for a vendor, your stored procedure can check if this vendor has a connected customer account with an overdue balance. Based on predefined conditions (e.g., if the customer's overdue amount exceeds a certain threshold), the procedure can block the payment and display an error message to the user, prompting them to review the consolidated account status before proceeding.

🔗    This way, you avoid paying a supplier who is overdue as a customer. The complete stored procedure is available on GitHub.

Validations via Stored ProcedureValidations via Stored Procedure

3.    User-Defined Fields (UDFs) for Instant Visibility on Forms

Add UDFs on Outgoing Payments and drive them with Formatted Searches so that when a vendor is picked, the connected customer code and both balances appear instantly. When a vendor is selected, these UDFs can automatically display the code of any connected customer and their relevant balances.

Used-Defined Fields - ManagementUsed-Defined Fields - Management

When a vendor is selected on the Outgoing Payment form, if they have a customer linked using the 'Connected Customer' field (in BP Master Data), the UDF for 'Connected BP Code' will auto-populate. Subsequently, other UDFs can display the connected customer's balance and the main vendor's balance using Formatted Searches linked to custom SQL queries.

Outgoing Payments form with UDFs for a linked customerOutgoing Payments form with UDFs for a linked customer

These UDFs use the Formatted Search feature to automatically fetch and display relevant data via linked SQL queries.

💡    To assign a Formatted Search to a UDF (or any field), select the field on the form and press 'Alt + Shift + F2'  to open the 'User-Defined Values - Setup' window.

Used-Defined ValuesUsed-Defined Values

If no customer is connected to the selected vendor, the 'Connected BP Code' UDF will be empty, and the 'Customer Balance' UDF will display zero.

Outgoing Payments Form for a Vendor with No Linked CustomerOutgoing Payments Form for a Vendor with No Linked Customer


Conclusion

Adding a few well‑chosen UDFs, a targeted alert, and one or two validation rules can make SAP Business One much easier to use when a vendor is also a customer—giving your team a clearer view, more control, and fewer mistakes.

 

Prepared by

Amirhossein Tonekaboni
SAP Business One ERP Consultant

SAP and SAP Business One are trademarks of SAP SE. This article is an independent publication by the author and not an official SAP statement.

1 Comment
alizamani
Participant

Hi
Amirhossein
It was a highly beneficial and thought-provoking piece. I appreciate you sharing your valuable content.