Lagerbestand und Absatzdaten per EDIFACT. Alle drei Nachrichtentypen bauen auf einfachen Positionsstrukturen auf. Umsätze werden als int64 × 100 (Festkomma) gespeichert.
Bestandstypen (INVRPT):
| Konstante | QTY-Qualifier | Bedeutung |
|---|---|---|
| 1 | 1 | On-hand (verfügbar) |
| 2 | 2 | On-order (bestellt, noch nicht geliefert) |
| 3 | 3 | In-transit (unterwegs) |
Periodenqualifikatoren (SLSRPT/SLSFCT):
| Wert | Bedeutung |
|---|---|
| 617 | Woche |
| 610 | Monat |
| 102 | Tag |
import std.edi.inventory;
import std.alloc;
import std.string;
fn Feld(p: int64, l: int64): pchar {
var b: int64 := alloc(l + 1);
var i: int64 := 0;
while (i < l) { poke8(b + i, peek8(p + i)); i := i + 1; }
poke8(b + l, 0);
return b as pchar;
}
fn main(): int64 {
// INVRPT: Bestand und Zulauf je Artikel
var lines: int64 := alloc(2 * EDI_INV_LINE_SIZE);
var i: int64 := 0;
while (i < 2 * EDI_INV_LINE_SIZE) { poke8(lines + i, 0); i := i + 1; }
poke64(lines + EDI_INV_LINE_GTIN, "04012345678901"c as int64);
poke64(lines + EDI_INV_LINE_GTINLEN, 14);
poke64(lines + EDI_INV_LINE_WAREHOUSE, "4012345000009"c as int64);
poke64(lines + EDI_INV_LINE_WHLEN, 13);
poke64(lines + EDI_INV_LINE_QTY, 480);
poke64(lines + EDI_INV_LINE_TYPE, 1); // 1 = verfuegbarer Bestand
var l1: int64 := lines + EDI_INV_LINE_SIZE;
poke64(l1 + EDI_INV_LINE_GTIN, "04012345678901"c as int64);
poke64(l1 + EDI_INV_LINE_GTINLEN, 14);
poke64(l1 + EDI_INV_LINE_WAREHOUSE, "4012345000009"c as int64);
poke64(l1 + EDI_INV_LINE_WHLEN, 13);
poke64(l1 + EDI_INV_LINE_QTY, 120);
poke64(l1 + EDI_INV_LINE_TYPE, 3); // 3 = unterwegs
var out: int64 := alloc(4096);
var n: int64 := EdiInvrptWrite("BST-MELD-09"c, "20260813"c, lines, 2, out, 4096);
PrintLn(Feld(out, n));
var l2: int64 := alloc(8 * EDI_INV_LINE_SIZE);
var cnt: int64 := EdiInvrptRead(out, n, l2, 8);
PrintLn(StrConcat("Bestandszeilen: ", IntToStr(cnt)));
// SLSRPT: Abverkauf einer Woche
var sl: int64 := alloc(EDI_SLS_LINE_SIZE);
i := 0;
while (i < EDI_SLS_LINE_SIZE) { poke8(sl + i, 0); i := i + 1; }
poke64(sl + EDI_SLS_LINE_GTIN, "04012345678901"c as int64);
poke64(sl + EDI_SLS_LINE_GTINLEN, 14);
poke64(sl + EDI_SLS_LINE_POSGLN, "4012345000016"c as int64);
poke64(sl + EDI_SLS_LINE_POSGLNLEN, 13);
poke64(sl + EDI_SLS_LINE_PERIOD, 617); // 617 = Woche
poke64(sl + EDI_SLS_LINE_DATE, "20260803"c as int64);
poke64(sl + EDI_SLS_LINE_DATELEN, 8);
poke64(sl + EDI_SLS_LINE_QTY, 312);
poke64(sl + EDI_SLS_LINE_REVENUE, 623688); // 6236,88 EUR
poke64(sl + EDI_SLS_LINE_CURRENCY, "EUR"c as int64);
poke64(sl + EDI_SLS_LINE_CURRENCYLEN, 3);
n := EdiSlsrptWrite("ABV-2026-32"c, "20260810"c, sl, 1, out, 4096);
PrintLn(Feld(out, n));
// SLSFCT: Prognose mit Konfidenz
poke64(sl + EDI_SLS_LINE_QTY, 340);
poke64(sl + EDI_SLS_LINE_CONFIDENCE, 85);
n := EdiSlsfctWrite("PROG-2026-33"c, "20260810"c, sl, 1, out, 4096);
PrintLn(Feld(out, n));
return 0;
}
BGM+35+BST-MELD-09+9'DTM+137:20260813:102'LIN+1++04012345678901:SRV'LOC+9:4012345000009'QTY+1:480'LIN+2++04012345678901:SRV'LOC+9:4012345000009'QTY+3:120'CNT+2:2'
Bestandszeilen: 2
BGM+843+ABV-2026-32+9'DTM+137:20260810:102'LIN+1++04012345678901:SRV'LOC+9:4012345000016'DTM+2:20260803:617'QTY+12:312'MOA+9:6236.88:EUR'CNT+2:1'
BGM+844+PROG-2026-33+9'DTM+137:20260810:102'LIN+1++04012345678901:SRV'LOC+9:4012345000016'DTM+2:20260803:617'QTY+12:340'MOA+9:6236.88:EUR'FTX+ACB+++85'CNT+2:1'
Der Bestandstyp steht im Qualifier des QTY-Segments: QTY+1 verfügbarer Bestand, QTY+2 bestellt, QTY+3 unterwegs. Je Artikel und Bestandsart wird eine eigene LIN-Zeile geschrieben — derselbe Artikel taucht also mehrfach auf.
std.edi.corestd.alloc| Offset-Konstante | Inhalt |
|---|---|
EDI_INV_LINE_GTIN / EDI_INV_LINE_GTINLEN | GTIN-Zeiger und -Länge |
EDI_INV_LINE_WAREHOUSE / EDI_INV_LINE_WHLEN | GLN des Lagerorts |
EDI_INV_LINE_QTY | Bestandsmenge |
EDI_INV_LINE_UNIT / EDI_INV_LINE_UNITLEN | Mengeneinheit (optional) |
EDI_INV_LINE_TYPE | Bestandstyp: 1=on-hand, 2=on-order, 3=in-transit |
| Offset-Konstante | Inhalt |
|---|---|
EDI_SLS_LINE_GTIN / EDI_SLS_LINE_GTINLEN | GTIN-Zeiger und -Länge |
EDI_SLS_LINE_POSGLN / EDI_SLS_LINE_POSGLNLEN | GLN Verkaufsstelle (POS) |
EDI_SLS_LINE_PERIOD | Periodenqualifikator: 617=Woche, 610=Monat, 102=Tag |
EDI_SLS_LINE_DATE / EDI_SLS_LINE_DATELEN | Periodenanfangsdatum |
EDI_SLS_LINE_QTY | Verkaufte/prognostizierte Menge |
EDI_SLS_LINE_REVENUE | Umsatz × 100 (Festkomma) |
EDI_SLS_LINE_CURRENCY / EDI_SLS_LINE_CURRENCYLEN | Währungscode |
EDI_SLS_LINE_CONFIDENCE | Konfidenz 0–100 (nur SLSFCT, sonst 0) |
| Write-Funktion | Read-Funktion | Beschreibung |
|---|---|---|
EdiInvrptWrite(refNum, date, lines, lineCount, out, outMax) | EdiInvrptRead(buf, bufLen, lines, maxLines) | Lagerbestand |
EdiSlsrptWrite(refNum, date, lines, lineCount, out, outMax) | EdiSlsrptRead(buf, bufLen, lines, maxLines) | Absatzbericht |
EdiSlsfctWrite(refNum, date, lines, lineCount, out, outMax) | EdiSlsfctRead(buf, bufLen, lines, maxLines) | Absatzprognose |
Alle Write-Funktionen setzen automatisch den BGM-Qualifier. Alle Read-Funktionen geben die Anzahl der gelesenen Zeilen zurück. Zero-Copy: Zeiger in lines zeigen in buf.
EDI_INV_LINE_TYPE an.617 = Woche, 610 = Monat, 102 = Tag. Er landet als drittes Element im DTM+2-Segment.623688 wird zu MOA+9:6236.88. Die Währung steht als drittes Element im selben Segment.EDI_SLS_LINE_CONFIDENCE (0–100) schreibt EdiSlsfctWrite als FTX+ACB. Bei EdiSlsrptWrite wird das Feld ignoriert — beide teilen sich dieselbe Zeilen-Struct.| Unit | Datei |
|---|---|
std.edi.inventory | std/edi/inventory.lyx |
Letzte Aktualisierung: 2026-08-13 — ein durchgehendes, lauffähiges Beispiel für INVRPT, SLSRPT und SLSFCT mit echter Ausgabe (lyxc 1.0.21A); Hinweise zu Bestandsarten, Periodenqualifier und Konfidenzfeld ergänzt
Codebeispiele geprüft: gegen lyxc 1.2.5C übersetzt (Prüflauf 2026-09-08 über die gesamte Doku: 574 Vollprogramme, 0 echte Fehler; zusätzlich 5159 Aufrufe gegen die pub fn-Signaturen in aurum/std gehalten, 0 Abweichungen).