Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

NAV web service throws "cannot enter 'Order' in Integer"

Posted on by Microsoft Employee

I'm trying to add a purchase line to a purchase order in Dynamics NAV (2009 R2 Classic) using web services, but I'm running into a peculiar issue.

Creating a purchase line without defining a No works sans problem. Only when I define a No, like in the example below, I get the following exception:

You cannot enter 'Order' in Integer.

Dim purchaseLine = New PurchaseLine

purchaseLine.Document_No = myPurchaseHeader
purchaseLine.Document_Type = Document_Type.Order
purchaseLine.Document_TypeSpecified = True
purchaseLine.Line_No = 1000
purchaseLine.Line_NoSpecified = True
purchaseLine.Type = Type.Item
purchaseLine.TypeSpecified = True
purchaseLine.No = myItemNo ' Defining No seems to cause the problem.

purchaseLineService.Create(purchaseLine)

I've tried creating the purchase line first, without defining No. Which works, but updating it with No defined, results in the same.

purchaseLine.No = myItemNo

purchaseLineService.Update(purchaseLine)

It was suggested somewhere to try using 1 and "1" for Document_Type, but that didn't work either.

While googling I found some forums where people had a similar problem, but they didn't get me closer to a solution.

Any idea's?

I've also posted this on Stack Overflow.

*This post is locked for comments

  • RE: NAV web service throws "cannot enter 'Order' in Integer"

    The problem is corrected with this change in codeunit 422, function FormatValue.

    //*** BEGIN

    //  EVALUATE(OptionNo,FORMAT(fldRef.VALUE))

     IF NOT EVALUATE(OptionNo,FORMAT(fldRef.VALUE)) THEN

       EXIT(FORMAT(FldRef.VALUE));

    //*** END

  • Suggested answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    did you create a sql backup before import the new objects? if not, you'll need to restart the upgrade. but in your case definitly the best way. start with a nav 2009 demo/cronus database and follow the complete upgrade path defined on msdn. upgrade the existing nav objects by text merging.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    Running into so many issues while importing the Pages from the RTC Client. Missing Codeunits, table fields, variables, ... My NAV installation is definitely messed up and will need to be fixed.

    Thank you all for your time and support.

  • Verified answer
    Suresh Kulla Profile Picture
    Suresh Kulla 43,745 on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    Stan,

    It looks like the upgrade procedure you followed or whoever upgraded is not proper, if you have upgraded correctly you should have got all the pages in your database.

    Try to upgrade it properly again.

    Thanks

    Suresh

  • Verified answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    thats a typical migration problem. it seems the upgrade/migrate path was not correct (you started with an empty target database ?)

    option 1:

    repeat the complete upgrade path to get a clean, working nav 2009 db.

    option 2:

    only import pages 50 and 54, then step by step the needed additional nav objects.

    ex/importing a nav object with needed referenced objects is not supported, sorry.

    here is a step by step instruction (like i would do that kind of task):

    open the global variables list of the pages in page edit mode. there you get most of the referenced nav objects, write down the list and export theses objects as text files.

    export pages 50 and 54 as text files.

    then import/migrate the objects/text files and try to compile them using F11.

    so, step by step, you get the wanted pages in compiled form incl. referenced objects. 

    also helpful: OM Tools from Idyn.

    option 3: 

    write your own codeunit and publish it as web service. to get .net classes for the nav tables you can create xmlports per table and use them in the codeunit.

     

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    Importing the missing objects is no problem, but now I'm getting errors like "Codeunit 7181 does not exist.". So I'm assuming I'm going to have to import more than just the Pages...

    Is it possible to export a Page with all its "references"?

  • Suggested answer
    keoma Profile Picture
    keoma 32,675 on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    that could mean, that when upgrading the target database (nav 2009) was completly empty and you only imported/migrated the nav 5 objects. to get the standard nav 2009 objects (pages, reports, etc.) you can export them from the demo/cronus database shipped with nav 2009 and then import the fob files to your db.

    acc. to your error, try following:

    pLine.Type = (PurchOrderLineProxy.Type) 2;

    to set the type value.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    Interesting. I'll give this a go.

  • Suggested answer
    aavio Profile Picture
    aavio 895 on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    Page objects you can export/import from nav 2009R2 demo database

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: NAV web service throws "cannot enter 'Order' in Integer"

    Well there's the problem... I don't have any Pages, except for the ones I made myself.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans