AccumulateARBalance

Accumulate A/R Balance

Major Business Rule

Object Name: B4200510

Parent DLL: CDIST

Location: Client/Server

Language: C

Functional Description

Purpose

The purpose of this business function is to retrieve all the A/R Ledger rows for a customer and 
determine which aging bucket they should be accumulated in. The function will read a row from the F0311 or 

F03B11 table depending on the retrieved which A/R system to use flag.  If the company number is 

different from the previous row, the A/R Constants will be retrieved.  The A/R Aging business function will 

be called to determine the aging headings and/or the aging period for the amount of the invoice.  The 

business function will send back the aging headings, all the values of the aging buckets and the total 

A/R balance.


Setup Notes and Prerequisites


Special Logic




Technical Specification


2.2Related Tables 

Table Table Description

2.3Related Business Functions

Source NameFunction Name
B03B0017FormatAgingColHdings SelectAgingCategoryforTrans


2.4Processing  


• Fetch the Company Constants by Company CO to get Aging Date Based On CCAGE, Aging Method CCAGEM, 
Aging Days - A/R Current CCCRDY, Aging Days - A/R 1 CCAGR1, Aging Days - A/R 2 CCAGR2, Aging Days - A/R 3 

CCAGR3, Aging Days - A/R 4 CCAGR4, Aging Days - A/R 5 CCAGR5, Aging Days - A/R 6 CCAGR6 and Aging 

Days - A/R 7 CCAGR7.

• Save the parameter work date fields.
• Get the aging headings using business function B03B0017 - Format Aging Column Headings.

BEGIN LOOP

• Fetch all A/R Ledger Detail rows by Customer AN8 and get G/L Date RPDGJ, Invoice Date RPDIVJ, Due 
Date RPDDJ, Statement Date RPSMTJ, Document Type RPDCT, Gross Amount RPAG and Open Amount RPAAP.

• Determine the aging category using business function B03B0017 - SelectAgingCategoryforTrans.
• Pass the following data items to B03B0017: 
• AGEM - Aging method from Company Constants CCAGEM
• NCOL - Total number of columns = 8
DATE01 - Date as of from calling program #DA

DAG - Date for aging:

If CCAGE = I, send Invoice Date RPDIVJ
If CCAGE = D, send Due Date RPDDJ

If CCAGE = G, send G/L Date RPDGJ

If CCAGE = S, send Statement Date RPSMTJ

AGR8 - Beginning aging category days from Company Constants CCCRDY

AGR8 - Current aging days from Company Constants CCAGR1

AGR1 - Aging days category 1 from Company Constants CCAGR2

AGR2 - Aging days category 1 from Company Constants CCAGR3

AGR3 - Aging days category 1 from Company Constants CCAGR4

AGR4 - Aging days category 1 from Company Constants CCAGR5

AGR5 - Aging days category 1 from Company Constants CCAGR6

AGR6 - Aging days category 1 from Company Constants CCAGR7

AGR7 - Zero

DATE01 - Work date aging 1 saved from 1st call 

DATE01 - Work date aging 2 saved from 1st call

DATE01 - Work date aging 3 saved from 1st call 

DATE01 - Work date aging 4 saved from 1st call

DATE01 - Work date aging 5 saved from 1st call

DATE01 - Work date aging 6 saved from 1st call

DATE01 - Work date aging 7 saved from 1st call

DATE01 - Work date aging 8 saved from 1st call


• If EV01 is equal F and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Future Amount Due FUTR
• If EV01 is equal F and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Future Amount Due FUTR

• If EV01 is equal 0 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG1
• If EV01 is equal 0 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG1

• If EV01 is equal 1 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG2
• If EV01 is equal 1 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG2

• If EV01 is equal 2 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG3
• If EV01 is equal 2 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG3

• If EV01 is equal 3 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG4
• If EV01 is equal 3 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG4

• If EV01 is equal 4 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG5
• If EV01 is equal 4 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG5

• If EV01 is equal 5 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG6
• If EV01 is equal 5 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG6

• If EV01 is equal 6 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG7
• If EV01 is equal 6 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG7

• If EV01 is equal 7 and Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Aging Amount 1 AG8
• If EV01 is equal 7 and Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Aging Amount 1 AG8


• If Document Type RPDCT is equal to R1
• Add the Gross Amount RPAG to Amount Due AD
• If Document Type RPDCT is not equal to R1
• Add the Open Amount RPAAP to Amount Due AD

END LOOP

^

Data Structure

D4200510 - Accumulate A/R Balance

Special Input Expected
AN8Customer NumberCustomer Number.

COCompanyCompany

#DAAgingDateAging as of date


Special Output Returned

VC30AHeading 1Aging Heading 1

VC30AHeading 2Aging Heading 2

VC30AHeading 3Aging Heading 3

VC30AHeading 4Aging Heading 4

VC30AHeading 5Aging Heading 5

VC30AHeading 6Aging Heading 6

VC30AHeading 7Aging Heading 7

