New location code must be ... in item ... (V4.00)

nromainnromain Member Posts: 57
Hello all,

I have a problem when i try to import data into a reclassification journal. I obtain an error message "new location code must be..."

Here is my code :
                    RecGItemJournalLine.VALIDATE("Location Code",location1);
                    RecGItemJournalLine.VALIDATE("Bin Code",bin1);
                    RecGItemJournalLine.VALIDATE("New Location Code",location2);
                    RecGItemJournalLine.VALIDATE("New Bin Code",bin2);

The debug stops in the validate of the New bin code :
New Bin Code - OnValidate()
TESTFIELD("Entry Type","Entry Type"::Transfert);
IF "New Bin Code" <> xRec."New Bin Code" THEN BEGIN
  TESTFIELD("New Location Code");
  IF "New Bin Code" <> '' THEN BEGIN
    GetLocation("New Location Code");
    Location.TESTFIELD("Bin Mandatory");
    Location.TESTFIELD("Directed Put-away and Pick",FALSE);
    GetBin("New Location Code","New Bin Code");
    [b][u]TESTFIELD("New Location Code",Bin."Location Code");[/u][/b]
  END;
END;

it seems that the function getbin() give me the wrong bin. In fact when i enter in the function, i have already the wrong bin (Bin1 instead of Bin2)charged in the Bin record. When i enter the reclassification line manually, i have no problem and the Bin record is uninitialised before the getbin and charged with the right bin after the function.

Is there a problem in the getbin function or am i not using the right way to import data?

Thanks for your help

best regards,

Nicolas

Comments

  • pri_1_ranjanpri_1_ranjan Member Posts: 67
    are u using a dataport ?
    /PDR
  • DaveTDaveT Member Posts: 1,039
    Hi Nicholas

    There seems to be a bug on the getbin function in that if you call it with the same bin code but different locations then it doesn't get the bin record
    e.g. getbin( 'loc1', 'bin1 ); -> getbin( 'loc2', 'bin1' );
    GetBin(LocationCode : Code[10];BinCode : Code[20])
    IF BinCode = '' THEN
      CLEAR(Bin)
    ELSE
      IF Bin.Code <> BinCode THEN
        Bin.GET(LocationCode,BinCode);
    

    the IF statement should read
     IF ( Bin.Code <> BinCode ) or ( bin."location code" <> locationcode )THEN
        Bin.GET(LocationCode,BinCode);
    
    
    

    Hope this helps - I didn't search for a hotfix, etc
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • nromainnromain Member Posts: 57
    Thank you DaveT. I was not sure this was a bug
    I'm going to correct the function :)

    Best regards
    Nicolas
Sign In or Register to comment.