Determine the Length of Data Type, Whose Internal Type is Alphanumeric

By | May 30, 2016

It’s Very obvious to declare the variables while developing any kind of application. These variables contains a value for particular field.

While declaring this variable, we have to set the length of the variable.

Two obvious way to set length and corresponding disadvantages:

  1. Check with the length of the field data type of that field.

For example, if you want to create variable ZITMREF, go to the particular data type page and search for ITEMREF field say ITV. Then check with the length say 20 and write code as

Local Char ZITMREF(20).

Disadvantage: As business requirement keeps changing, we may get the change request where we are supposed to change the data type length. Say you have changed length of ITV Data type from 20 to 30, In this case your code will get crashed as in your code file variable length was defined to 20.

  1. You can randomly set the length of the variable.

Say Local Char ZITMREF(100).

Disadvantage: In this approach you generally set the large enough length of variable which does not ensure that the code will never crash, however even if you may not face crashing it will consume the memory more than required.

Solution: Dynamically read the length of data type and then use it. Here is the Code,

Local char ZITMREF(GLONITV)

GLONITV will give you the length of data type ITV dynamically, so in future if the length of the data type gets changed, it will automatically update in your code.

You just need to add your data type code after “GLON”, and it will give you the length of that alphanumeric data type.

Length of Data Type

 

Hope this blog helps!

Sage X3 Products

Salesforce – Sage X3 Integration | Magento – Sage X3 Integration | Sage CRM-Sage X3 Integration

About Us

Greytrix is one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix have some unique solutions of Sage X3’s integration with Sage CRMSalesforce.com and Magento eCommerce. It also offers best-in-class Sage X3 customization and development services to Sage business partners, end users, and Sage PSG worldwide.

For more information on Sage X3 Integration and Services, please contact us at x3@greytrix.com .We will be glad to assist you.

Other Related Blogs: