OCTG table in SAP Business One (Payment Terms)

OCTG is the SAP Business One payment terms table: one row per payment term, with its code, start point, additional months and days, number of installments, credit limit and cash discount. Business partners and documents store GroupNum, which joins to OCTG.GroupNum, so OCTG explains how the due date of an invoice is calculated.

OCTG key fields

FieldWhat it holds
GroupNumPayment terms number, the key. OCRD.GroupNum and OINV.GroupNum point to it.
PymntGroupPayment terms code (the name users pick).
PayDuMonthStart from: E = month end, H = half month, Y = month start, N = selected date.
ExtraMonthNumber of additional months.
ExtraDaysNumber of additional days.
BslineDateDue date based on: P = posting date, S = system date, T = document date, C = closing date.
InstNumNumber of installments.
TolDaysNumber of tolerance days.
CredLimitMaximum credit.
VolumDscntTotal discount %.
ListNumPrice list. Joins to OPLN.ListNum.
DiscCodeCash discount code (OCDC).
ActiveY = active, N = inactive.

How OCTG relates to other tables

OCTG is master data. OCRD.GroupNum gives the default payment terms of the business partner and the document header (for example OINV.GroupNum) holds the terms used on that document. When InstNum is above one, the installments of the invoice are stored in INV6.

Common joins

  • OCRD T0 LEFT JOIN OCTG T1 ON T1.GroupNum = T0.GroupNum (default terms of the business partner)
  • OINV T2 INNER JOIN OCTG T1 ON T1.GroupNum = T2.GroupNum (terms used on the invoice)
  • OINV T2 INNER JOIN INV6 T3 ON T3.DocEntry = T2.DocEntry (installments created from the terms)

When you use the OCTG table

Use OCTG to list payment terms with their months and days, to compare the terms on invoices with the default terms of the customer, and to calculate due dates in code that posts documents.

Example query: payment terms with the number of customers using each

SQL Server

SELECT T1.GroupNum, T1.PymntGroup, T1.PayDuMonth, T1.ExtraMonth, T1.ExtraDays,
  T1.InstNum, COUNT(T0.CardCode) AS BusinessPartners
FROM OCTG T1
LEFT JOIN OCRD T0 ON T0.GroupNum = T1.GroupNum
GROUP BY T1.GroupNum, T1.PymntGroup, T1.PayDuMonth, T1.ExtraMonth, T1.ExtraDays, T1.InstNum
ORDER BY T1.GroupNum

SAP HANA (column names in double quotes)

SELECT T1."GroupNum", T1."PymntGroup", T1."PayDuMonth", T1."ExtraMonth", T1."ExtraDays",
  T1."InstNum", COUNT(T0."CardCode") AS "BusinessPartners"
FROM OCTG T1
LEFT JOIN OCRD T0 ON T0."GroupNum" = T1."GroupNum"
GROUP BY T1."GroupNum", T1."PymntGroup", T1."PayDuMonth", T1."ExtraMonth", T1."ExtraDays", T1."InstNum"
ORDER BY T1."GroupNum"

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

Common pitfall: Reading only ExtraDays

A term named "45 days" can be stored as 1 additional month plus 15 days, and PayDuMonth can move the start to the month end first. Code that adds only ExtraDays to the posting date gets the wrong due date. Apply the start point, then ExtraMonth, then ExtraDays, from the base date set in BslineDate. See Overdue invoices query.

Ready-made queries that use OCTG

Questions about the OCTG table

How do I get the payment terms name of a customer?

Join OCRD.GroupNum to OCTG.GroupNum and read OCTG.PymntGroup.

What does PayDuMonth mean in OCTG?

The start point of the due date: E = month end, H = half month, Y = month start, N = the selected date.

Where are the installments of an invoice stored?

OCTG.InstNum sets how many; the installments of each A/R invoice are rows in INV6.

Related tables

OCRD (Business Partners) · OINV (A/R Invoice (header)) · INV6 (A/R Invoice (installments)) · 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.