Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Currency CURR type with more than 2 decimals - ALV output

$
0
0

I just realized how to use CURR type with more than 2 decimals.

 

I created a DOMAIN with Data Type CURR and 8 decimal places. Look at what happens at SE16N Details:

Capture.PNG


Value on right (Value Unconverted) is the real values on table with 8 decimals, and values on LEFT are showing on any ALV Output (SE16, SE16N or any ALV report). There is NO Conversion Routine at the Domain, only standard CURR type.

 

 

I could set DECIMALS on SALV using CL_SALV_COLUMN->SET_DECIMALS( '8' ), but it will only add ZEROS

 

Ex for first line in table, TOTFRDOC will show 11,006,361.60000000 instead of 11.00636160.

 

 

 

Yes, you may use CURR type with more than 2 decimals, knowing that this output conversion will happens.


So when use it?? If you want your CURR value converted to percentage (as a rate) usually using 4 decimals. Example:


Value unconverted: 0.6160

Output will show as percentage 61.60


Out of curiosity...

there are 57 standard domains type CURR with more than 2 decimals in my SAP system, 109 standard tables using that without any conversion...but most of them are rates with 4 decimals, so when converting to 2 decimals it shows value multiplied by 100, as in the example above.


I could fix my domain using DataType DEC instead. My ALV outputs are now showing right values with 8 decimals.


Viewing all articles
Browse latest Browse all 943

Trending Articles