Item No. '#NAME?' does not exist.

slmaluwaslmaluwa Member Posts: 364
We suddenly started to see the above error
Item No. '#NAME?' does not exist.
when running while posting any sales (or item) related transactions. I found that it happens when automatic posting of cost to GL Account running. So, I disabled Automatic Cost posting and asked to users to continue to enter data
In the meantime, I also tried to run "Adjust Cost - Item Entries" but, found that this error repeating.

Has anybody seen this before and solved? I used the debugger and found that this happens in this function (CU 5895 Inventory Adjustment).
GetItem(ItemNo)
IsDeletedItem := ItemNo = '';
IF (Item."No." <> ItemNo) OR IsDeletedItem THEN
  IF NOT IsDeletedItem THEN
    Item.GET(ItemNo)
  ELSE BEGIN
    CLEAR(Item);
    Item.INIT;
  END;

I am about to trace the issue in detail using debugger.
But. much appreciate if anyone here who has already experienced this issue earlier and solved it could shed some ideas/help.

Thank you
"A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."

Answers

  • kinekine Member Posts: 12,562
    It seems that there are some entries for such an item but there is no record in table 27 for that item. You need to check it...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • slmaluwaslmaluwa Member Posts: 364
    A quick search on Item Ledger Entry Table and Value Entry table doesn't find anything.

    It resembles the MS Excel's error "#NAME?' when a formula typed in Cell does not exists. So, it MAY be something related to a data import.

    I will keep on trying to spend the weekend freely ](*,)
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • kinekine Member Posts: 12,562
    DO not forget to add quotes when filtering in NAV for this value, else the ? will be used as "1 character I do not know".
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SavatageSavatage Member Posts: 7,142
    IsDeletedItem := ItemNo = '';

    is this some custom code - I have no such code in my 5895
  • slmaluwaslmaluwa Member Posts: 364
    I also don't know whether this area is customized. No such comments by any previous developer
    But it is NAV 4 SP3
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • SavatageSavatage Member Posts: 7,142
    Is this the whole code?

    You have an ELSE BEGIN without a THEN BEGIN?

    GetItem(ItemNo)
    IsDeletedItem := ItemNo = '';
    IF (Item."No." <> ItemNo) OR IsDeletedItem THEN
      IF NOT IsDeletedItem THEN
        Item.GET(ItemNo)
      ELSE BEGIN
        CLEAR(Item);
        Item.INIT;
      END;
    

    This seems better to me - unless there's code I'm not seeing
    IF ItemNo = ''
    THEN IsDeletedItem := TRUE
    ELSE IsDeletedItem := FALSE;
    
    //IF (Item."No." <> ItemNo) OR IsDeletedItem THEN<<<is this actually doing anything?
      IF NOT IsDeletedItem THEN BEGIN
       Item.GET(ItemNo);
      END ELSE BEGIN
        CLEAR(Item);
        Item.INIT;
      END;
    

    Even easier
    If not item.get(ItemNo)
     then begin
      CLEAR(Item);
      Item.INIT;
    END;
    

    Does that code look wierd or i it just me :-k
  • slmaluwaslmaluwa Member Posts: 364
    Savatage wrote:

    Does that code look wierd or i it just me :-k

    I also checked the VER 5.0 DB and the same function is available with the same code.I also understand your point with regard to that IF line.
    GetItem(ItemNo : Code[20])
    IsDeletedItem := ItemNo = '';
    IF (Item."No." <> ItemNo) OR IsDeletedItem THEN
      IF NOT IsDeletedItem THEN
        Item.GET(ItemNo)
      ELSE BEGIN
        CLEAR(Item);
        Item.INIT;
      END;
    
    This is a W1 release. I also exported all objects to TXT and searched for "#NAME?" hoping that it is hard coded somewhere. But, nothing found.
    So the value must be coming from data from the table which we now have to search one by one.
    Does anyone know which tables the Inventory Adjustment process touches?
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • kinekine Member Posts: 12,562
    Just enable debugger and run the process, you will see where it will fail. And you can use Client monitor to see which tables are used...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • TonyHTonyH Member Posts: 223
    The code is fine, thought I think the standard recommendation is to complete the "Then Begin" followed by an "Else" rather than a "Else" followed by a "then begin".

    So since nearly everywhere else in the system you will see it
    If X = Y then begin
      DoA;
      DoB;
    End else
      DoC;
    

    It is technically the same as
    If X <> Y then
      DoC
    else begin
      DoA;
      Dob;
    end;
    

    Just looks odd because you don't see it often, it is however syntax correct.

    Regards the code
    IF (Item."No." <> ItemNo) OR IsDeletedItem THEN<<<is this actually doing anything?
      IF NOT IsDeletedItem THEN BEGIN
       Item.GET(ItemNo);
      END ELSE BEGIN
        CLEAR(Item);
        Item.INIT;
      END;
    
    The line
    IF (Item."No." <> ItemNo) OR IsDeletedItem THEN
    if needed to enter the rest of the conditons. If this condition is false then none of the rest of the code is run.



    t
  • slmaluwaslmaluwa Member Posts: 364
    Hi guys
    I found the problem entry in table "5804 Avg. Cost Adjmt. Entry Point No". This table had some OLD entries with an item code "#NAME?". I removed that line and ran the "Adjust Cost - Item Entries" batch job. All went well and this table is now cleared.

    Appreciate all your replies
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
Sign In or Register to comment.