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

SAPScript Decmial Notation

Former Member
0 Likes
1,642

Hi,

How can i control the decimal notation of a currency field in SAPScript?? I have already set the a proper setting in user profile, but the currency still shown in different notation.

Regards,

Kit

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,313

Have a look look, may it help u.

&VAR& = 1,356.470

&VAR(.1)& = 1,356.5

&VAR(.4)& = 1,356.4700

&VAR(.0)& = 1,357

Reward if useful

Regards

ANUPAM

12 REPLIES 12
Read only

Former Member
0 Likes
1,313

Pass the Currency key also.

- Selva

Read only

0 Likes
1,313

Hi Selva,

Could you describe more about the currency key??

Regards,

Kit

Read only

0 Likes
1,313

Hi everyone,

My problem is that the number 28300 is displayed as 28.300,00. What i expect is 28,300.00.

Thanks!

Regards,

Kit

Read only

0 Likes
1,313

change the decimal notation in your Login ID's own data...

Read only

0 Likes
1,313

I had already made this changes. One more thing.. the value that show in the form is a calculation field with type KONV-KBETR.

Read only

0 Likes
1,313

Try following code.... modify according to your need

FORM f_convert_num CHANGING ch_num.

DATA : w_dcpfm LIKE usr01-dcpfm,

w_num1(30) TYPE c,

w_off TYPE i.

*FIELD_NUM = 1,233.50 OR FIELD_NUM = 1.233,50 OR FIELD_NUM = 1 233,50

****************************************

MOVE ch_num TO w_num1.

SELECT SINGLE dcpfm

FROM usr01

INTO w_dcpfm

WHERE bname EQ sy-uname.

IF sy-subrc EQ c_zero.

ENDIF.

IF w_dcpfm EQ c_checked.

REPLACE ALL OCCURRENCES OF c_comma IN: w_num1 WITH c_blank.

ELSEIF w_dcpfm EQ c_blank.

REPLACE ALL OCCURENCES OF c_dot IN: w_num1 WITH c_hash.

REPLACE ALL OCCURENCES OF c_comma IN: w_num1 WITH c_dot.

REPLACE ALL OCCURENCES OF c_hash IN: w_num1 WITH c_comma.

REPLACE ALL OCCURRENCES OF c_comma IN: w_num1 WITH c_blank.

ELSEIF w_dcpfm EQ c_yes.

TRANSLATE w_num1 USING c_commadot.

CONDENSE w_num1.

TRANSLATE w_num1 USING c_spacecomma.

FIND c_dcomma IN w_num1 MATCH OFFSET w_off.

w_off = 30 - w_off.

SHIFT w_num1 BY w_off PLACES RIGHT.

REPLACE ALL OCCURRENCES OF c_comma IN: w_num1 WITH c_blank.

ENDIF. "End of w_dcpfm check

CONDENSE w_num1.

MOVE w_num1 TO ch_num.

ENDFORM. " f_convert_num

Read only

0 Likes
1,313

Hi,

Check if t005x-xdezp has been set to 'X' for the country under consideration.

I hope this helps,

Regards

Raju Chitale

Read only

Former Member
0 Likes
1,314

Have a look look, may it help u.

&VAR& = 1,356.470

&VAR(.1)& = 1,356.5

&VAR(.4)& = 1,356.4700

&VAR(.0)& = 1,357

Reward if useful

Regards

ANUPAM

Read only

Former Member
0 Likes
1,313

Hi,

You can use the command

/: Set country 'US'

You will get , as thousand separator and . as decimal separator

If it does not meet your requirement, then change the country which meets yours.

Regards

Sailaja.

Read only

0 Likes
1,313

Hi,

Thx for your reply.

Now i can display the separator and dot correctly. But, i found that the calculation is not correct. I use two fields to compute the total and the result is not correct. They are quantity(Currency length 13 decimal 3) and price (length 11 decimal 2).

Example:

price: 283.00

quantity: 100.000

total: 28300000.00

Regards,

Kit

Read only

0 Likes
1,313

Hi,

Thx everyone. I resolved it by setting the fixed point program attribute.

Kit

Read only

0 Likes
1,313

This message was moderated.