tableextension 50030 APTRRC_ProductionOrderLine extends "Prod. Order Line"
{
fields
{
field(50001; APTRRC_TotalRelativeCostFactor; Decimal)
{
Caption = 'Total Relative Cost Factor';
DataClassification = ToBeClassified;
Editable = false;
}
}
procedure CollectRelativeCost()
var
ProductionOrder: Record "Production Order";
TotalRelative: Decimal;
ProdOrderNo: Code[20];
begin
ProductionOrder.Reset();
ProductionOrder.SetRange(ProductionOrder."No.", "Prod. Order No.");
MESSAGE('range set');
MESSAGE('Prod Order No.: ' + FORMAT(ProductionOrder."No."));
MESSAGE('Prod Order Line: ' + FORMAT("Prod. Order No."));
TotalRelative := 0; // InOnVitialize TotalRelative outside the loop
MESSAGE('initializzed');
if ProductionOrder.FindSet() then begin
TotalRelative := TotalRelative + "Relative Cost Factor";
MESSAGE('While loop');// Accumulate values
end;
APTRRC_TotalRelativeCostFactor := TotalRelative;
MESSAGE('Return values'); // Update the field with the calculated total
Modify();
end;
}