Start a project

Customer balances

All customers with a non-zero account balance, with credit limit and phone.

Tables: OCRDUse: Credit control and month-end checks.

Tool

SELECT T0.CardCode, T0.CardName, T0.Balance, T0.CreditLine, T0.Phone1, T0.E_Mail
FROM OCRD T0
WHERE T0.CardType = 'C' AND T0.Balance <> 0
ORDER BY T0.Balance DESC
Need your UDFs in this report, or a dashboard? We extend it for your company.Customize it →

What this query answers

At month end the accountant wants a fast check of who owes money and who has a credit balance, next to each customer's credit limit. It also shows which customers are close to, or over, their limit before new orders are approved.

Sample output

Illustrative demo values. Your columns are the same; the numbers come from your company.

CardCodeCardNameBalanceCreditLinePhone1E_Mail
C20000Acme Trading1980025000+1 555 0101ap@acme.example.com
C30000Northwind Retail1195010000+1 555 0123accounts@northwind.example.com
C50000Summit Supplies31505000+1 555 0142finance@summit.example.com
C60000Riverside Cafe-4502000+1 555 0166owner@riverside.example.com

SQL Server vs SAP HANA

This is a single-table query with no date or text functions, so HANA only needs the column names in double quotes. Note E_Mail must be written "E_Mail" with that exact casing.

Common errors and fixes

  • A negative balance appears at the bottom: That is a credit balance: the customer has paid more than invoiced or has an open credit note or payment on account. It is correct data, not a query error.
  • Leads are missing or vendors appear: CardType 'C' returns customers only. Leads are 'L' and vendors are 'S'; change the filter to CardType IN ('C', 'L') if needed.
  • Balance differs from the customer's foreign-currency statement: OCRD.Balance is in local currency. Use BalanceFC for customers that are managed in a foreign currency.

Need this report built into SAP Business One?

A saved query answers the question once. We build SAP Business One customer portals: customers see their prices, stock, order status, invoices and statements, and their orders land in SAP as sales orders. Or hire a SAP Business One developer for the whole job, fixed price per phase.

Finance

Related queries

Table reference: OCRD table (Business Partners)

How it works

Three steps, no signup

1

Copy the right version

Use the SQL Server tab for MS SQL databases and the HANA tab for SAP B1 on HANA.

2

Open Query Generator

In SAP Business One go to Tools → Queries → Query Generator, paste and click Execute.

3

Save and share

Click Save, pick a category and give the query a name. Your team can run it from Query Manager.

FAQ

Questions about this tool

How do I run the customer balances query in SAP Business One?

Copy the version that matches your database, open Tools → Queries → Query Generator, paste it in the SQL box and click Execute. Save it to reuse it later.

Which tables does this query use?

It reads OCRD from the standard SAP Business One schema. No user-defined fields are needed.

Can this be turned into a dashboard or alert?

Yes. We turn queries into Crystal reports, Excel reports that refresh themselves, SAP B1 alerts or WhatsApp messages for managers.

Need this inside SAP Business One?

We build add-ons, reports and integrations for SAP B1 on SQL Server and HANA. Tell us what you need and get a fixed price, usually within 24 hours.