VC30AHeading 8Aging Heading 8

VC30AHeading 9Aging Heading 9

FUTRFutureAmountDueFuture Bucket

AG1AgingAmountCategory1Aging Bucket 1

AG2AgingAmountCategory2Aging Bucket 2

AG3AgingAmountCategory3Aging Bucket 3

AG4AgingAmountCategory4Aging Bucket 4

AG5AgingAmountCategory5Aging Bucket 5

AG6AgingAmountCategory6Aging Bucket 6

AG7AgingAmountCategory7Aging Bucket 7

AG8AgingAmountCategory8Aging Bucket 8

ADAmountDueTotal Amount Due



^

Parameter NameData ItemData TypeReq/OptI/O/Both
mnCustomerNumberAN8MATH_NUMERICNONENONE


Special Input Expected

AN8ab Customer Number


^

szCompanyCOcharNONENONE

A code that identifies a specific organization, fund, or other reporting entity. The company code must already exist in the Company 
Constants table (F0010) and must identify a reporting entity that has a complete balance sheet. At this level, you can have intercompany 
transactions. Note: You can use company 00000 for default values such as dates and automatic accounting instructions. You cannot use company 00000 
for transaction entries.

jdAgingDateDATE01JDEDATENONENONE


Special Input Expected

DATE01ab AgingDate


^

szHeading1VC30AcharNONENONE


Special Output Returned

VC30Aab Aging Heading 1




^

szHeading2VC30AcharNONENONE


Special Output Returned

VC30Aab Aging Heading 2




^

szHeading3VC30AcharNONENONE


Special Output Returned

VC30Aab Aging Heading 3




^

szHeading4VC30AcharNONENONE


Special Output Returned

VC30Aab Aging Heading 4





^

szHeading5VC30AcharNONENONE


Special Output Returned

VC30Aab Aging Heading 5





^

szHeading6VC30AcharNONENONE

ab 
Special Output Returned

VC30Aab Aging Heading 6





^

szHeading7VC30AcharNONENONE

ab 
Special Output Returned

VC30Aab Aging Heading 7


^

szHeading8VC30AcharNONENONE

ab 
Special Output Returned

VC30Aab Aging Heading 8





^

szHeading9VC30AcharNONENONE


Special Output Returned

VC30Aab Aging Heading 9





^

mnFutureAmountDueFTRMATH_NUMERICNONENONE



Special Output Returned

FTRab  FutureAmountDueab Future Bucket

^

mnAgingAmountCategory1AG1MATH_NUMERICNONENONE


Special Output Returned

AG1ab  AgingAmountCategory1ab  ab Aging Bucket 1




^

mnAgingAmountCategory2AG2MATH_NUMERICNONENONE


Special Output Returned

AG2ab  AgingAmountCategory2ab  ab Aging Bucket 2




^

mnAgingAmountCategory3AG3MATH_NUMERICNONENONE

ab 
Special Output Returned

AG3ab  AgingAmountCategory3ab  ab Aging Bucket 3





^

mnAgingAmountCategory4AG4MATH_NUMERICNONENONE


Special Output Returned

AG4ab  AgingAmountCategory4ab  ab Aging Bucket 4





^

mnAgingAmountCategory5AG5MATH_NUMERICNONENONE


Special Output Returned

AG5ab  AgingAmountCategory5ab  ab Aging Bucket 5





^

mnAgingAmountCategory6AG6MATH_NUMERICNONENONE


Special Output Returned

AG6ab  AgingAmountCategory6ab  ab Aging Bucket 6





^

mnAgingAmountCategory7AG7MATH_NUMERICNONENONE

ab 
Special Output Returned

AG7ab  AgingAmountCategory7ab  ab Aging Bucket 7




^

mnAgingAmountCategory8AG8MATH_NUMERICNONENONE

ab 
Special Output Returned

AG8ab  AgingAmountCategory8ab  ab Aging Bucket 8





^

mnAmountDueADMATH_NUMERICNONENONE


Special Output Returned

ADab  AmountDueab  ab  ab  ab Total Amount Due




^

cCalledFromCreditChkP42050EV01charOPTNONE

An option that specifies the type of processing for an event.

mnNumberOfOpenDrafts_NODNODMATH_NUMERICOPTNONE

The number of draft records (R1) in the Customer Ledger table (F03B11) that have a pay status not equal to P. 

mnOutstandingDraftAmount_ODAMODAMMATH_NUMERICOPTNONE

The total value of the open draft amounts.  Outstanding drafts are considered all drafts in Italy and only drafts not yet due in France.

szCurrencyCodeAmountsCRCAcharOPTNONE

The currency in which amounts are stored in the address book. For example, the credit limit, invoiced this year, invoiced prior year, and so 
on. The currency you specify is used to record and store transaction history.

Related Functions

B03B0017 AR Aging - X0303
B03B0063 Retrieve SEPF Flag

Related Tables

F0010 Company Constants
F0311 Accounts Receivable Ledger
F03B11 Customer Ledger