---
id: object/codeunit/7000000-es
type: object
title: Codeunit 7000000 "CarteraManagement" (ES)
summary: Codeunit 7000000 "CarteraManagement" (ES) in the ES country layer (Microsoft.Finance.ReceivablesPayables). 28 public procedures, 19 events. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - es layer
versions:
  introduced: "29"
  last_changed: null
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 51958f8767d93daa4269c4e5b6bc2f8cf15b5baf65a905db982fcb4281992546
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/ES/BaseApp/Local/Finance/ReceivablesPayables/CarteraManagement.Codeunit.al
    title: src/Layers/ES/BaseApp/Local/Finance/ReceivablesPayables/CarteraManagement.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations:
    - localization/es
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/9066
object_type: codeunit
object_id: 7000000
name: CarteraManagement
namespace: Microsoft.Finance.ReceivablesPayables
app: Base Application
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
country: ES
counts:
  fields: 0
  procedures: 58
  events: 19
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 0
---

# Codeunit 7000000 "CarteraManagement" (ES)

> Codeunit 7000000 "CarteraManagement" (ES) in the ES country layer (Microsoft.Finance.ReceivablesPayables). 28 public procedures, 19 events. Introduced in BC29, still in BC30.

ES country layer · Microsoft.Finance.ReceivablesPayables · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/ES/BaseApp/Local/Finance/ReceivablesPayables/CarteraManagement.Codeunit.al) · facts from BC29

An object of the [ES localization](../../localizations/es.md), not part of W1.

## Properties

| Property | Value |
|---|---|
| Permissions | TableData "Cust. Ledger Entry" = m, TableData "Vendor Ledger Entry" = m, TableData "VAT Entry" = imd, TableData "Cartera Doc." = m, TableData "Posted Cartera Doc." = m, TableData "Closed Cartera Doc." = m, TableData "Bill Group" = m |

## Events published

