Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

I can't create a Purchase Order in Dynamics NAV 2016 by using SOAP

(0) ShareShare
ReportReport
Posted on by 45

I created the Purchase Order Header by SOAP, It created successfully but when I created the Purchase Order Line. I have received the following exception.

"The field No. of table Purchase Line contains a value (1100) that cannot be found in the related table (Standard Text)."

I also change the Item No but nothing happens. where 1100 is the Item No.

*This post is locked for comments

  • Verified answer
    RE: I can't create a Purchase Order in Dynamics NAV 2016 by using SOAP

    I was adding a GL Account. but now the issue has been solved because we also have to give the TypeSpecified = True; for adding the type. Thanks for the help.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 60,155 Super User 2025 Season 1 on at
    RE: I can't create a Purchase Order in Dynamics NAV 2016 by using SOAP

    we are talking about this line

    poLine1.Type = POServiceReference.Type.G_L_Account;

    it should be Item

  • Suggested answer
    Paras mehan Profile Picture
    Paras mehan 3,518 on at
    RE: I can't create a Purchase Order in Dynamics NAV 2016 by using SOAP

    Hi,

    Currently type is GL Account. It must be item then mention the item no.

  • RE: I can't create a Purchase Order in Dynamics NAV 2016 by using SOAP

               Here is my code as you can see my provided fields but I am unable to create a PO with Lines or insert(update) into the existing PO.

               BasicHttpBinding binding = new BasicHttpBinding();

               binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;

               binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; 

     

               POServiceReference.PO_PortClient portClient = new POServiceReference.PO_PortClient(binding,new EndpointAddress(POurl));

               POServiceReference.PO po = new POServiceReference.PO();

     

               var PurOrd = portClient.Read("46185");

              

               po.Buy_from_Vendor_No = "156";

               po.Vendor_Invoice_No = "Test 2";

               po.Buy_from_Vendor_Name = "Test 2";

               po.Document_Date = DateTime.Now;

               po.Posting_Date = DateTime.Now; 

     

               POServiceReference.Purchase_Order_Line[] ArrayPOLines = new POServiceReference.Purchase_Order_Line[1];           

               POServiceReference.Purchase_Order_Line poLine1 = new POServiceReference.Purchase_Order_Line();

     

               poLine1.Type = POServiceReference.Type.G_L_Account;

                poLine1.No = "65030";

               poLine1.Quantity = 20;

               poLine1.Direct_Unit_Cost = 100;

              

               ArrayPOLines[0] = poLine1; 

               po.PurchLines = ArrayPOLines;

     

               portClient.Create(ref po);

  • Suggested answer
    Paras mehan Profile Picture
    Paras mehan 3,518 on at
    RE: I can't create a Purchase Order in Dynamics NAV 2016 by using SOAP

    Hi,

    Please mention the item in type field in that line. and then mention item no. in no. field.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 60,155 Super User 2025 Season 1 on at
    RE: I can't create a Purchase Order in Dynamics NAV 2016 by using SOAP

    you need to set type field to Item before setting No field.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,492 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans