Table of Contents

KVSKBADocumentTotalBuffer

Fields

Name Type Note
Doc Scope Enum (KVSKBADocumentScope)
Doc Type Enum (KVSKBADocumentType)
No. Code[20]
Doc. No. Occurrence Integer
Version No. Integer
Entry No. Integer
Line Type Option OptionMembers: TotalText,TotalAmount,FeeText,SignatureBlock,TotalFormattedText,FeeAmount,FeeFormattedText,,HeadingComment,ServiceComment
Text Text[250]
Amount Decimal
Currency Code Code[10]
Date Date
Formatted Text Blob
Custom Fields Blob

Procedures

BuildFieldDataList(Record KVSKBADocumentHeaderBuffer) :

Summary: Builds the field data list for this document total buffer record based on the provided document header buffer.

procedure BuildFieldDataList(var tmpDocHeader: Record "KVSKBADocumentHeaderBuffer"): 

Parameters:

  • tmpDocHeader: The temporary document header buffer providing layout tokens and currency code.

Remarks: Populates the internal FieldDataList codeunit with text, amount, currency code, and date values using the layout tokens defined in the document header buffer. Call this procedure before GetFieldDataText or AddCustomFields.

GetFieldDataText() : Text

Summary: Returns the serialised field data list as a text string.

procedure GetFieldDataText(): Text

Returns: The complete field data list of this document total buffer record as text.

Remarks: The text representation is generated by the underlying FieldDataList codeunit. Call BuildFieldDataList first to ensure the list is populated.

AddCustomFields(Codeunit KVSKBAMasterDocFieldData) :

procedure AddCustomFields(var CustomFieldsDataList: Codeunit "KVSKBAMasterDocFieldData"): 

GetTableType() : Enum

Summary: Determines the document table type based on the line type of the current record.

procedure GetTableType(): Enum KVSKBADocumentTableType

Returns: The corresponding KVSKBADocumentTableType enum value for the line type.

Remarks: This procedure maps the "Line Type" option of the current record to a specific document table type (KVSKBADocumentTableType). Before applying the default mapping, it raises the OnBeforeGetTableType integration event, allowing subscribers to override the mapping logic for extensibility.

         If not handled externally, the procedure uses a case statement to map each line type (e.g., TotalText,
         TotalAmount, FeeText, SignatureBlock, etc.) to its corresponding table type (e.g., TotalTable, FeeTable,
         SignatureTable, ServiceHeadingTable, ServiceCommentTable). If the line type does not match any known value,
         TotalTable is returned as the default.
        
         This mapping is used to control layout and formatting logic for document totals, fees, headings, and comments
         in reports and printouts. It enables flexible and maintainable document rendering by separating line type logic
         from table layout logic.

GetLineType() : Enum

Summary: Returns the document line type for this document total buffer record.

procedure GetLineType(): Enum KVSKBADocumentLineType

Returns: The matching KVSKBADocumentLineType enum value (AmountLine, FormattedText, or Default).

Remarks: Before applying the default mapping, the OnBeforeGetLineType integration event is raised, allowing subscribers to override the result by setting IsHandled to true. If no subscriber handles the event, TotalAmount and FeeAmount map to AmountLine, TotalFormattedText and FeeFormattedText map to FormattedText, and all other line types return Default.

GetBlobText() : Text

Summary: Reads the formatted text blob field and returns its content as a plain text string.

procedure GetBlobText(): Text

Returns: The text content of the "Formatted Text" blob field, or an empty string if the blob has no value.

Remarks: The blob is read using UTF-8 encoding. Use SetBlobText to write content to the same field.

SetBlobText(Text) :

Summary: Writes the given text into the formatted text blob field.

procedure SetBlobText(WriteText: Text): 

Parameters:

  • WriteText: The text to store in the "Formatted Text" blob field.

Remarks: Clears any existing blob content before writing. The text is stored using UTF-8 encoding. Use GetBlobText to read the value back.

UpdateCustomFields() : Boolean

Summary: Serialises the in-memory custom fields dictionary into the "Custom Fields" blob field.