- `OnAfterCreatePayableDocPayment(var GenJournalLine: Record "Gen. Journal Line"; var VendorLedgerEntry: Record "Vendor Ledger Entry")` (integration)
- `OnAfterCreateReceivableDocPayment(var GenJournalLine: Record "Gen. Journal Line"; var CustLedgerEntry: Record "Cust. Ledger Entry")` (integration)
- `OnAfterInsertPayableDocs(var CarteraDoc: Record "Cartera Doc."; var PaymentOrder: Record "Payment Order")` (integration)
- `OnAfterInsertReceivableDocs(var CarteraDoc: Record "Cartera Doc."; var BillGroup: Record "Bill Group")` (integration)
- `OnAfterRemovePayableDocs(var CarteraDoc: Record "Cartera Doc."; var PaymentOrder: Record "Payment Order")` (integration)
- `OnAfterRemoveReceivableDocs(var CarteraDoc: Record "Cartera Doc."; var BillGroup: Record "Bill Group")` (integration)
- `OnAfterReversePayableDocPayment(var GenJournalLine: Record "Gen. Journal Line"; var VendorLedgerEntry: Record "Vendor Ledger Entry")` (integration)
- `OnAfterReverseReceivableDocPayment(var GenJournalLine: Record "Gen. Journal Line"; var CustLedgerEntry: Record "Cust. Ledger Entry")` (integration)
- `OnBeforeCheckConfirmBillGroupAlreadyPrinted(BillGr: Record "Bill Group"; var Result: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeCheckConfirmPaymentOrderAlreadyPrinted(PaymentOrder: Record "Payment Order"; var Result: Boolean; var IsHandled: Boolean)` (integration)
- `OnBeforeCustUnrealizedVAT(var CustLedgerEntry: Record "Cust. Ledger Entry"; var SettledAmount: Decimal; var GenJournalLine: Record "Gen. Journal Line"; var ExistVATEntry: Boolean; var FirstVATEntryNo: Integer; var LastVATEntryNo: Integer; var BgPoPostBuffer: Record "BG/PO Post. Buffer"; var PostedDocumentNo: Code[20]; var PaymentTermsCode: Code[20]; var VATPostingSetup: Record "VAT Posting Setup")` (integration)
- `OnBeforeVendUnrealizedVAT(var VendLedgEntry: Record "Vendor Ledger Entry"; var SettledAmount: Decimal; var GenJournalLine: Record "Gen. Journal Line"; var ExistVATEntry: Boolean; var FirstVATEntryNo: Integer; var LastVATEntryNo: Integer; var BgPoPostBuffer: Record "BG/PO Post. Buffer"; var PostedDocumentNo: Code[20]; var PaymentTermsCode: Code[20]; var VATPostingSetup: Record "VAT Posting Setup")` (integration)
- `OnCustUnrealizedVATOnAfterVATPartCalculated(CustLedgerEntry: Record "Cust. Ledger Entry"; VATEntry: Record "VAT Entry"; VATPostingSetup: Record "VAT Posting Setup"; var SettledAmount: Decimal; var VATPart: Decimal)` (integration)
- `OnCustUnrealizedVATOnBeforeVATEntryModify(var VATEntry: Record "VAT Entry"; CustLedgerEntry: Record "Cust. Ledger Entry"; GenJournalLine: Record "Gen. Journal Line")` (integration)
- `OnInsertPayableDocsOnAfterSetFilters(var CarteraDoc: Record "Cartera Doc."; var CarteraDoc2: Record "Cartera Doc.")` (integration)
- `OnInsertReceivableDocsOnAfterSetFilters(var CarteraDoc: Record "Cartera Doc."; BillGroup: Record "Bill Group")` (integration)
- `OnVendUnrealizedVAT2OnAfterSetFilters(var VendLedgEntry2: Record "Vendor Ledger Entry"; var VendLedgEntry3: Record "Vendor Ledger Entry"; var SettledAmount: Decimal; var GenJournalLine: Record "Gen. Journal Line"; var ExistVATEntry: Boolean; var FirstVATEntryNo: Integer; var LastVATEntryNo: Integer; var BgPoPostBuffer: Record "BG/PO Post. Buffer"; var IsFromJournal: Boolean; var PostedDocumentNo: Code[20])` (integration)
- `OnVendUnrealizedVATOnAfterVATPartCalculated(VendorLedgerEntry: Record "Vendor Ledger Entry"; VATEntry: Record "VAT Entry"; VATPostingSetup: Record "VAT Posting Setup"; var SettledAmount: Decimal; var VATPart: Decimal)` (integration)
- `OnVendUnrealizedVATOnBeforeVATEntry2Modify(var VATEntry: Record "VAT Entry"; VendLedgEntry2: Record "Vendor Ledger Entry"; GenJnlLine: Record "Gen. Journal Line")` (integration)

## Procedures

