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

regarding Decimal notation

Former Member
0 Likes
1,765

Hi,

I'm facing an issue in displaying an Quantity field in the report output. I declared a field of type MENGE_D (quantity field) and in debugging i can see the value say 125.000, but when i executed the report, the field value is changing from 125.000 to 125,000 !!!!!

Even i cross-checked by maintaining User profile -> Own data, but of no use, Please provide me your valuable inputs

TIA

Suren

1 ACCEPTED SOLUTION
Read only

ChandrashekharMahajan
Active Contributor
0 Likes
1,350

Hi,

you can use below code to covert it properly.

CALL FUNCTION 'SUSR_USER_DEFAULTS_GET'

EXPORTING

user_name = sy-uname

IMPORTING

user_defaults = ls_user02

EXCEPTIONS

user_name_not_exist = 1

OTHERS = 2.

IF sy-subrc <> 0.

EXIT.

ENDIF.

CASE ls_user02-dcpfm.

WHEN 'X'.

REPLACE ',' IN Z_MENGE WITH ''.

WHEN 'Y'.

REPLACE ',' IN Z_MENGE WITH '.'.

WHEN OTHERS.

REPLACE '.' IN Z_MENGE WITH ''.

REPLACE ',' IN Z_MENGE WITH '.'.

ENDCASE.

ENDIF.

I hope this will resolve your issue.

Thanks,

Chandra

7 REPLIES 7
Read only

Former Member
0 Likes
1,350

does that quantity field of yours have an according field with unit of measurement assigned to it?

Read only

0 Likes
1,350

Thanks for your reply...

No field related to Unit of measurement assigned to my field

Read only

ChandrashekharMahajan
Active Contributor
0 Likes
1,351

Hi,

you can use below code to covert it properly.

CALL FUNCTION 'SUSR_USER_DEFAULTS_GET'

EXPORTING

user_name = sy-uname

IMPORTING

user_defaults = ls_user02

EXCEPTIONS

user_name_not_exist = 1

OTHERS = 2.

IF sy-subrc <> 0.

EXIT.

ENDIF.

CASE ls_user02-dcpfm.

WHEN 'X'.

REPLACE ',' IN Z_MENGE WITH ''.

WHEN 'Y'.

REPLACE ',' IN Z_MENGE WITH '.'.

WHEN OTHERS.

REPLACE '.' IN Z_MENGE WITH ''.

REPLACE ',' IN Z_MENGE WITH '.'.

ENDCASE.

ENDIF.

I hope this will resolve your issue.

Thanks,

Chandra

Read only

Former Member
0 Likes
1,350

Hi,

Check the defaults maintained in the user profile in SU01-> Under Defaults Tab -> Decimal Notation ?. This is the notation you are getting in the output. Change it according to your need, log off the system and relogin for the changes to take effect and run the report. To do it dynamically do as commented (usage of FM SUSR_USER_DEFAULTS_GET) above in the program.

Read only

0 Likes
1,350

Hi,

Your default settings of decimal notation is ','.

Debugger doesn't refer this default setting of user and so you see '125.000'.

If you prefer to see as debugger,go and change manually in tcode : SU01

give your username and enter in edit mode.Then goto tab 'Fixed Values'

and change the decimal representation as how you prefer.

regards

Read only

0 Likes
1,350

this will work fine at your user level. for users with different decimal settings, you need to put the code that i mentioed earlier.

Thanks,

Chandra

Read only

Former Member
0 Likes
1,350

Hi Suren,

what kind of instruction do you use to display the field ?

WRITE ?

is it an ALV ?

other...?