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

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Error - The length of the string is 15 , but it must be less than or equal to 10

(0) ShareShare
ReportReport
Posted on by 3,099

Hi

  I am getting the above error in below code

IF "Detailed GST Ledger Entry"."Gen. Bus. Posting Group" = '' THEN BEGIN
  IF recLocation.GET("Detailed GST Ledger Entry"."Buyer/Seller Reg. No.") THEN
   CName := recLocation.Code;
END;


Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,967 Super User 2025 Season 2 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    What is the length of variable CName?

    If it is 10 then increase to equal the length of location code.

  • Suggested answer
    Marcellus Profile Picture
    2,735 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    Hi Jsshivalik,

    I think your problem is with the recLocation.GET because the application is expecting a maximum 10 characters long Location Code and the Detailed GST Ledger Entry"."Buyer/Seller Reg. No." is 15 characters long.

    Are you sure this code is going to get you a location?

    Check this msdn article about GET: msdn.microsoft.com/.../dd301056(v=nav.90).aspx it's expecting values stored in the primary key fields.

    Also you should turn on the debugger and execute your code, it will help you pinpoint the problem.

  • mmv Profile Picture
    11,471 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    The recLocation.GET uses the Primary Key of the Location table, which is 10 characters in length.  Your "Detailed GST Ledger Entry"."Buyer/Seller Reg. No." is more than 10 characters, so it's causing the error.

    As mentioned by Marcell, do you think "Buyer/Seller Reg. No." stores the Location Code?

  • Verified answer
    Amol Salvi Profile Picture
    18,698 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    You need to write following code for getting location name. You are passing the wrong field.

    IF "Detailed GST Ledger Entry"."Gen. Bus. Posting Group" = '' THEN BEGIN

     IF recLocation.GET("Detailed GST Ledger Entry"."Location Code") THEN

      CName := recLocation.Code;

    END;

  • mmv Profile Picture
    11,471 on at
    RE: Error - The length of the string is 15 , but it must be less than or equal to 10

    Has this query got any relation with your recent post of "Buyer Seller State Code in Detailed GST Ledger Entry"?

    If so, please use the same thread, instead of multiple questions on the same.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans