如何修复 oData VDM 生成器错误“尝试两次创建相同的字段”?

How to fix oData VDM generator error «trying to create the same field twice»?

我使用 SAP Cloud SDK 2.19.1 和 odata-generator-maven-plugin:2.19.1。 当我尝试通过 oData 服务 /sap/opu/odata/sap/API_PRODUCT_SRV 的元数据文件生成 VDM 时,我在执行命令 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]

我使用在地址 /sap/opu/odata/sap/API_PRODUCT_SRV/$metadata 获得的元数据文件,但它包含俄语文本。例如,在 sap-annotations:

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

当我在检索元数据文件时指定语言环境时 ($metadata?sap-language=EN),可以生成 VDM。 但是是否可以在没有特殊指令 sap-language 的情况下通过元数据文件生成正确的 VDM?

谢谢!

对于生成的代码,语言环境并不重要。因此,我们建议您明确使用英语语言环境来检索元数据。

SAP Cloud SDK 教程隐含假定您系统的默认语言环境是英语。