ORIN table in SAP Business One (A/R Credit Memo (header))

ORIN is the SAP Business One table that stores the header of every A/R credit memo, the document that reduces what a customer owes you after a return, a price correction or a wrong invoice. Its lines are in RIN1, joined on DocEntry, and its object type is 14.

ORIN key fields

FieldWhat it holds
DocEntryInternal key. Joins to RIN1.DocEntry.
DocNumCredit memo number users see, unique per numbering series.
DocDatePosting date. Use it to put returns in the right period.
CardCodeCustomer. Joins to OCRD.CardCode.
CardNameCustomer name as printed on the document.
NumAtCardCustomer reference, often the customer's return or claim number.
DocTypeI = item credit memo, S = service credit memo (no ItemCode on the lines).
DocTotalCredit total including tax, stored as a positive number.
VatSumTax amount. DocTotal - VatSum is the net credit.
DiscPrcntHeader discount percent. Not included in RIN1.LineTotal.
PaidToDateAmount already applied to invoices or refunded.
DocStatusO = open (credit still available), C = closed.
CANCELEDN = normal, Y = cancelled, C = the cancellation document itself.

How ORIN relates to other tables

ORIN is the header and RIN1 the lines, joined on DocEntry. The link to the invoice being credited is not on the header: each RIN1 line stores BaseType, BaseEntry and BaseLine. BaseType = 13 means the line was copied from an A/R invoice (BaseEntry = OINV.DocEntry), 16 from a sales return (ORDN), and -1 means the credit memo was typed by hand with no base document. Cancelling an A/R invoice does not create an ORIN row in current versions: SAP B1 adds a cancellation document to OINV with CANCELED = 'C'.

Common joins

  • ORIN T0 INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry (lines)
  • RIN1 T1 INNER JOIN OINV T2 ON T1.BaseType = 13 AND T1.BaseEntry = T2.DocEntry (original A/R invoice)
  • ORIN T0 INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode (customer master)
  • ORIN T0 LEFT JOIN OSLP T4 ON T0.SlpCode = T4.SlpCode (sales employee)

When you use the ORIN table

Every net sales report needs ORIN: invoices from OINV minus credit memos from ORIN, with the same column names, so one UNION ALL does it. Finance uses it to check open credits in customer balances, and sales managers use it to see which customers return goods or get price corrections most often. For e-invoicing, ORIN is the source of the credit note sent to the tax authority, which almost always needs the original invoice reference.

Example query: credit memos with the invoice they credit

SQL Server

SELECT T0.DocNum AS CreditMemo, T0.DocDate, T0.CardCode, T0.CardName,
  T0.DocTotal, T2.DocNum AS InvoiceNum, T2.DocDate AS InvoiceDate
FROM ORIN T0
LEFT JOIN (SELECT DISTINCT DocEntry, BaseEntry FROM RIN1 WHERE BaseType = 13) T1
  ON T0.DocEntry = T1.DocEntry
LEFT JOIN OINV T2 ON T1.BaseEntry = T2.DocEntry
WHERE T0.CANCELED = 'N' AND T0.DocDate >= '20260101'
ORDER BY T0.DocDate

SAP HANA (column names in double quotes)

SELECT T0."DocNum" AS "CreditMemo", T0."DocDate", T0."CardCode", T0."CardName",
  T0."DocTotal", T2."DocNum" AS "InvoiceNum", T2."DocDate" AS "InvoiceDate"
FROM ORIN T0
LEFT JOIN (SELECT DISTINCT "DocEntry", "BaseEntry" FROM RIN1 WHERE "BaseType" = 13) T1
  ON T0."DocEntry" = T1."DocEntry"
LEFT JOIN OINV T2 ON T1."BaseEntry" = T2."DocEntry"
WHERE T0."CANCELED" = 'N' AND T0."DocDate" >= '20260101'
ORDER BY T0."DocDate"

Paste either version in Tools → Queries → Query Generator. Need the other dialect for your own query? Use the SQL to HANA converter.

Common pitfall: Credit memos typed by hand have no invoice link

When a user creates the credit memo from scratch instead of copying it from the invoice (Copy From or right-click Copy To), every RIN1 line gets BaseType = -1 and no BaseEntry. In the query above those rows show an empty InvoiceNum. Reports cannot tie the credit to a sale, and e-invoicing add-ons fail because the credit note must reference the original invoice: the ZATCA billing reference, the SRI numDocModificado, the FEL reference complement in Guatemala or the original CUFE in Panama. Block it at the source with a SBO_SP_TransactionNotification rule on object type 14 that rejects RIN1 lines where BaseType = -1, or require the original invoice number in a UDF. See SBO_SP_TransactionNotification examples for SQL Server and HANA.

Ready-made queries that use ORIN

Related tables

OINV (A/R Invoice (header)) · INV1 (A/R Invoice (lines)) · OCRD (Business Partners) · search all SAP Business One tables

Sources: SAP Business One documentation and SDK (DI API database tables reference), SAP Help Portal.

Ready to get started?

Tell us what you need. You get a clear technical answer, a fixed scope and a price, usually within 24 hours.