cancel
Showing results for 
Search instead for 
Did you mean: 

Replacing comma(,) by space as thousand separator in SAP Scripts

Former Member
0 Kudos

Hello experts,

I have a requirement of displaying currency values as '123 456 789.00' which is currently displayed as '123,456,789.00'.

I checked with country key but none value of T005X-XDEZP gives me desired result.

I want to write code within the Scripts.

Please help me in this.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try by using different dataelements or use replace keyword.

Check this.

data : i type char100.

i = '123,456,789.00'.

replace ALL OCCURRENCES OF ',' in i WITH ''.

write i.

Jshree

Former Member
0 Kudos

Hi,

Can somethings be down from within the Script.

The driver program is standard code, so i was looking for solution which i do within my ZSript.

syedashkar_rizvi
Explorer
0 Kudos

Hi Raj

No need to change your driver program or your Z script.

Just ask your BASIS admin to set the Decimal Notation to Y in the User Profile's (SU01) Defaults section.

Try this, hopefully it helps you.

Regards

Syed Ashkar

Former Member
0 Kudos

thats unfortunate, that your driver program is non-changable, but if you got a 6.0 System or higher you could think of enhancing it.

The thing proposed with the user profile could be worth a shot as well.

Former Member
0 Kudos

Hi Syed,

I think decimal notation 'Y' wont help.

I found the domain 'XUDCPFM' which defines decimal notation, in that value 'Y' will give be below output

'123 456 789,00'

i.e decimal point will be replaced by comma(,)

syedashkar_rizvi
Explorer
0 Kudos

Dear Fellow

I am afraid to tell you that your specific format '123 456 789.00' is typical to get with in SAP SCRIPT but you can achive the format '123456789.00' modifying your SCRIPT. Upper format will require more complex logic in SCRIPT.

if you are okie with it then try the STEPS

1)Insert few lines with symbol /: Command Line in SCRIPT.

2)copy below code to each line.

DATA : temp TYPE STRING.

temp = '123,456,789.00'. " or your variable to print.

REPLACE ALL OCCURRENCES OF ',' IN temp WITH ' '.

3) now temp has the format to print on form. in place of your variable place temp in the layout.

I hope now this will work.

Regards

Syed Ashkar

Former Member
0 Kudos

Do this in your driver program.

create a global variable of type char20, that should be enough, if not consider a char30.

Then use the WRITE TO statement with the addition "WITH EDIT MASK" to write your value into that new charfield you created.

Finally in script print that charfield instead of your valuefield.

When working with the WRITE TO statement, also consider working with the CURRENCY addition instead of WITH EDIT MASK.

If you dont need spaces instead of commas, but commas just removed, then do following in script:

&YOUR_VARIABLE(T)&

that should stop him from printing thousand seperators. But he wont do spaces instead, just dont print the seperators.

Edited by: Florian Kemmer on Oct 12, 2011 10:18 AM