Weird. Adding Records to Reservation Entry

slmaluwaslmaluwa Member Posts: 366
First of all, it looks weird for me. But, again, dunno whether I do the correct thing.

Based the records of ILE, I wanted to fill a transfer order line (items are lot-tracked). In a loop for selected ILE records, I add the item details and quantity to Transfer Line table. Create the corresponding lines in Reservation Entry table. (Refer code snippet below).

But, once the process completed, I see reservation entries ONLY for the last item in the Transfer Line of that order. Transfer Lines are created for all selected items perfectly. I did DEBUG and saw code executed all reservation entries for all items. But, the records are simply not written to the reservation table.

I want to know whether this is actually possible? If yes, is the way I have done it correct?
           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;
"A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."

Comments

  • slmaluwaslmaluwa Member Posts: 366
    Or else,
    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?
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
Sign In or Register to comment.