0

My requirement is to create BP's using SAP side-by-side extension via custom mass excel upload UI5 application. I am using SAP Cloud SDK and Web IDE MTA for this.

When I check on SAP API hub, the code suggestion in JAVA uses the URL of the odata service (API_BUSINESS_PARTNER). I want to understand, if this the correct/recommended way in building a side-by-side extension? or shall I use the standard stub BusinessPartner available from the SDK?

If I have to use this standard stub for mass upload, kindly guide me through the sample code/documentation (I have managed to insert single BP using the UI5 application).

Best Regards,

Nikhil

2 Answers2

0

I assume, you've looked into the Business Partner OData service documentation on the SAP API Business Hub. The code suggestion in Java shows a very basic example on how to consume the endpoint data. There are hard-coded URLs, query parameters and header information. Of course you could continue with this sample code but custom implementation can become error prone and incomplete. This is why we from SAP Cloud SDK team recommend our library to consume the OData service.

The Cloud SDK uses the very same Business Hub information to prepare the OData queries. For example, if you look into the BusinessPartnerService interface, you will find the DEFAULT_SERVICE_PATH property which matches the path as given by the Business Hub. The provided set of service and model classes make up our VDM (Virtual Data Model). It contains prepared statements for type-safe OData operations. It's the recommended way to build a side-by-side extensions. It's fully compatible with the SAP API Business Hub.

If you have any specific questions, please let me know.

Alexander Dümont
  • 903
  • 1
  • 5
  • 9
  • Hi Alexander, Thanks a lot for clarifying. One last request, can you redirect me to the recommended batch operation using SAP Cloud SDK? I have achieved using following approach: From UI5, i took all the entries in a BufferReader and push these records in **`BusinessPartner.builder()`** inside a loop. Is this a correct way of pushing batch records? or is there any other efficient way of handling this? Best Regrds,Nikhil – nikhil joshi Dec 03 '19 at 04:45
  • Next time please create a new stack overflow question to improve readability. Have a look at the helper class `com.sap.cloud.sdk.s4hana.datamodel.odata.helper.VdmEntityUtil`. We use it internally to deserialize an entity from a Map of properties. This is the usage: `BusinessPartner instance = new VdmEntityUtil<>(BusinessPartner.class).fromFields( Map properties );` – Alexander Dümont Dec 04 '19 at 10:47
0

To add to this: you can use the BatchRequestBuilder quite successfully for the purpose of bundling multiple OData requests in one batch to be sent to S/4, which makes such a mass upload more efficient. This is also part of the SAP Cloud SDK. You then still use the same generated VDM helper classes, but instead of directly executing the helpers, you can call the toQuery() method, which returns request objects which can be bundled into change sets with the ChangeSetBuilder, to be then again added to above mentioned BatchRequestBuilder.

Tim L.
  • 224
  • 2
  • 11