cancel
Showing results for 
Search instead for 
Did you mean: 

Set Number/ Amount Format in SAPSCRIPT

Former Member
0 Kudos

Hi All,

How do you set the amount format to 111,111,111.00 in sapscript?

Is there a command like set date mask for this?

Thanks.

Tyken

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

This format setting is done in user profile: SU01 - Defaults tab.

In the scripts if you want to do that explicitly you can use the command: /: SET COUNTRY 'SG' . (Or any country code you want to use).

Hope this helps.

Regards,

Narendra.

Reward if helpful!!

Former Member
0 Kudos

Hi,

we want to make the amount format standard for all users so we need to do this in the code.

how do we do it?

tyken

Former Member
0 Kudos

Hi,

Then you can use the SET COUNTRY command.

Or you can do it manually in a subroutine as well.

Regards,

Narendra.

Former Member
0 Kudos

Hi,

How do I do it in subroutine?

Thanks.

Tyken

Former Member
0 Kudos

Hi,

Pass the value to your subroutine, and then chk out for the thousand separator. If it is in the correct format itz fine just pass it back to the script.

Else need to split it and then modify and then pass it back.

By correct format I mean sometimes you get values like 1.234,00 instead of 1,234.00 . So chk out what is there in the 3rd from last place and if you have , instead of . you need to split your variable at , to say var1 and var2.

Now replace . in var1 with , and then concatenate . to var2.

now concatenate var1 and var2 and then write this variable to another variable of currency format.

Now pass it back to the scripts.

Just a suggestion: prior to doing any changes just try doing this:

set country ' ' in your scripts. Chk out. Else, chk out by using set country 'SG' (or 'IN'). Else do it manually as said above.

Hope helps you..

Regards,

Narendra.

Reward if helpful!!

Former Member
0 Kudos

Hi,

can you change your driver program? if so , write the code lines as below.

let us suppose your amount field has length 19 (output length: for this see the domain ) then declare a field of caracter type.

data: v_amount(19) type c, "Total length

v_amt(15) type c, "Length before decimal

v_deci(3) type c. "lenght after decimal

let us say your field is v_netpr

v_amount = v_netpr.

split v_amount at ',' into v_amt v_deci.

replace all occurances of '.' with ',' in v_amt.

clear v_amount .

concatenate v_amt '.' v_deci into v_amount.

now you can use this variable to print in the form.

if you cant change the driver program then the same logic you can use.

if you want to know how to writge the subroutines in the form then search for subroutines, you will get lot many results.

Reward pointgs if useful.

Regards,

Nageswar

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

as told it is better to make these setting in user profile , DEFAULT tab.