Skip to Content
0
May 10, 2019 at 09:25 AM

S/4 HANA Cloud SDK JavaScript Code

4578 Views

Hi Dennis,

Thought of starting a new thread here for this discussion on JavaScript Code.

My Complete Code is as follows -

const express = require("express");

const BusinessPartners = require("@sap/cloud-sdk-vdm-business-partner-service");

exports.businessPartners = function(req, res) {

getAllBusinessPartners() .

then(businessPartners => { res.status(200).send(businessPartners); })

.catch(error => { res.status(500).send(error.message);

});;

}

function getAllBusinessPartners() {

return BusinessPartner.requestBuilder()

.getAll()

.withCustomHeaders({ 'APIKey': 'mcJX5Yp6iMh3jXlGbDt17vNzyWgARQ1E' }) .select(BusinessPartner.FIRST_NAME, BusinessPartner.LAST_NAME) .filter(BusinessPartner.FIRST_NAME.equals("John"))

.top(5)

.skip(0)

.execute({ destinationName: 'SAPS4HANASandBox' });

}

Please let me know if there any corrections to be made here ?

Thanks,

Mahesh Z.