---
id: object/codeunit/6140
type: object
title: Codeunit 6140 "E-Doc. Import"
summary: Codeunit 6140 "E-Doc. Import" in EDocument (Microsoft.eServices.EDocument). 15 public procedures, 12 events. Introduced in BC29, still in BC30.
tier: official
language: en
tags:
  - codeunit
  - edocument
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: 43c6c0ab9a860103a397e284c4b9ab29490823c4054cdc5ad5b9e235db1101bf
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/EDocument/app/src/Processing/EDocImport.Codeunit.al
    title: src/Apps/W1/EDocument/app/src/Processing/EDocImport.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes:
    - change/bcapps/11484
    - change/bcapps/10162
    - change/bcapps/9796
object_type: codeunit
object_id: 6140
name: E-Doc. Import
namespace: Microsoft.eServices.EDocument
app: EDocument
extends: null
first_version: "29"
last_version: "30"
present_in:
  - "29"
  - "30"
changed_in: []
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 49
  events: 12
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 3
  calls: 0
  called_by: 0
  implements: 0
---

# Codeunit 6140 "E-Doc. Import"

> Codeunit 6140 "E-Doc. Import" in EDocument (Microsoft.eServices.EDocument). 15 public procedures, 12 events. Introduced in BC29, still in BC30.

EDocument · Microsoft.eServices.EDocument · BC29-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Apps/W1/EDocument/app/src/Processing/EDocImport.Codeunit.al) · facts from BC29

## Properties

| Property | Value |
|---|---|
| Permissions | tabledata "E-Document" = imd, tabledata "E-Doc. Imported Line" = imd |

## Events published

- `OnAfterProcessIncomingEDocument(EDocument: Record "E-Document"; EDocImportParameters: Record "E-Doc. Import Parameters"; StartState: Enum "Import E-Doc. Proc. Status"; DesiredEndState: Enum "Import E-Doc. Proc. Status")` (integration)
  - subscribers: [Codeunit 3303 "Payables Agent"](../codeunit/3303.md) CreateAgentTask, [Codeunit 3316 "PA Events"](../codeunit/3316.md) RecordKnownSenderOnAgentProcessingStep, [Codeunit 3316 "PA Events"](../codeunit/3316.md) TrackFinalizedEDocuments
- `OnAfterProcessImportedDocument(var EDocument: Record "E-Document"; var DocumentHeader: RecordRef)` (integration)
- `OnBeforePrepareReceivedDoc(var EDocument: Record "E-Document"; var TempBlob: Codeunit "Temp Blob"; SourceDocumentHeader: RecordRef; SourceDocumentLine: RecordRef; TempEDocMapping: Record "E-Doc. Mapping" temporary)` (integration)
- `OnAfterPrepareReceivedDoc(var EDocument: Record "E-Document"; var TempBlob: Codeunit "Temp Blob"; SourceDocumentHeader: RecordRef; SourceDocumentLine: RecordRef; TempEDocMapping: Record "E-Doc. Mapping" temporary)` (integration)
- `OnBeforeUpdateDocument(var EDocument: Record "E-Document"; var TempDocumentHeader: RecordRef; var TempDocumentLine: RecordRef; var DocumentHeader: RecordRef)` (integration, obsolete 27.0)
- `OnAfterUpdateDocument(var EDocument: Record "E-Document"; var TempDocumentHeader: RecordRef; var TempDocumentLine: RecordRef; var DocumentHeader: RecordRef)` (integration, obsolete 27.0)
- `OnBeforeCreateDocument(var EDocument: Record "E-Document"; var TempDocumentHeader: RecordRef; var TempDocumentLine: RecordRef; var DocumentHeader: RecordRef)` (integration)
- `OnAfterCreateDocument(var EDocument: Record "E-Document"; var TempDocumentHeader: RecordRef; var TempDocumentLine: RecordRef; var DocumentHeader: RecordRef)` (integration)
- `OnBeforeCreateJournalLine(var EDocument: Record "E-Document"; var JnlLine: RecordRef)` (integration)
- `OnAfterCreateJournalLine(var EDocument: Record "E-Document"; var JnlLine: RecordRef)` (integration)
- `OnAfterInsertImportedEdocument(var EDocument: Record "E-Document"; EDocumentService: Record "E-Document Service"; var TempBlob: Codeunit "Temp Blob"; EDocCount: Integer; HttpRequest: HttpRequestMessage; HttpResponse: HttpResponseMessage)` (integration, obsolete 26.0)
- `OnBeforeInsertImportedEdocument(var EDocument: Record "E-Document"; EDocumentService: Record "E-Document Service"; var TempBlob: Codeunit "Temp Blob"; EDocCount: Integer; HttpRequest: HttpRequestMessage; HttpResponse: HttpResponseMessage; var IsCreated: Boolean; var IsProcessed: Boolean)` (integration, obsolete 26.0)

