Developer forum

Forum » Integration » When getting products from NAV there is an error with the length of "VAT Bus. Posting Group" code

When getting products from NAV there is an error with the length of "VAT Bus. Posting Group" code

Jon Thorne
Jon Thorne
Reply

Hi,

This error occurs in the function "Add_ItemCustomer" in the NAV 2018 DW code unit:

System.ServiceModel.FaultException: The length of the string is 11, but it must be less than or equal to 10 characters.

This is because one of the codes for "VAT Bus. Posting Group" is 11 characters long. If I change it to 10 characters then it is fine. But the customer says that the NAV field is 20 characters long.

Is this a problem with another field in NAV or a problem with the implementation of the code unit?

Regards, Jon.


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Jon,
it looks like this problem is connected with the Variant/VariantId being more than allowed 10 chars length. The "VAT Bus. Posting Group" can be up to 20 chars length.
Can you check if you are using the last 1.2.0.17 NAV 2018 codeunit from the doc site and also if it is connected with the "variant" field?
BR, Dmitrij

 
Jon Thorne
Jon Thorne
Reply

Hi Dmitrij,

We are using v1.2.0.15 currently. There is no variant information in the request. The error indicates an issue with a value that I found in the "VAT Bus. Posting Group". Whan I reduced the length of this value to 10 characters it works ok. So I don't think it is related to the variant field, but perhaps another temporary field in the code? Is there somethign else with the VariantId that I am missing?

The problem occurs when I am getting a single product for live price (with or without the extra parameters it is the same result):

<GetEcomData AccessUserCustomerNumber="CUST-00123">
  <tables>
    <Products type="filter">
      <Product>
        <ProductId>AU00001</ProductId>
       </Product>
    </Products>
  </tables>
</GetEcomData>
which returns fine normally like:
<?xml version="1.0" encoding="utf-16"?>
<tables version="1.0">
  <table tableName="EcomProducts">
    <item table="EcomProducts">
      <column columnName="ProductId"><![CDATA[AU00001]]></column>
      <column columnName="ProductVariantId"><![CDATA[]]></column>
      <column columnName="ProductIdentifier"><![CDATA[]]></column>
      <column columnName="ProductNumber"><![CDATA[AU00001]]></column>
      <column columnName="ProductName"><![CDATA[Cheesepop Emmenthal 65g cup]]></column>
      <column columnName="ProductPrice"><![CDATA[3.5]]></column>
      <column columnName="ProductStock"><![CDATA[1,652]]></column>
      <column columnName="ProductCurrencyCode"><![CDATA[]]></column>
    </item>
  </table>
</tables>
 
But when I increase the length of the "VAT Bus. Posting Group" code to 11 characters it gives this error I mentioned.
"The length of the string is 11, but it must be less than or equal to 10 characters."
 
Prehaps an update to v1.2.0.17 may help. But I don't want to ask them to do that unless I know this will solve the problem.
 
Regards, Jon.
 
 
Jon Thorne
Jon Thorne
Reply

I just found this line the the code unit: 

VATBusPostingGr@1000000011 : Code[10];

I think this must be the issue.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

How do you increase the length of the "VAT Bus. Posting Group"? Is it done somewhere in the NAV table settings/NAV database?
here (in what table) do you do this?

Why do you need this change?

 
Jon Thorne
Jon Thorne
Reply

Sorry I was not clear.

I did not increase the length of the field. There is data in the code field that is 11 characres long.

So when I use a code "THIRD PARTS" in the code field (this is the customers data). It does not work.

When I change this code data to be "THIRD PART" it works.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Jon,
nice found, it is a bug in our code unit, it will be fixed in the next version. Try to change the definition of : VATBusPostingGr@1000000011 : Code[10];
to: VATBusPostingGr@1000000011 : Code[20];
BR, Dmitrij

Votes for this answer: 1
 
Jon Thorne
Jon Thorne
Reply

Hi Dmitrij,

Thanks. I have been looking for this earlier, but only just noticed it.

Thanks for the quick responses.

Regards, Jon.

 
Jon Thorne
Jon Thorne
Reply

Hi Dmitrij,

You may want to also check some other lines in the code that have arrays of [10]. I think they may also be a problem.

Regards, Jon.

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Jon,
this issue is now fixed in the NAV 2018 1.2.0.18 version.
BR, Dmitrij

 

You must be logged in to post in the forum