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)

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

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • aavio Profile Picture
    895 on at

    there is some exceptions based on the version of NAV 2009.

    this blog may be useful, please check 

    http://blogs.msdn.com/b/freddyk/archive/2009/05/28/handling-sales-orders-from-page-based-web-services-in-nav-2009sp1-and-rtm.aspx

  • Community Member Profile Picture
    on at

    I've followed the steps described in the blog, only to get the same result in the end.

    Though I learned some new things in the process, my issue remains...

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    i developed your sample in c#.

    using WebApplication2.PurchOrderLineProxy; // web reference

    --------------------------------------------------

    var pLine = new PurchOrderLine();

    pLine.Document_No = "104001";

    pLine.Document_Type = Document_Type.Order;

    pLine.Document_TypeSpecified = true;

    pLine.Line_No = 30000; // 3. line, 2 lines already exist

    pLine.Line_NoSpecified = true;

    pLine.No = "LS-75";

    pLine.Type = PurchOrderLineProxy.Type.Item;

    pLine.TypeSpecified = true;

    pLine.Quantity = 1;

    pLine.QuantitySpecified = true;

    pLine.Location_Code = "YELLOW";

    var service = new PurchOrderLine_Service();

    service.Create(ref pLine);

    this worked.

    important:

    i published page 54 "purchase order subform" as web service (entry in table web service). it was necessary to add fields dodument no, document type and line no (property visible=no) in the page to get them through the web service.

  • Community Member Profile Picture
    on at

    I have published 2 self-made Pages, Purchase Order and Purchase Line (based on the Purchase Header and Purchase Line tables), published as Web Services. My NAV installation is an upgrade from 5.0 to 2009 R2 and only the Classic client is set up for the moment. So it doesn't have any Pages. There's currently no RTC client available, it was never installed. Our external partner has added the necessary objects (like Form 810 Web Services) to our Classic client.

    Is it possible to publish the Purchase Order Subform Form as a Web Service?

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    with nav 2009 its fine. the page is a nav standard page , page 54. exists also as form. add it as new record in table web service.

  • Community Member Profile Picture
    on at

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

  • Suggested answer
    aavio Profile Picture
    895 on at

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

  • Community Member Profile Picture
    on at

    Interesting. I'll give this a go.

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    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
    on at

    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"?

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)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans