05-26-2009 3:57 PM
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
05-26-2009 4:05 PM
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.
05-26-2009 4:05 PM
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
05-26-2009 4:17 PM
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.
05-26-2009 4:32 PM
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