When writing code for Sage X3, alphanumeric variables must be declared with a size, otherwise the number of characters will be defaulted to 30; causing unexpected behavior, specially when a bigger variable is required.
One of the many benefits of using Sage X3 is that it is extremely configurable. Users with the appropriate rights can manually change the length. No need to go in the lines of code to change some parameters like the size of a data type. You can successfully increase the number of the decimal places in the price screens for example without having to touch the logic.
For example, the supplier data type BPS is 15 characters in length
When a variable is required for a supplier, the variable could be declared like this:
Local Char YBPSNUM(15) #Supplier
The product data type ITM is 20 characters in length:
When a variable is required for a product, the variable could be declared like this:
Local Char YITMREF(20) #Product
In the examples above, the code will not work properly if any of those data types is changed to a bigger number of characters, a scenario that we have encountered with some of our clients.
Imagine wanting to increase the number of characters authorized for the length of the product code. A modification seemingly innocent, that would nonetheless require to review ALL the places in the code where the length of the product code was declared as above. Every single screen and reports would need to be reviewed and tested.
The solution to the problem described above is to use GLON variables.
These variables have this format: GLONXYZ, where XYZ indicates the related data type (it will only work if the data type is the main key to the object).
GLON variables are available for any object defined in the system.
Below we can see the proper way of defining the variables in the code, so any change in the data type length is accounted for.
Talk to Us About Sage Software Support