on 2020 Feb 15 1:01 AM
Hi Experts,
I have a situation where a common OData service (example /SALESORDER_SRV) from 2 different ERP systems need to be exposed as API service. The OData works fine through Gateway system when using system alias as object in the url.
Ex: https://gateway-system/sap/opu/odata/sap/SALESORDER_SRV;o=ERP_1/SalesOrderListSet(SoId=1234)
https://gateway-system/sap/opu/odata/sap/SALESORDER_SRV;o=ERP_2/SalesOrderListSet(SoId=6789)
Using API management service of SCP, I have configured API provider for the gateway and I could create API for the above mentioned OData service.
Now that, in the Target Endpoint section, the URL is without system alias object in it.

How to add the specific system alias into the Target EndPoint service through Proxy EndPoint service call?
If the client application consume this above mentioned API service and trigger with 'system_alias' as header parameter, whether this can be extracted using Policy Type (Extract Variable) and then set the 'system_alias' header value to Target EndPoint Properties?
Thanks
Praveen Varriam
Request clarification before answering.
Hi,
This has been resolved by following action.
In the request API proxy API, I have included custom header and configured the APIProxyEndPoint and APITargetEndPoint files accordingly to handle dynamic routing URL.
1) Export the API package from the API portal and unzip the package.
2) open the default.xml file from APIProxyEndPoint folder and include the routeRule, conditions and targetEndPointName as shown below.
<routeRules>
<routeRule>
<name>systemERP1</name>
<conditions>request.header.sap-system-alias = "ERP_1"</conditions>
<targetEndPointName>ERP1</targetEndPointName>
<sequence>1</sequence>
<faultRules/>
</routeRule>
<routeRule>
<name>systemERP2</name>
<conditions>request.header.sap-system-alias = "ERP_2"</conditions>
<targetEndPointName>ERP2</targetEndPointName>
<sequence>2</sequence>
<faultRules/>
</routeRule>
</routeRules>
3) From folder APITargetEndPoint, remove default.xml and create 2 xmls with name ERP1.xml and ERP2.xml and add following lines. Keep other xml tags as is.
<TargetEndPoint>
<name>ERP1</name>
<provider_id>GATEWAY</provider_id>
<isDefault>false</isDefault>
<relativePath>/sap/opu/odata/SALESORDER_SRV;o=ERP_1</relativePath>
4) Under root folder APIProxy folder, add targetEndPoint tags as shown below keeping all other tags as is.
<targetEndPoints>
<targetEndPoint>ERP1</targetEndPoint>
<targetEndPoint>ERP2</targetEndPoint>
</targetEndPoints>
5) Zip the bundle with required API name keeping APIProxy as root folder while compressing to .zip file.
6) Once imported the updated package, you will get the required routing rule as configured in the xml files.

Now just test the API from any REST tool or through API Test Console with custom header 'sap-system-alias' and its required value ERP_1 or ERP_2.
Based on the header value, the target end point will be selected dynamically and get the results from required backend ERP/system.
You may also refer following links for additional details.
https://blogs.sap.com/2019/05/27/dynamic-routing-using-sap-cloud-platform-api-management/
Thanks!
Praveen Varriam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.