bcquality/microsoft/knowledge/scm/reconcile-warehouse-adjustments-with-the-item-ledger.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

37 lines
1.6 KiB
AL

codeunit 50110 "SCM Warehouse Adjustment Bad"
{
procedure ReconcileRegisteredWarehouseAdjustment(ItemNo: Code[20]; LocationCode: Code[10]; TemplateName: Code[10]; BatchName: Code[10]; PostingDate: Date; DocumentNo: Code[20]): Boolean
var
Item: Record Item;
ItemJournalBatch: Record "Item Journal Batch";
ItemJournalLine: Record "Item Journal Line";
Location: Record Location;
CalculateWhseAdjustment: Report "Calculate Whse. Adjustment";
begin
Location.Get(LocationCode);
Location.TestField("Directed Put-away and Pick", true);
Location.TestField("Adjustment Bin Code");
ItemJournalBatch.Get(TemplateName, BatchName);
ItemJournalLine.SetRange("Journal Template Name", TemplateName);
ItemJournalLine.SetRange("Journal Batch Name", BatchName);
if not ItemJournalLine.IsEmpty() then
Error(EmptyBatchErr);
Item.Get(ItemNo);
Item.SetRecFilter();
Item.SetRange("Location Filter", LocationCode);
ItemJournalLine."Journal Template Name" := TemplateName;
ItemJournalLine."Journal Batch Name" := BatchName;
CalculateWhseAdjustment.SetItemJnlLine(ItemJournalLine);
CalculateWhseAdjustment.SetTableView(Item);
CalculateWhseAdjustment.InitializeRequest(PostingDate, DocumentNo);
CalculateWhseAdjustment.SetHideValidationDialog(true);
CalculateWhseAdjustment.UseRequestPage(false);
CalculateWhseAdjustment.RunModal();
exit(true);
end;
var
EmptyBatchErr: Label 'Use an empty, dedicated item journal batch for warehouse reconciliation.';
}