Supported by
Supported by Inetum

Decimal to alphanumeric without depending on the user

images/thumbnail.jpg - Thumbnail

When reading a file with numeric values to an internal table or vice versa, the success of the conversion depends on whether the user has defined the dot or comma as the decimal separator. It is customary to then go and read the user setting and then adjust the values from the file with a dot or a comma as required.

But this is unfortunate and rather inelegant. There should be a way of not making this depend on the user.

And there is.

This is how:

* Let us force the USA default format

* Now we do what we have to do
WRITE wrbtr TO value CURRENCY 'USD'.

* And at the end we set it to the defined format for the current user

Much simpler than having to read the user setting, don’t you think?

Thanks Pierre Ameye for the tip.

Greetings from Abapinho.