cancel
Showing results for 
Search instead for 
Did you mean: 

Reuse of S/4HANA Backend Translations in CAP

gregorw
Active Contributor

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

iwona_hahn
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Gregor,

I have forwarded the question to the dev colleagues and will get back asap.

Best regards,
Iwona

Accepted Solutions (0)

Answers (1)

Answers (1)

vansyckel
Advisor
Advisor
0 Kudos

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

gregorw
Active Contributor
0 Kudos

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

gregorw
Active Contributor
0 Kudos

Hi vansyckel and daniel.hutzel,

do you have any feedback to my suggestion?

Best regards
Gregor

vansyckel
Advisor
Advisor
0 Kudos

Hi gregorw

We added your suggestion to our Service Consumption workstream backlog, but there is no timeline yet.

Best,
Sebastian

gregorw
Active Contributor
0 Kudos

Good to hear. Thank you.