Search code examples
s4sdk

S/4HANA Cloud SDK :com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces does not exist


The build is fails due to lack of resource: class com.sap.cloud.sdk.s4hana.datamodel.odata.services.BusinessPartnerService

Do we need to have/create this model classes in our project structure or will SDK take care of this static import?

Error after executing: mvn clean install


Solution

  • There are likely several things happening in parallel here:

    • Version 1.3.0 of the SAP S/4HANA Cloud SDK moved the entity classes of a service such as BusinessPartner to their own package, in your case, you now need to import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.BusinessPartner;.
    • Furthermore, BusinessPartnerService is now an interface with a default implementation available with DefaultBusinessPartnerService. You need to replace the static access with new DefaultBusinessPartnerService() (or you could use dependency injection). See the release-notes that Akhil already referenced.
    • There is no email field on the entity BusinessPartner. You need to use the entity AddressEmailAddress and associate it to the business partner via a BusinessPartnerAddress.