Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regular expression

Former Member
0 Likes
325

Hello Colleagues,

My requirement is every amount field should display two decimal places.

I have an XML file and I have to parse through every tag and do it.

ex:

'<ABB>100.0</ABB>' shud become '<ABB>100.000</ABB>'

Am using the below :

REPLACE ALL OCCURRENCES OF REGEX '<ABB>(-?\d+)</ABB>' IN lv_result_file_temp

WITH '<ABB>$1.000</ABB>' IGNORING CASE. "#EC STRING_OK

But the above REGEX doesn't work. Please suggest.

Thanks,

Sri

1 REPLY 1
Read only

ThomasZloch
Active Contributor
0 Likes
265

Why are you using a Regex for this? If you want a fixed number of decimal places inside an XML file, then in ABAP I think you need to use a character type field and e.g. fill it using with WRITE ... TO ... DECIMALS ... statement.

Thomas