Step 3: Perform initial wiring to Source Document Framework – document classes

Now you need to implement few classes representing your source document.

a)      Create a class which extends SourceDocumentType.

  • Using framework naming standards name this class MyDocumentSourceDocumentType.
  • Implement all abstract methods (see examples in the following existing classes: CustInvoiceSourceDocType, VendorInvoiceSourceDocType, PurchaseOrderSourceDocumentType)

- parmModule(): used to determine whether it is valid to add entries to subledger for given module.

- parmSourceDocumentHeaderRootNodeLabel(), parmSourceDocumentLineRootNodeLabel() : used by UI to display proper label for document header or lines respectively.

- parmSubledgerJournalEntryType(): amounts (including matching amounts) are balanced by the framework across subledger journal entry types.

- parmSubledgerJournalRelievingMethod(): in case of matching it specifies relieving method for amounts of the upstream document.

  • Decorate the class with SourceDocumentExtensionAttribute(s) with appropriate parameters from the newly created enums.


[SourceDocumentExtensionAttribute(enumNum(SourceDocument_MyDocument), SourceDocument_MyDocument::MyDocument)]


b)      Create a class which extends SourceDocument.

  • Using framework naming standards name this class MyDocumentSourceDocument.
  • Implement initializeImplementation() which is intended to set up internal state (for examples see VendorInvoiceSourceDoc.initializeImplementation(), PurchaseOrderSourceDocument.initializeImplementation())
  • Decorate this class with SourceDocumentExtensionAttribute(s) with appropriate parameters from the newly created enums.

[SourceDocumentExtensionAttribute(enumNum(SourceDocument_MyDocument), SourceDocument_MyDocument::MyDocument, tableNum(MyDocumentHeader))]


  • Create an enum for your business event.

- Using framework naming standards name it BusinessEvent_MyDocument.

- Values would list all business event types specific to your document. Add values: None = 0, MyBusinessEvent = 1.

- This will be used by attributes on extensions of AccountingDistributionRule, AccountingJournalizingRule and AccountingPolicy which you will create later.


  • Implement appropriate SourceDocument interfaces – as a minimum SourceDocumentIDataProvider interface providing the following methods:

- parmDistributionTemplateRecId(): should return a RecId reference of a template. If not empty, the template will be used to populate ledger dimension allocation list

- documentsBusinessEvent(): should return the BusinessEvent based on your newly created BusinessEvent_MyDocument enum

- parmAccountingDate(): should return the accounting date for the document

- parmBusinessEventDate(): the simplest implementation is already provided on the SourceDocument class

- parmDefaultDimension(): if default dimension is provided, it is used by the framework to build ledger dimension

c)       Create class(es) extending SourceDocumentLineItem.

  • If your document has amounts to distribute on both header and lines you may need to create two such classes.
  • Using framework naming standards name those classes MyDocumentLineSourceDocumentLineItem, MyDocumentSourceDocumentLineItem respectively.
  • Implement the following abstract methods (for examples see the existing implementations: CustInvoiceSourceDocLineItem, CustInvoiceLineSourceDocLineItem, VendorInvoiceSourceDocLineItem, VendorInvoiceLineSourceDocLineItem, PurchOrderSourceDocumentLineItem, PurchOrderLineSourceDocumentLineItem)

- calculateLegalEntityRecId(): should return reference to CompanyInfo table record representing legal entity of the document line

- calculateSourceDocumentAmountMap(): should return object of type SourceDocumentAmountMap representing collection of amounts to distribute for the line

- documentsBusinessEvent(): should return a business event documented by given source document line. In the simplest form the code will look like the following:

return new BusinessEvent(enumNum(BusinessEvent_MyDocument), BusinessEvent_MyDocument::MyBusinessEvent);

- initializeImplementation() - intended to set up internal state

- parmTransactionCurrencyCode() – should return the currency for the line


  • Decorate each class with SourceDocumentExtensionAttribute(s) with appropriate parameters from the newly created enums.

    Attribute for line class:
    [SourceDocumentExtensionAttribute(enumNum(SourceDocumentLine_MyDocument), SourceDocumentLine_MyDocument::MyDocumentLine)]

    Attribute for totals line class:
    [SourceDocumentExtensionAttribute(enumNum(SourceDocument_MyDocument), SourceDocumentLine_MyDocument::MyDocumentTotalsLine)]


d)      Keep document state persisted by the source document framework in sync with your document state. This is done by overwriting table insert() and update() methods on your document tables.

Document header – insert()





Document header – update()


SourceDocumentProcessorFacade::submitSourceDocumentLinesForHeader(this, SourceDocumentLineAccountingStatus::FullyDistributed);


Document line – insert()




Document line – update()




Next - Step 4: Add Source Document Framework forms to your document UI

Skip to main content