Reservation Entry Already Exists Error

jazzyjessjazzyjess Member Posts: 54
Our customer is using the 4.0 SP1 now and they are getting a strange error when trying to change the Ship-To Code on the Sales Order card.

It says "Reservation Entry Already Exists Error Identification Fields and Values Entry No.246013, Positive 'No'".

When tried again, the error is still the same, but the Entry No would be different...maybe say 246014.

Then, they stopped, and tried again, and from time to time, it went through without that error. But if they would try again, the error comes back with different entry no.

I used debugger to trace the problem and the error breaks at the following codes (label A):
But if all had been deleted in (label B), why would it say "entry already exists"?

Please note that this function is being called twice from another function called RecreateSalesLines(ChangedFieldName)

First time it was called like this
RecreateReservEntry(SalesLine, 0, TRUE);

Second time it was called like this:
RecreateReservEntry(SalesLineTmp, SalesLine."Line No.", False);

ReservEntry and TempReservEntry are both Global variable.

Both RecreateSalesLines and RecreateReservEntry are functions in the Sales Header table.

Has anyone seen this error before? Any insight? Would really appreciate your input.

RecreateReservEntry(OldSalesLine : Record "Sales Line";NewSourceRefNo : Integer;ToTemp : Boolean)
IF ToTemp THEN BEGIN
CLEAR(ReservEntry);
ReservEntry.SETCURRENTKEY("Source ID","Source Ref. No.","Source Type","Source Subtype");
ReservEntry.SETRANGE("Source ID",OldSalesLine."Document No.");
ReservEntry.SETRANGE("Source Ref. No.",OldSalesLine."Line No.");
ReservEntry.SETRANGE("Source Type",DATABASE::"Sales Line");
ReservEntry.SETRANGE("Source Subtype",OldSalesLine."Document Type");
IF ReservEntry.FIND('-') THEN
REPEAT
TempReservEntry := ReservEntry;
TempReservEntry.INSERT;
UNTIL ReservEntry.NEXT = 0;
ReservEntry.DELETEALL; //[Label B]
END ELSE BEGIN
CLEAR(TempReservEntry);
TempReservEntry.SETCURRENTKEY("Source ID","Source Ref. No.","Source Type","Source Subtype");
TempReservEntry.SETRANGE("Source Type",DATABASE::"Sales Line");
TempReservEntry.SETRANGE("Source Subtype",OldSalesLine."Document Type");
TempReservEntry.SETRANGE("Source ID",OldSalesLine."Document No.");
TempReservEntry.SETRANGE("Source Ref. No.",OldSalesLine."Line No.");
IF TempReservEntry.FIND('-') THEN
REPEAT
ReservEntry := TempReservEntry;
ReservEntry."Source Ref. No." := NewSourceRefNo;
ReservEntry.INSERT; //[LABEL A] <--ERROR breaks here
UNTIL TempReservEntry.NEXT = 0;
TempReservEntry.DELETEALL;
END;

