0

I use SAP Cloud SDK 2.19.1 and odata-generator-maven-plugin:2.19.1. When I try to generate VDM by metadata-file from oData service /sap/opu/odata/sap/API_PRODUCT_SRV I get an error during the execution of a command mvn clean install:

Error: URI=file:/D:/opensap/firstapp/application/edmx/ApiProductSrv.edmx Line=1: Document root element "edmx:Edmx", must match DOCTYPE root "null".
Error: URI=file:/D:/opensap/firstapp/application/edmx/ApiProductSrv.edmx Line=1: Document is invalid: no grammar found.
…
[ERROR] Failed to execute goal com.sap.cloud.s4hana.datamodel:odata-generator-maven-plugin:2.19.1:generate (generate-consumption) on project firstapp-application: Execution generate-consumption of goal com.sap.cloud.s4hana.datamodel:odata-generator-maven-plugin:2.1
9.1:generate failed: trying to create the same field twice: Продукт -> [Help 1]

I use the metadata-file obtained at the address /sap/opu/odata/sap/API_PRODUCT_SRV/$metadata, but it contains Russian-language text. For example, in sap-annotations:

<Property Name="Product" Type="Edm.String" Nullable="false" MaxLength="40" sap:display-format="UpperCase" sap:label="Продукт" sap:quickinfo="Номер продукта"/>

When I specify the locale when retrieving the metadata file ($metadata?sap-language=EN), it is possible to generate VDM. But is it possible to generate correct VDM by metadata-file without special instructions sap-language?

Thanks!

  • I guess your default locale in SAP S/4HANA is Russian, so it does return the Russian variant of the metadata document. Is this correct? – Emdee Jul 24 '19 at 05:48
  • Yes, it's correct - default system locale is Russian. Russian text is in the sap annotations, such as sap:quickinfo or sap:label (that illustrated in the second snippet). – Andrey Zhuravel Jul 24 '19 at 07:31
  • Where did you get the metadata file from? S/4HANA (if yes, which version?) or from the API Hub? – Emdee Jul 24 '19 at 11:39
  • Can you kindly provide us the metadata file? – Emdee Jul 24 '19 at 11:44
  • S4HANA ON PREMISE 1809 02 FP. It's a standard service `/sap/opu/odata/sap/API_PRODUCT_SRV/$metadata`. Probably, you need to add `?sap-language=RU` – Andrey Zhuravel Jul 24 '19 at 12:21
  • File is very big for code snippet. Can I send it for your mail? – Andrey Zhuravel Jul 24 '19 at 12:31
  • OK I retrieved the file on my system. Will look into it and come back to you. No need to send it. – Emdee Jul 24 '19 at 13:03
  • I can reproduce the issue on my system. – Emdee Jul 25 '19 at 08:48
  • We assume this error happens due to the locale. Are you sure that you really want to use the Russian metadata variant to generate your VDM code? What advantage do you gain compared to using the English metadata? – Emdee Jul 26 '19 at 11:56
  • I based on tutorials that talk about `$metadata` without additional `sap-language` instructions. Thus, I have no information that the use of the `$metadata?sap-language=EN` is correct way to generate VDM and next work with the Russian-language localization of the service. Is it correct way? – Andrey Zhuravel Jul 26 '19 at 15:01

1 Answers1

0

For the generated code the locale does not really matter. Therefore, we suggest you use explicitly the English locale to retrieve the metadata.

The tutorial of the SAP Cloud SDK implicitly assume that the default locale of your system is English.

Emdee
  • 1,689
  • 5
  • 22
  • 35