Decimal to alphanumeric without depending on the user

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
SET COUNTRY 'US'.                    

* 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.

And thanks to Alexis Tejeda for the photo.

Greetings from Abapinho.

Exit mobile version