4

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

Junjie Tang
  • 362
  • 1
  • 15
Kandarp P
  • 43
  • 3
  • 1
    Looks to me like a dependency is missing. Can you describe what you did? Did you use the Maven achetype provided by the SDK? – Florian Wilhelm Nov 16 '17 at 08:24
  • 1
    Which version of the SDK are you using? GroupId `com.sap.cloud.s4hana` and artifactId `sdk-bom`. – Florian Wilhelm Nov 16 '17 at 08:37
  • 1
    Hi Florian, I am using 1.3.0 com.sap.cloud.s4hana sdk-bom 1.3.0 pom import – Kandarp P Nov 16 '17 at 10:41
  • 2
    I could reproduce your problem with version 1.2.0, with 1.3.0 it should be resolved, see the answer from Akhil. And if this solves your problem, please don't forget to "accept" the answer by clicking the checkmark on the left side. – Florian Wilhelm Nov 16 '17 at 10:44

2 Answers2

1

Please use the latest SDK release in your project. Info here: https://sap.github.io/cloud-s4-sdk-examples/release-notes/

This should resolve the error.

Best regards, Akhil

1

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.
  • 2
    Thanks Henning. | it worked and i am able to get the list of Business Partner from S/4HANA Cloud 1708. Below Parent POM link helped to understand the issue. https://sap.github.io/cloud-s4-sdk-examples/docs/1.3.0/javadoc-api/com/sap/cloud/sdk/s4hana/datamodel/odata/namespaces/businesspartner/class-use/BusinessPartner.html #s4sdk – Kandarp P Nov 16 '17 at 23:06