Application Development 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: 

Display Decimal point to comma: N.NNN,NN

Former Member
0 Kudos

I want to display any value in this format : N.NNN,NN WHICH SHOULD BE INDEPENDENT OF USER SETTING PARAMETERS(Decimal Notation).

This is my 3rd post regarding same...In earlier nobody clarified.

Please guide.

Thanks a million..

Edited by: Gaurav Kumawat on May 26, 2009 4:57 PM

4 REPLIES 4

former_member212002
Active Contributor
0 Kudos

Hi Gourav,

You can do this with the help of offsets.

The logic goes something like this.

Check the length of the variable.Put some conditions after which a comma will be added.

Then add a comma with the help of OFFSETS.

To replace you can use the REPLACE statement.

Hope this helps.

Regards,

Abhinab Mishra.

babu_kilari4
Active Contributor
0 Kudos

Gaurav,

I can give you a hint to achieve this.

Basically I am not sure if there is FM to achieve this. But, what you can do is take the number as input

and use MOD operation and find out how many digits are there in that. Based on the number of the digits you can use either '.' or ',' wherever you needed it.

Simply develop a function module and incorporate the logic in it and use it whenever it is needed.

Hope this helps.

Thanks,

Babu Kilari

Former Member
0 Kudos

It is possible to find the current number format by querying table USR01. DCPFM holds the relevant indicator. Null means number format is 1.234.567,89, 'X' means the format is set to 1,234,567.89, 'Y' indicates 1 234 567,89.

The logic could then be something like this:

CASE USR01-DCPFM.

WHEN 'X'.

replace ',' in num with '?'.

replace '.' in num with ','.

replace '?' in num with '.'

WHEN 'Y'.

replace space with '.' in num.

WHEN OTHER.

  • do nothing as the number will already be in the required format.

ENDCASE.

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Gaurav,

AFAIK internally SAP does not store any decimal values in N.NNN,NN format. This is during display that the number is displayed in the format as described by you.

Can you please elaborate what exactly is your problem? Or you want output to be in this format always?

Plz revert back.

BR,

Suhas