Comments

  • johnson_alonsojohnson_alonso Member Posts: 690
    Pls check your item card especially planning tab for both reserve and order tracking field, and also check reservation entry table no. 337.



    rgds,
    Johnson Alonso
  • jazzyjessjazzyjess Member Posts: 54
    Both fields are the same as the ones they have in 3.7. I tried to duplicate the exact sales order in 3.7, renaming the Ship-to code multiple times in 3.7 are ok...no error at all....there were just updated from 3.7 to 4.0SP1 couple days ago...everything should be the same except 3 more new sales order created.
  • jazzyjessjazzyjess Member Posts: 54
    yeah i have also checked table 337....each time i tried and got error.
  • johnson_alonsojohnson_alonso Member Posts: 690
    Have you checked the reservation entry table, the field "positive" ? if there is a sign "no", it means that there is no reservation happened. I think you must repeat to make reservation then or you will not be able to correct your data and don't change anything relate to reservation, there will be no influence.


    rgds,
  • ara3nara3n Member Posts: 9,257
    I think when you change the ship-to code, it changes the location code on header, which then changes the location code on then line. And if you have serialed items or with lot, this error could happen. Are there any reservation entry for the sales lines?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • jazzyjessjazzyjess Member Posts: 54
    thank you all for your suggestion.
    We don't use Location code and Lot. No. And i also checked, the Positive field is not checked. And i have also checked the line, there was no Reservation on each line.

    I tried to create a fresh Sales Order with several line items both on 3.7 and 4.0. THe one i created on 3.7 always work. But the one on 4.0....give error even when renaming the Sell-to Customer No field and the Ship-to Code field. I can imagine the same error if i try to rename other field on Sales Header.

    I did an experiment on both 3.7 and 4.0.
    Each time a new Sales Order is created, an entry is created in Reservation Table like this:

    Entry No. Positive Item No. Reservation Status
    =============================================
    243074 No 603-500215 Surplus

    And everytime i rename the same fields on 3.7, it always work.
    So i open the affected codes in 3.7 and 4.0 and found out there is one difference in the code.

    All the affected line of codes are the same in both 3.7 and 4.0 EXCEPT one missing filter in 4.0 SP1 that caused the problem. So i put that filter back in 4.0 SP1 and it works now. But i don't know what this might cause since if that line was deleted in 4.0, it might mean something, right?



    RecreateReservEntry(OldSalesLine : Record "Sales Line";NewSourceRefNo : Integer;ToTemp : Boolean)
    IF ToTemp THEN BEGIN
    CLEAR(ReservEntry);
    ReservEntry.SETCURRENTKEY("Source Type","Source Subtype","Source ID");
    ReservEntry.SETRANGE("Source Type",DATABASE::"Sales Line");
    ReservEntry.SETRANGE("Source Subtype",OldSalesLine."Document Type");
    ReservEntry.SETRANGE("Source ID",OldSalesLine."Document No.");
    ReservEntry.SETRANGE("Source Ref. No.",OldSalesLine."Line No.");
    ReservEntry.SETRANGE("Reservation Status",ReservEntry."Reservation Status"::Reservation); <--missing in 4.0 SP1
    IF ReservEntry.FIND('-') THEN
    REPEAT
    TempReservEntry := ReservEntry;
    TempReservEntry.INSERT;
    UNTIL ReservEntry.NEXT = 0;
    ReservEntry.DELETEALL;
    END ELSE BEGIN
    CLEAR(TempReservEntry);
    TempReservEntry.SETCURRENTKEY("Source Type","Source Subtype","Source ID");
    TempReservEntry.SETRANGE("Source Type",DATABASE::"Sales Line");
    TempReservEntry.SETRANGE("Source Subtype",OldSalesLine."Document Type");
    TempReservEntry.SETRANGE("Source ID",OldSalesLine."Document No.");
    TempReservEntry.SETRANGE("Source Ref. No.",OldSalesLine."Line No.");
    TempReservEntry.SETRANGE("Reservation Status",TempReservEntry."Reservation Status"::Reservation); <---this part is missing from 4.0 SP1

    IF TempReservEntry.FIND('-') THEN
    REPEAT
    ReservEntry := TempReservEntry;
    ReservEntry."Source Ref. No." := NewSourceRefNo;
    ReservEntry.INSERT;
    UNTIL TempReservEntry.NEXT = 0;
    TempReservEntry.DELETEALL;
    END;
  • RoelofRoelof Member Posts: 377
    Hi,

    I encounter a related problem with the Reservation Entry table in 4.00 SP2.
    (See my latest posting). I have the feeling that SP1 and/or SP2 is doing some weird things. I am not able to use a simple setrange and if .. find('-') statement. The filters are set in a correct way (I double check many times) but it didn't work. When I copy over the EXACT same code into a standalone codeunit it works fine.
    It beats me.
    Roelof de Jonghttp://www.wye.com
Sign In or Register to comment.