‎2011 Oct 12 10:20 AM
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
‎2011 Oct 12 10:29 AM
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
‎2011 Oct 12 10:23 AM
does that quantity field of yours have an according field with unit of measurement assigned to it?
‎2011 Oct 12 11:18 AM
Thanks for your reply...
No field related to Unit of measurement assigned to my field
‎2011 Oct 12 10:29 AM
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
‎2011 Oct 12 10:44 AM
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.
‎2011 Oct 12 11:19 AM
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
‎2011 Oct 12 1:46 PM
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
‎2011 Oct 12 2:32 PM
Hi Suren,
what kind of instruction do you use to display the field ?
WRITE ?
is it an ALV ?
other...?