web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Error Message: The Sales Line does not exist

(0) ShareShare
ReportReport
Posted on by 1,305

I'm getting an error in NAV 2015 on a custom import codeunit I wrote.  I've done this a hundred times, but am getting a message I can't figure out.  I keep getting that the sales line does not exist... funny this is that the debugger shows that the line is active and the code itself would suggest that we're on it.

code snippet follows:

          SalesLine.RESET;
          SalesLine.SETRANGE("Document Type", SalesHeader."Document Type");
          SalesLine.SETRANGE("Document No.", SalesHeader."No.");
          SalesLine.SETRANGE("Line No.", SalesLineImport."Line No.");
          IF SalesLine.FINDFIRST THEN BEGIN
            SalesLine.SetHideValidationDialog(TRUE);
            SalesLine.VALIDATE("Location Code", '04');
            SalesLine.VALIDATE("No.", Item."No.");
            SalesLine.VALIDATE(Description, SalesLineImport.Description);
            SalesLine.VALIDATE("Requested Delivery Date", SalesLineImport."Requested Shipment Date");
            SalesLine.VALIDATE("Unit of Measure", SalesLineImport."Unit of Measure");
            SalesLine.VALIDATE(Quantity, SalesLineImport.Quantity);
            SalesLine.MODIFY;
          END ELSE BEGIN

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    keoma Profile Picture
    32,729 on at

    hi,

    did you check if a sales line with the given line no (from the sales line import rec) does exist in that sales order (?)?

  • Dan Eckhoff Profile Picture
    1,305 on at

    Jonathon,

    It DOESN'T exist - I had already checked.  So how does it get into that IF stub given the FINDFIRST?? - I think I should be in the ELSE which comes below my snippet.

    Dan

  • Verified answer
    Dan Eckhoff Profile Picture
    1,305 on at

    False Alarm?  I restarted the NAV service and it works as expected now.  I had run the test import several times with various errors in scripting, perhaps there was some junk in a buffer.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
HoangNam Profile Picture

HoangNam 7

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans