Skip to Content
1
Dec 16, 2021 at 11:44 AM

Missformated amounts in excel exports of oData-V4 Fiori Apps

402 Views Last edit Jan 20 at 10:58 AM 8 rev

Hello Community,

I am currently struggling with an issue that seems to affect all Fiori Elements apps that use the V4-oData model. When I assign a currency field to an amount there via annotation, the currency is written to a cell with the amount (as a string) during Excel export. Further processing in Excel is then not directly possible. In addition, the language setting is also ignored, the amounts are always delivered with "." as a comma separator.

With V2 apps, on the other hand, only the amount is written to the cell, the currency is then displayed via the formatting options. Further processing is possible without any problems. In addition, a "," is used here as a comma separator (correct).

Here is the output with the V2 app:

excel-export-with-v2-version.png

And here the output of the V4 app:

excel-export-with-v4-version.png

DB schema:

aspect CommonCostsModel : managed, cuid {
    ...
    @Semantics.currencyCode
    currency       : Currency                    @title : '{i18n>Currency}';
    ...
}
entity Test : CommonCostsModel {
    ...
    @Semantics.amount.currencyCode :                                    'currency'
    netCost          : Decimal(15, 7)              @title :             '{i18n>NetCost}';
    ...
}

Annotations CDS of the application:

annotate service.Test with {
    ...
    netCost                 @(Measures.ISOCurrency : currency_code);
    ...

}<br>

Do I need some other annotations for the V4 variant of the oData service? I could not find anything in the documentation regarding this.

UPDATE 2021-12-22:

The application was developed with SAPUI5 version 1.87.9. This version is no longer LTS, so I have now updated the version to 1.96.2 or 1.97.0. Unfortunately, the problem has even worsened with both newer versions. Now, in addition to the wrong format, an error message appears when opening the xlsx file:

"We have detected a problem with some content in 'XXX.xlsx'. Should we restore as much as possible? If you trust this workbook, click 'Yes'."

Now when I click Yes, the Excel looks like it did before, but still with the formatting problem.

-----------------------------

UPDATE 2022-01-20:

I've debugged into the ExportBase class to find the column settings for the Excel Export. I've done this for the V2 and the V4 app to find any difference. Furthermore I've compared the oData metadata file and also the values from the response.

Column settings | UI5 1.87.9 | oData V2 (working)

columnsettings-1879-odatav2.png

Column settings | UI5 1.87.9 | oData V4 (wrong format in xlsx file)

columnsettings-1879-odatav4.png

Metadata | oData V2

metadata-1879-odatav2.png

Metadata | oData V4

metadata-1879-odatav4.png

oData Response | oData V2

odataresponse-1879-odatav2.png

oData Response | oData V4

odataresponse-1879-odatav4.png

-----------------------------

Thank you very much in advance!

Best Regads,

Mark