procedure UpdateCustomFields(): Boolean

Returns: True if at least one custom field was written; false if the dictionary is empty.

Remarks: Each entry is serialised as Key=Value followed by the separator character (ASCII 177). Call AddCustomFieldText to populate the dictionary before calling this procedure. After this call the blob field contains all current dictionary entries.

ClearCustomFields() :

Summary: Clears all entries from the in-memory custom fields dictionary.

procedure ClearCustomFields(): 

Remarks: Only the in-memory dictionary is cleared; the "Custom Fields" blob field on the record is not affected. Call UpdateCustomFields afterwards to persist the cleared state to the blob.

GetCustomFields() : Text

Summary: Reads the "Custom Fields" blob field and returns its raw serialised content as text.

procedure GetCustomFields(): Text

Returns: The raw text content of the "Custom Fields" blob field, or an empty string if the blob has no value.

Remarks: The blob is read using UTF-8 encoding. The returned text contains all key-value pairs separated by ASCII 177. Use SetCustomFields to write and UpdateCustomFields to rebuild the blob from the in-memory dictionary.

SetCustomFields(Text) :

Summary: Writes the given serialised text directly into the "Custom Fields" blob field.

procedure SetCustomFields(WriteText: Text): 

Parameters:

  • WriteText: The serialised key-value text to store in the "Custom Fields" blob field.

Remarks: Clears any existing blob content before writing. The text is stored using UTF-8 encoding. Prefer using AddCustomFieldText and UpdateCustomFields to manage individual entries rather than writing raw text directly.

AddCustomFieldText(Text, Text) :

Summary: Adds or updates a key-value pair in the in-memory custom fields dictionary.

procedure AddCustomFieldText(Key: Text; Value: Text): 

Parameters:

  • Key: The key of the custom field to add or update.
  • Value: The value to associate with the given key.

Remarks: If a key already exists with an identical value, the call is a no-op. If the key exists with a different value, the old entry is removed and replaced. Call UpdateCustomFields to persist the dictionary to the "Custom Fields" blob field.

Events

OnBeforeGetLineType(Record KVSKBADocumentTotalBuffer, Enum KVSKBADocumentLineType, Boolean) :

Summary: Event raised before the default line type mapping is applied in GetLineType.

[IntegrationEvent(false, false)]
local procedure OnBeforeGetLineType(KVSKBADocumentTotalBuffer: Record "KVSKBADocumentTotalBuffer"; var KVSKBADocumentLineType: Enum "KVSKBADocumentLineType"; var IsHandled: Boolean): 

Parameters:

  • KVSKBADocumentTotalBuffer: The current document total buffer record.
  • KVSKBADocumentLineType: The line type enum variable to be set by the subscriber.
  • IsHandled: Set to true to skip the default line type mapping logic.

Remarks: Subscribers can set IsHandled to true and assign a custom value to KVSKBADocumentLineType to replace the standard mapping for additional or company-specific line types.

OnBeforeGetTableType(Record KVSKBADocumentTotalBuffer, Enum KVSKBADocumentTableType, Boolean) :

Summary: Integration event: Allows subscribers to override the default table type mapping for a document total line.

[IntegrationEvent(false, false)]
local procedure OnBeforeGetTableType(DocumentTotalBuffer: Record "KVSKBADocumentTotalBuffer"; var DocumentTableType: Enum "KVSKBADocumentTableType"; var IsHandled: Boolean): 

Parameters:

  • DocumentTotalBuffer: The current KVSKBADocumentTotalBuffer record.
  • DocumentTableType: The document table type to be set by the subscriber.
  • IsHandled: Set to true by the subscriber to indicate that custom logic was applied and default processing should be skipped.

Remarks: This integration event is raised before the standard logic in GetTableType is executed. Subscribers can use this event to provide custom mapping from line type to document table type, for example to support additional line types or implement company-specific layout rules. If a subscriber sets IsHandled to true, the default mapping logic is bypassed and the value assigned to DocumentTableType by the subscriber is used instead. This enables extensibility for report and document layout scenarios without modifying the base table logic.