bcquality/microsoft/knowledge/scm/change-item-applications-through-posting-routines.bad.al
Jesper Schulz-Wedde bec8890b7e
Add SCM functional knowledge domain (#192)
* Add SCM functional knowledge domain

Introduce nine source-backed rules with original AL sample pairs, bounded SCM review routing, and complete positive/clean evaluation coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Normalize SCM knowledge and review ownership

Align article and AL sample conventions, keep BC facts separate from review mechanics, and clarify reciprocal Finance ownership without bespoke shared test assertions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-21 10:16:44 +02:00

33 lines
1.7 KiB
AL

codeunit 50104 "SCM Item Application Bad"
{
procedure ChangeSalesQuantityApplication(ApplicationEntryNo: Integer; NewInboundEntryNo: Integer)
var
ItemApplicationEntry: Record "Item Application Entry";
OutboundItemLedgerEntry: Record "Item Ledger Entry";
InboundItemLedgerEntry: Record "Item Ledger Entry";
begin
ItemApplicationEntry.Get(ApplicationEntryNo);
ItemApplicationEntry.TestField(Quantity);
ItemApplicationEntry.TestField("Inbound Item Entry No.");
ItemApplicationEntry.TestField("Outbound Item Entry No.");
ItemApplicationEntry.TestField("Transferred-from Entry No.", 0);
if ItemApplicationEntry.CostApplication() then
Error(QuantityApplicationErr);
OutboundItemLedgerEntry.Get(ItemApplicationEntry."Outbound Item Entry No.");
OutboundItemLedgerEntry.TestField("Entry Type", OutboundItemLedgerEntry."Entry Type"::Sale);
OutboundItemLedgerEntry.TestField(Positive, false);
OutboundItemLedgerEntry.TestField("Drop Shipment", false);
OutboundItemLedgerEntry.TestField(Correction, false);
InboundItemLedgerEntry.Get(NewInboundEntryNo);
InboundItemLedgerEntry.TestField(Positive, true);
InboundItemLedgerEntry.TestField("Item No.", OutboundItemLedgerEntry."Item No.");
InboundItemLedgerEntry.TestField("Variant Code", OutboundItemLedgerEntry."Variant Code");
InboundItemLedgerEntry.TestField("Location Code", OutboundItemLedgerEntry."Location Code");
ItemApplicationEntry."Inbound Item Entry No." := NewInboundEntryNo;
ItemApplicationEntry.Modify(true);
end;
var
QuantityApplicationErr: Label 'Select an ordinary quantity application, not a cost application.';
}