## Procedures

- `ReceiveAndProcessAutomatically(EDocumentService: Record "E-Document Service"): Boolean`
- `ProcessAutomaticallyIncomingEDocument(EDocument: Record "E-Document"): Boolean`
- `ProcessIncomingEDocument(EDocument: Record "E-Document"; EDocImportParameters: Record "E-Doc. Import Parameters"): Boolean`
- `ProcessIncomingEDocument(EDocument: Record "E-Document"; EDocumentService: Record "E-Document Service"; EDocImportParameters: Record "E-Doc. Import Parameters"): Boolean` (internal)
- `CreateFromType(var EDocument: Record "E-Document"; EDocumentService: Record "E-Document Service"; EDocFileFormat: Enum "E-Doc. File Format"; Filename: Text; InStr: InStream)` (internal)
- `UploadDocument(var EDocument: Record "E-Document")` (internal)
- `V1_GetBasicInfo(var EDocument: Record "E-Document")` (internal)
- `V1_ProcessEDocument(var EDocument: Record "E-Document"; CreateJnlLine: Boolean; AutoProcessDocument: Boolean)` (internal)
- `UpdatePurchaseOrderLink(var EDocument: Record "E-Document")` (internal)
- `ViewExtractedData(EDocument: Record "E-Document")`
- `V1_ProcessImportedDocument(var EDocument: Record "E-Document"; var EDocService: Record "E-Document Service"; var TempBlob: Codeunit "Temp Blob"; CreateJnlLine: Boolean; AutoProcessDocument: Boolean)` (internal)
- `V1_ProcessEDocPendingOrderMatch(var EDocument: Record "E-Document")` (internal)
- `SetHideDialogs(Hide: Boolean)` (internal)
- `V1_AfterInsertImportedEdocument(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; var TempBlob: Codeunit "Temp Blob"; EDocCount: Integer; var HttpRequest: HttpRequestMessage; var HttpResponse: HttpResponseMessage)` (internal)
- `V1_BeforeInsertImportedEdocument(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service"; var TempBlob: Codeunit "Temp Blob"; EDocCount: Integer; var HttpRequest: HttpRequestMessage; var HttpResponse: HttpResponseMessage; var IsCreated: Boolean; var IsProcessed: Boolean)` (internal)

Plus 22 local procedures.

## Recent changes

- 2026-09-29 [#11484 [E-Documents Core] - Supported type direction configuration](../../changes/bcapps/11484.md) (main, BC30, feature)
- 2026-08-13 [#10162 Fix stale start status in e-document import pipeline](../../changes/bcapps/10162.md) (main, BC30, fix)
- 2026-07-30 [#9796 Show a message when an e-document file cannot be viewed or no data could be extracted](../../changes/bcapps/9796.md) (main, BC30, fix)

## Across versions

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

## Deprecations

- procedure V1_AfterInsertImportedEdocument: guarded (#if not CLEAN26)
- procedure V1_BeforeInsertImportedEdocument: guarded (#if not CLEAN26)
- procedure OnAfterInsertImportedEdocument: Pending 26.0 (#if not CLEAN26), "This event is removed. Use new IDocumentReceiver interface instead"
- procedure OnBeforeInsertImportedEdocument: Pending 26.0 (#if not CLEAN26), "This event is removed. Use new IDocumentReceiver interface instead"
- procedure OnAfterUpdateDocument: Pending 27.0 (#if not CLEAN27), "This event is not raised."
- procedure OnBeforeUpdateDocument: Pending 27.0 (#if not CLEAN27), "This event is not raised."

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: "E-Doc. Import")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
