0

When coding with samples provided by S/4HANA Cloud SDK. It taught me to use BusinessPartnerService provided within package com.sap.cloud.sdk.s4hana.datamodel.odata.services to simplify OData operation.

See codes below. It imports two services from com.sap.cloud.sdk.s4hana.datamodel.odata.services. And it magically use them to operate OData services.

import com.sap.cloud.sdk.s4hana.datamodel.odata.services.BusinessPartnerService;
import com.sap.cloud.sdk.s4hana.datamodel.odata.services.DefaultBusinessPartnerService;

@WebServlet("/api/addresses")
public class AddressServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private static final Logger logger = CloudLoggerFactory.getLogger(AddressServlet.class);

    private final BusinessPartnerService service = new DefaultBusinessPartnerService();
    ......
}

My question is when in the real application development, I should use services other than BusinessPartner. How do my service be generated and exposed like the BusinessPartnerService?

Thanks.

aicro
  • 11
  • 6
  • Did that answer your question? If so please mark the answer as accepted so that others can see it as well. – MatKuhr Mar 18 '20 at 14:19

1 Answers1

0

For S4 Hana Cloud these services come pre-generated with the SDK and you can consume them just like the business partner services.

In case you have a different service we offer a generator that you can use to generate these services from EDMX service despriptions. Take a look at this blog post which describes how to do that.

MatKuhr
  • 505
  • 4
  • 13