Search code examples
s4sdksap-cloud-sdk

Cannot create Virtual Data Model classes using Cloud SDK


I am trying to create VDMs using EDMX from SFSF, using this blog

I create a SCP Business Application template and then from in the srv module I try to add new data model from external source - in this case API Business Hub. I try to use SuccessFactors Employee Central - Personal Information. https://api.sap.com/api/ECPersonalInformation/overview

The process starts and fails with the message: "OData models with multiple schemas are not supported" and then "Could not generate Virtual Data Model classes."

The external folder is generated as expected with the XML in the EDMX folder but the csn folder is empty.

As I understand it this should work with any api from the business hub? Am I doing something wrong or am I missing something?

Thanks.


Solution

  • Update:

    There seems to be an issue with the conversion from EDMX into CSN used by the Web IDE (which is not part of the SAP Cloud SDK).

    The Java VDM generated by the OData Generator from the SAP Cloud SDK (used as a component by the Web IDE) should work without any problem.


    This looks like an unexpected behavior. We will investigate this further.

    In the meantime, as a workaround, you can use our maven plugin or CLI to create the data model for you. This is described in detail in this blog post.

    The tl;dr version (for the CLI) is:

    1. Determine which version of the SAP Cloud SDK you are using (search for sdk-bom in your parent pom.xml). I assume this to be version 2.16.0 for this example.
    2. Download the CLI library from maven central: https://search.maven.org/artifact/com.sap.cloud.s4hana.datamodel/odata-generator-cli/2.16.0/jar
    3. Download the metadata file (edmx) from the API Business Hub (as linked in your question)
    4. Run the CLI with e.g. the following command:
      java -jar odata-generator-cli-2.16.0.jar -i <input-directory> -o <output-directory> -b <base-path>
      
      The <base-path> in there is the prefix (service independent) to be used in between your host configuration and the actual service name.
    5. Add the generated code manually to your project.

    I will updates this answer with the results of the investigation.