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

Fiori Currency Conversion Issue

dukejib5
Participant
0 Likes
3,630

Facing issue with currency conversion.

in JPY , decimal should be before 2 digits only to be correct as the value saved in table has 2 decimal places, but it isn't showing correctly in Fiori app.

dukejib5_0-1727848757459.png

dukejib5_1-1727848775158.png

I've following annotations in my cds view.

  //      @Semantics.currencyCode: true
  @ObjectModel.foreignKey.association: '_currency'
  waers                      as Waers,

I guess, the annotation @Semantics.currencyCode: true is the culprit, as it isn't usable anymore. what is the way around?

Any help is appreciated.

Thanks.

5 REPLIES 5
Read only

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Likes
3,594

Hi @dukejib5  Hmmm... I don't think you have understood SAP currency conversion.

JPY does not have 2 digits following the decimal place. You are correct that it is being stored with 2 decimal places - as is standard - and the displayed correctly in the localized format - i.e. WITHOUT the decimal places. As you have you shown in your screenshots. This is CORRECT as per SAP currency conversion. 

SAP currency conversion maps formats that are NOT the standard 2 digits to the appropriate localization format. That is the difference between how the data is stored and how it is interpreted.  This affects a small but significant number of currencies including JPY, KRW, VND etc. 

This blog might be helpful for you

Currency Decimal issue - JPY, KRW, VND | Localization | Rollout - Japan, Korea, Vietnam 

Read only

0 Likes
3,569

Thanks for the reply. I want to show the correct value , for $  Fiori shows 5 digits after decimal. I want to show correct value with only 2 digits after decimal.

Read only

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Likes
3,559

Have you created a custom currency code type definition in table TCURC ?  E.g. using the configuration menu in transaction SPRO. 

Manipulating decimal places on the front-end only in this way is very risky. When you change the decimal places you change the meaning of the value. That affects everywhere that value is used, e.g. when converting from local to foreign currency. 

Retail customers often use 4 decimal place currencies like this - and for that you need a custom currency code type definition. Then all the currency conversions will work reliably system wide. 

From what I understand of your approach this is really ABAP fundamentals and actually nothing to do with SAP Fiori - SAP Fiori is applying the conversion correctly (its actually just reflecting what the ABAP currency conversion is automatically doing via the CDS View) . You might want to ask your question using the ABAP tag. 

 

Read only

0 Likes
3,554

I think I am unable to clearly state my requirement. For JPY, I want to show correct value, using annotations. How to do it?  guess i'm using wrong annotation.

Value Stored JPY : 15494732.37 

Value Shown : 1549473.237

Value should be shown : 1549473237 ( if without decimal val currency).

Yes TCURC/TCURX has custom values for custom currencies. 

And again, thanks for your reply and link to blog 🙂

Read only

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Likes
3,529

Ok so I see your issue now. Thank you for the clarification!

Recommend you first double-check your custom currency code is working correctly by running report RCURTEST in GUI to check. See SAP Note 2561100 - Currency Conversion in CDS Queries - Could not determine valid conversion rate for value(s) ...

Assuming this is ok... then as explained in the ABAP CDS keyword documentation for amounts https://help.sap.com/doc/abapdocu_758_index_htm/7.58/en-US/index.htm?file=abencds_amount_field.htm yes you do need to apply the mandatory  annotation @Semantics.amount.currencyCode : true to the currency code field

I'm not sure why you think it's unusable though? It's just commented out... You should un-comment the line and reactivate the CDS View. 

That should solve it. Remember you can have multiple annotations before a field.