on 03-05-2021 9:59 AM
Hello CAP Team,
when creating a side-by-side extension for SAP S/4HANA we consume quite some OData APIs. As the side-by-side extension in most cases should keep the same terminology I would think that it should be possible to reuse the translations that are already available in the Backend also in the CAP project.
Here is an example with the API for Sales Organization. When I request the OData Metadata for this API in English with the following path:
/sap/opu/odata/sap/API_SALESORGANIZATION_SRV/$metadata?sap-language=en
I get i.e. the SalesOrganization property with sap:label "Sales Organization":
<PropertyName="SalesOrganization"Type="Edm.String"Nullable="false"MaxLength="4"sap:display-format="UpperCase"sap:label="Sales Organization"/>
When I do the same request for German with:
/sap/opu/odata/sap/API_SALESORGANIZATION_SRV/$metadata?sap-language=de
I get i.e. the SalesOrganization property with sap:label "Verkaufsorganisation":
<Property Name="SalesOrganization" Type="Edm.String" Nullable="false" MaxLength="4" sap:display-format="UpperCase" sap:label="Verkaufsorganisation"/>
So the needed information for Internationalization (i18n) would be already available. So my expectation would be to re-use an external definition in my own entities:
using { API_SALESORGANIZATION_SRV as externalSalesOrganization } from './external/API_SALESORGANIZATION_SRV';
entity SalesArea : cuid, managed {
SalesOrganization: externalSalesOrganization.A_SalesOrganization : SalesOrganization;
}
And that should cause the resulting Metadata to be populated with the labels based on the available information from the backend.
Best regards
Gregor
Hi gregorw,
Thanks for the suggestion, we'll look into it. However, as this is basically static content, I'm not sure doing this on a metadata request is the way to go.
Best,
Sebastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sebastian,
maybe an option would be to retrieve the EDMX files in the different languages when running
cds import --i18n
and following the approach for Resolving localized texts via views define the following in the cds block of package.json:
"i18n": { "fromExternal": ["en", ...] }
another option might be to add it to the credentials section of the service:
"ZPDCDS_SRV": {
"kind": "odata",
"model": "srv/external/ZPDCDS_SRV",
"credentials": {
"destination": "ES5",
"requestTimeout": 30000,
"path": "/sap/opu/odata/sap/ZPDCDS_SRV",
"i18n": ["en", "de"]
}
}
As a result srv/external/_i18n should be filled with the labels from the Metadata file. The i18n files should be used in the csn file.
Best regards
Gregor
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.