---
id: post/aardvarklabs-blog/2603
type: post
title: Guide to Handling Header and Detail Imports into Business Central with AL
summary: "This guide demonstrates how to parse and import delimited files containing header and detail records (like sales orders) into Business Central using AL. It covers two formats: normalized (separate header/detail lines identified by markers) and denormalized (merged header/detail data on single lines), with code examples for parsing both formats into staging tables and creating sales orders."
tier: community
language: en
tags:
  - file import
  - delimited data
  - header-detail
  - al programming
  - data parsing
  - staging tables
system: sales
review:
  state: reviewed
  by: opus
  at: "2026-10-08T01:59:13.830Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-post: 1
  input_hash: 1edcb76edc3f8c92d1fbd8bce0ec8ae3d4e944a6c5691098de657e18d780b8b1
evidence:
  - kind: blog
    url: https://aardvarklabs.blog/2025/09/12/guide-to-handling-header-and-detail-imports-into-business-central-with-al/
    title: Guide to Handling Header and Detail Imports into Business Central with AL
    date: "2025-09-12"
    commit: null
    t: null
    quote: null
  - kind: blog
    url: https://aardvarklabs.blog/2025/09/12/guide-to-handling-header-and-detail-imports-into-business-central-with-al/
    title: Guide to Handling Header and Detail Imports into Business Central with AL
    date: "2025-09-12"
    commit: null
    t: null
    quote: When dealing with a denormalized structure we must have something to anchor us. In this case the External Document Number will be our identifier.
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
post_id: "2603"
source_id: aardvarklabs-blog
source_name: Aardvark Labs
url: https://aardvarklabs.blog/2025/09/12/guide-to-handling-header-and-detail-imports-into-business-central-with-al/
published_at: "2025-09-12T12:00:00.000Z"
author: Marcel Chabot
full_text: false
words: 2193
quotes:
  - text: When dealing with a denormalized structure we must have something to anchor us. In this case the External Document Number will be our identifier.
    why_it_matters: Explains the key technique for detecting new headers in merged-format files without explicit markers
code_objects_mentioned:
  - table ARD_SalesHeader
  - table ARD_SalesDetail
  - page ARDSalesImport
  - page SalesImportCard
  - page SalesImportDetails
systems:
  - sales
  - integration
  - development
versions_mentioned: []
preview:
  embeddable: true
  frame_url: https://aardvarklabs.blog/2025/09/12/guide-to-handling-header-and-detail-imports-into-business-central-with-al/embed/
  image: https://aardvarklabs.blog/wp-content/uploads/2025/09/f9c220aa-eba4-450b-b5a7-f056e97b6efe.jpeg
  image_alt: null
  image_w: 1024
  image_h: 1024
  site_name: Aardvark Labs
  favicon: https://aardvarklabs.blog/wp-content/uploads/2024/04/design-1.png?w=32
  probed_at: "2026-10-07T11:51:35.729Z"
---

# Guide to Handling Header and Detail Imports into Business Central with AL

[Read the post](https://aardvarklabs.blog/2025/09/12/guide-to-handling-header-and-detail-imports-into-business-central-with-al/) · Aardvark Labs (Marcel Chabot) · 2025-09-12 · 2193 words · tier community · reviewed (checked by Opus)

> This guide demonstrates how to parse and import delimited files containing header and detail records (like sales orders) into Business Central using AL. It covers two formats: normalized (separate header/detail lines identified by markers) and denormalized (merged header/detail data on single lines), with code examples for parsing both formats into staging tables and creating sales orders.

## Key points

- Normalized format uses marker characters (H/D) to distinguish header and detail lines, while denormalized format repeats header fields on each detail line
- Data is parsed into separate staging tables (ARD_SalesHeader and ARD_SalesDetail) before creating actual sales orders
- Denormalized parsing relies on detecting changes in an anchor field (external document number) to create new headers
- The parsing logic handles line-by-line text processing, field extraction via delimiters, and linking details to headers via ID tracking

## Quotes

- "When dealing with a denormalized structure we must have something to anchor us. In this case the External Document Number will be our identifier." (Explains the key technique for detecting new headers in merged-format files without explicit markers)

## AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

- table "ARD_SalesHeader"
- table "ARD_SalesDetail"
- page "ARDSalesImport"
- page "SalesImportCard"
- page "SalesImportDetails"

Not found in BC28-30: table "ARD_SalesHeader", table "ARD_SalesDetail", page "ARDSalesImport", page "SalesImportCard", page "SalesImportDetails".

## Context

- Features: delimited file import, text parsing, staging tables, sales order creation, normalized import, denormalized import

Source: Aardvark Labs, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.
