no := LastResNo+1; //Create Transfer Line. TransferLine.RESET; TransferLine.INIT; TransferLine."Document No." := TransferOrderNo; IF LineNo = 0 THEN BEGIN LineNo := 10000; TransferLine."Line No." := LineNo; END; TransferLine.VALIDATE("Item No.",Rec."Item No."); TransferLine.Quantity := "Remaining Quantity"; TransferLine.VALIDATE(Quantity); TransferLine.INSERT(TRUE); //Create the From Entry rvResEntry.RESET; rvResEntry.INIT; rvResEntry."Entry No." := no; rvResEntry."Item No." := "Item No."; rvResEntry."Reservation Status" := rvResEntry."Reservation Status"::Surplus; rvResEntry."Source Type" := DATABASE::"Transfer Line"; rvResEntry."Source ID" := TransferOrderNo; rvResEntry."Source Subtype" := 0; //Negative 0, Positive 1 rvResEntry."Source Ref. No." := LineNo; rvResEntry."Location Code" := TransferHeader."Transfer-from Code"; rvResEntry."Qty. per Unit of Measure" := 1; rvResEntry.VALIDATE("Quantity (Base)", -"Remaining Quantity"); rvResEntry."Shipment Date" := TransferHeader."Shipment Date"; rvResEntry.Positive := FALSE; rvResEntry."Creation Date" := WORKDATE; rvResEntry."Lot No." := "Lot No."; rvResEntry."Item Tracking" := rvResEntry."Item Tracking"::"Lot No."; rvResEntry.INSERT; //Create the Receipt Entry no := no + 1; rvResEntry.RESET; rvResEntry.INIT; rvResEntry."Entry No." := no; rvResEntry."Item No." := "Item No."; rvResEntry."Reservation Status" := rvResEntry."Reservation Status"::Surplus; rvResEntry."Source Type" := DATABASE::"Transfer Line"; rvResEntry."Source ID" := TransferOrderNo; rvResEntry."Source Subtype" := 1; //Negative 0, Positive 1 rvResEntry."Source Ref. No." := LineNo; rvResEntry."Location Code" := TransferHeader."Transfer-to Code"; rvResEntry."Qty. per Unit of Measure" := 1; rvResEntry.VALIDATE("Quantity (Base)", "Remaining Quantity"); rvResEntry."Expected Receipt Date" := TransferHeader."Receipt Date"; rvResEntry.Positive := TRUE; rvResEntry."Creation Date" := WORKDATE; rvResEntry."Lot No." := "Lot No."; rvResEntry."Item Tracking" := rvResEntry."Item Tracking"::"Lot No."; rvResEntry.INSERT; no := no + 1; UNTIL NEXT = 0;
Comments
can some one help me to create reservation entry for each TransferLine of a particular transfer order? I mean, is there any better or correct way using some codeunits?