Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
mohit_bansal3
Active Participant
3,483
This is the final blog of my Blog series "Architecting Complex Real Life Business Scenario on SAP BTP with ease [ Targeting Multiple backend S/4HANA Systems utilizing Principal Propagation ]". We have discussed so far

  1. Business Requirement in detail and understanding of the Landscape

  2. Technical Architecture & Component Detail


In this blog, We will discussing about complete set up and Technical Building blocks so far with the Cloud Application Programming Model.

Configurations & System Set Up Principal Propagation: handshaking with BTP with S4HANA for Logged in User

Identity Propagation

Apart from the common setup which we have discussed in my last blog, most important stuff is the correctly set up for the Principal Propagation.

Principal Propagation works like a charm to pass the identity of "Logged In User".

Authorization Control at Backend

Thanks to ABAP CDS with  Backend API with strong Access control have saved life to control the backend authorization to S4HANA Backend.

Once the Cloud Connector and PP configuration done by administrator , Please create the destinations for each S4HANA system , say A, B..N


Principal Propagation Configuration


Use case specific Configuration

Again, Quick recap, In our Use Company Code is the main deriving factor, Two Important Points to be noted based on the detailed requirement discussed so far:

  1. User have access to multiple company codes across multiple system.

  2. Company Code is unique across all system.


so, we need to design our solution, we need

  1. One Config Table where we can map company codes against each system [ each system will be represented by BTP Destination set up above]

  2. So for any external API call to S4HANA system for fetching  information[ Business partner, Accounting Document  etc.] we will pass below two attributes :


a) Logged in user Information which will control Authorization[ will be taken care by Principal Propagation]. no need to pass, framework is smart 🙂


b) Selected Company Code, Yes this we will pass in Query filter.



Configuration Table for Company Code


End to End Detail Technical Picture with sample Data 


End to End Technical flow with sample data


once the User will select the Company Code, OData Service will be triggered created on the top of this table which will used to derive the destination dynamically.

CAPM Application Logic Flow & Development 

with this Blog, I won't be repeating the CAPM development approach, Pleas refer CAP documents for the basic CAP understanding.

Pre Requisite: 

  • Connectivity is available with all respective Backend Systems:

    • Cloud Connector Setup is done

    • Destinations Setup is done as mentioned above.





  • In this use case, all the subsequent data will be retrieved from the Backend like Business partner, Accounting Document, Purchase contract etc. so either CDS based standard or custom API are available. Standard APIs can be referred from the API Hub


CAPM Logic Flow


CAPM Logic Flow


 

Explanation with Code

//Steps:Custom Entity ZI_BusinessPartner / can vbe used Standard API_BusinesspartnerSRV
const cds = require('@sap/cds')

// Glbal attribues can be used across all entities
var global = {};

module.exports = cds.service.impl(async function () {
//Step1: Implement Service Handler
this.on('READ', 'ZI_BusinessPartner', async (req) => {
//Step2:Retrieve the Destination from Company Code API Call and set in Request Header
global.dest = req.headers['Destinatination'];
// Step:Call to Backend API
const service = await cds.connect.to(global.dest);
// Step4:Return Data
return service.tx(req).run(req.query);
})

}



Reference Package.json : cds.require section
 "cds": {
"requires": {
"db": {
"kind": "hana",
"pool": {
"acquireTimeoutMillis": 5000,
"min": 0,
"max": 400,
"fifo": true
}
},
"uaa": {
"kind": "xsuaa"
},

"ZDemo_SRV_PP_100": {
"kind": "odata-v2",
"credentials": {
"destination": "S4HANA_100",
"path": "/sap/opu/odata/sap/ZDEMO_SRV_PP_100",
"forwardAuthToken": true
}
},

"ZDemo_SRV_PP_200": {
"kind": "odata-v2",
"credentials": {
"destination": "S4HANA_200",
"path": "/sap/opu/odata/sap/ZDEMO_SRV_PP_200",
"forwardAuthToken": true
}
}
},
"auth": {
"passport": {
"strategy": "JWT"
}
},
"hana": {
"deploy-format": "hdbtable"
}
},

I hope, every one enjoyed this series. I tried to explain from the Business requirement perspective. even though actual coding was bit less because of strong CAPM framework but extremely powerful to solve complex Business Problem with ease.

I keep sharing and posting latest happenings on my LinkedIn, Happy to connect over my LinkedIn too.

Email Id :mohithmbansal@gmail.com

LinkedIn : Mohit Bansal

 

Cheer;

Mohit Bansal

 

 

 

 

 
7 Comments
Labels in this area