sapmentors / cap-community

SAP CAP Community
MIT License
97 stars 26 forks source link

Adding SAP Business One EDMX File causes [ERROR] Dubious entity or type without non-virtual elements #59

Open gregorwolf opened 4 years ago

gregorwolf commented 4 years ago

Hello CAP Team,

I'm trying to build a CAP layer on top of the SAP Business One OData API's). To try that out I've created a new CAP project and used the new cool functionality of Integrate and Mashup with cds watch. But unfortunately the drag & drop of the SAP Business One EDMX File (Orders) causes this issue:

[ERROR] srv/external/Orders.csn:28747: Dubious entity or type without non-virtual elements [ERROR] srv/external/Orders.csn:30632: Dubious entity or type without non-virtual elements [ERROR] srv/external/Orders.csn:35798: Dubious entity or type without non-virtual elements [ERROR] srv/external/Orders.csn:37793: Dubious entity or type without non-virtual elements

This are the elements in order of occurence:

"SAPB1.RclRecurringExecutionParams": {
  "kind": "type",
  "elements": {}
},

"SAPB1.AlertManagementDocument": {
  "kind": "type",
  "elements": {}
},

"SAPB1.MaterialRevaluationFIFO": {
  "kind": "type",
  "elements": {}
},

"SAPB1.ApprovalTemplateDocument": {
  "kind": "type",
  "elements": {}
},

The question is now is that an issue with the cds EDMX to CSN converter or an issue with the EDMX file itself. To make this error easy to reproduce I've created the repository sap-business-one-odata-cap.

Looking forward for your input.

CU Gregor

gregorwolf commented 4 years ago

First response was posted to the question in the SAP Community: Adding SAP Business One EDMX file to CAP project causes an error

danjoa commented 4 years ago

Hi Gregor, I recently looked at it but found that you updated the models?

For the original models (Order.csn) that would have helped to simply exclude those entities containing SQL keywords from automatic mocking:

// Excluding entities with SQL keywords from mocks
annotate SAPB1.AssetDepreciationGroups with @cds.persistence:{mock:false};
annotate SAPB1.FormattedSearches with @cds.persistence:{mock:false};
annotate SAPB1.FormPreferences with @cds.persistence:{mock:false};
annotate SAPB1.Resources with @cds.persistence:{mock:false};
annotate SAPB1.Users with @cds.persistence:{mock:false};
annotate SAPB1.ResourceCapacities with @cds.persistence:{mock:false};
annotate SAPB1.UserKeysMD with @cds.persistence:{mock:false};
gregorwolf commented 4 years ago

Hi Daniel,

I've reverted the EDMX and the generated CSN file to the original in the master branch and included your suggestions to the file srv/SAPB1.cds. But the error message is still the same:

[ERROR] srv/external/SAPB1.csn:28747: Dubious type without non-virtual elements [ERROR] srv/external/SAPB1.csn:30632: Dubious type without non-virtual elements [ERROR] srv/external/SAPB1.csn:35798: Dubious type without non-virtual elements [ERROR] srv/external/SAPB1.csn:37793: Dubious type without non-virtual elements

Hope we can get this and the other issues I face with the SAP Business One OData Service fixed.

Best regards Gregor

danjoa commented 4 years ago

Hi Gregor, yes that's the other error, irrelated to the SQL keywords issue, which has to be fixed by the compiler relaxing on entity definitions without elements (as indicated by Christoph in here). When I fixed the keywords issue in your project as depicted above, I also got stuck in that one.