- `CategorizeDocs(var Doc: Record "Cartera Doc.")`
- `DecategorizeDocs(var Doc: Record "Cartera Doc.")`
- `CategorizePostedDocs(var PostedDoc: Record "Posted Cartera Doc.")`
- `DecategorizePostedDocs(var PostedDoc: Record "Posted Cartera Doc.")`
- `UpdateStatistics(var Doc2: Record "Cartera Doc."; var CurrTotalAmount: Decimal; var ShowCurrent: Boolean)`
- `NavigateDoc(var CarteraDoc: Record "Cartera Doc.")`
- `NavigatePostedDoc(var PostedCarteraDoc: Record "Posted Cartera Doc.")`
- `NavigateClosedDoc(var ClosedCarteraDoc: Record "Closed Cartera Doc.")`
- `InsertReceivableDocs(var CarteraDoc2: Record "Cartera Doc.")`
- `InsertSelectedReceivableDocs(GroupNo: Code[20]; var BillGr: Record "Bill Group"; var CarteraDoc: Record "Cartera Doc.")`
- `InsertPayableDocs(var CarteraDoc2: Record "Cartera Doc.")`
- `ApplySelectedPayableDocsToPaymentOrder(var CarteraDoc: Record "Cartera Doc."; var PmtOrd: Record "Payment Order"; GroupNo: Code[20])` (internal): Applies the user-selected payable cartera documents to the given payment order. Iterates the selection via a snapshot of "Entry No." values to avoid the marked-cursor drop that occurs when Modify is called inside a loop over a page-supplied recordset.
- `RemoveReceivableDocs(var CarteraDoc2: Record "Cartera Doc.")`
- `RemovePayableDocs(var CarteraDoc2: Record "Cartera Doc.")`
- `CheckDiscCreditLimit(var BillGr: Record "Bill Group")`
- `CreateReceivableDocPayment(var GenJnlLine2: Record "Gen. Journal Line"; var CustLedgEntry: Record "Cust. Ledger Entry")`
- `ReverseReceivableDocPayment(var GenJnlLine2: Record "Gen. Journal Line"; var CustLedgEntry: Record "Cust. Ledger Entry")`
- `CreatePayableDocPayment(var GenJnlLine2: Record "Gen. Journal Line"; var VendLedgEntry: Record "Vendor Ledger Entry")`
- `ReversePayableDocPayment(var GenJnlLine2: Record "Gen. Journal Line"; var VendLedgEntry: Record "Vendor Ledger Entry")`
- `CustUnrealizedVAT2(CustLedgEntry2: Record "Cust. Ledger Entry"; AmountLCY: Decimal; GenJnlLine: Record "Gen. Journal Line"; var ExistVATEntry: Boolean; var FirstVATEntry: Integer; var LastVATEntry: Integer; var NoRealVATBuffer: Record "BG/PO Post. Buffer"; IsFromJournal: Boolean; PostedDocumentNo: Code[20])`
- `VendUnrealizedVAT2(VendLedgEntry2: Record "Vendor Ledger Entry"; AmountLCY: Decimal; GenJnlLine: Record "Gen. Journal Line"; var ExistVATEntry: Boolean; var FirstVATEntry: Integer; var LastVATEntry: Integer; var NoRealVATBuffer: Record "BG/PO Post. Buffer"; IsFromJournal: Boolean; PostedDocumentNo: Code[20])`
- `GetLastDate(CurrCode: Code[10]; DocPostDate: Date; Type: Option Receivable,Payable): Date`
- `GetGainLoss(PostingDate: Date; PostingDate2: Date; AmountFCY: Decimal; CurrencyCode: Code[10]): Decimal`
- `GetCurrFactorGainLoss(CurrFactor1: Decimal; CurrFactor2: Decimal; AmountFCY: Decimal; CurrencyCode: Code[10]): Decimal`
- `CheckFromRedrawnDoc(DocNo: Code[20]): Boolean`
- `GetDimSetIDFromCustLedgEntry(GenJnlLine: Record "Gen. Journal Line"; CustLedgEntry: Record "Cust. Ledger Entry"; IsPostedDoc: Boolean): Integer`
- `GetDimSetIDFromCustPostDocBuffer(GenJnlLine: Record "Gen. Journal Line"; CustLedgEntry: Record "Cust. Ledger Entry"; var PostDocBuffer: Record "Posted Cartera Doc."): Integer`
- `GetCombinedDimSetID(GenJnlLine: Record "Gen. Journal Line"; DimSetID: Integer): Integer`

Plus 11 local procedures.

## Triggers

OnRun

## Recent changes

- 2026-07-15 [#9066 [master][ALAppExtensions #30068][ES] Codeunit 7000000 CarteraManagement - Refactor the Functions InsertReceivableDocs and InsertPayableDocs](../../changes/bcapps/9066.md) (main, BC30, refactor)

## Across versions

- Present in: BC29-30
- Changed (declaration) in: none

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "CarteraManagement")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.

A ES country object, not part of W1: the default corpus does not have it; `bcatlas_list_countries` shows which countries the atlas has.
