In this blog article, we will walk you through the process of fetching PDF from SAP using ODATA URL by giving some input parameters.
Here we are using HTTP Adapter instead of ODATA adapter.
For fetching PDFs from SAP, the HTTP adapter is preferred due to better binary data handling, performance, authentication support, and flexibility, while the OData adapter is better suited for structured data exchange.
Here I’m sending some input parameters from postman and then I will store these inputs in exchange property (content modifier) and these stored properties are later used as parameters in the HTTP adapter.
Adding Request-Reply Step
To consume the OData URL, add a Request-Reply step in your integration flow and connect it with the receiver using the HTTP Adapter.
Now, configure the HTTP Adapter with the necessary details:
1.Endpoint: Enter the URL in Address.
URL Breakdown: –
The following OData URL is used to fetch billing proforma details from the SAP system:
Components of the URL
Base URL: http://host:Port /sap/opu/odata/sap/This is the entry point of the SAP OData service.Service Name: ZCONTRACT_SRVThis is the custom OData service created in SAP.Entity Set: BILLING_PROFORMASetRepresents the collection of billing proforma data.Query Parameters:FROM_DT=’${property.FromDate}’ → Start date for filtering the billing proforma.TO_DT=’${property.ToDate}’ → End date for filtering the billing proforma.VBELN=’${property.Vbeln}’ → Sales document number (optional for specific filtering).$value:This keyword is used to fetch the raw value of the requested data, typically used for downloading files or direct content retrieval.
2.Select the proxy type:
On-Premise: The on-Premise proxy type is suitable for scenarios where the OData service is hosted within your organization’s network. It allows the adapter to establish a connection within the internal network, ensuring secure and controlled access.
3.Select the Method:
Here we will choose Get method because we are fetching data from SAP.
4.Authentication:
Specify the authentication here we are using Basic Auth and provide the required credentials.
Leave the remaining fields as empty as they are not mandatory.
5.Now save and deploy the I-Flow
Testing Using Postman
Trigger the endpoint from Postman below are the screenshot of the response.
You can convert the retrieved PDF to a Base64 string, use the Base64 Converter pallets in CPI
In this blog article, we will walk you through the process of fetching PDF from SAP using ODATA URL by giving some input parameters.Here we are using HTTP Adapter instead of ODATA adapter.For fetching PDFs from SAP, the HTTP adapter is preferred due to better binary data handling, performance, authentication support, and flexibility, while the OData adapter is better suited for structured data exchange.Here I’m sending some input parameters from postman and then I will store these inputs in exchange property (content modifier) and these stored properties are later used as parameters in the HTTP adapter. Adding Request-Reply StepTo consume the OData URL, add a Request-Reply step in your integration flow and connect it with the receiver using the HTTP Adapter.Now, configure the HTTP Adapter with the necessary details:1.Endpoint: Enter the URL in Address. URL Breakdown: -The following OData URL is used to fetch billing proforma details from the SAP system:http://Host:Port/sap/opu/odata/sap/ZCONTRACT_SRV/BILLING_PROFORMASet(FROM_DT=’${property.FromDate}’,… Components of the URLBase URL: http://host:Port /sap/opu/odata/sap/This is the entry point of the SAP OData service.Service Name: ZCONTRACT_SRVThis is the custom OData service created in SAP.Entity Set: BILLING_PROFORMASetRepresents the collection of billing proforma data.Query Parameters:FROM_DT=’${property.FromDate}’ → Start date for filtering the billing proforma.TO_DT=’${property.ToDate}’ → End date for filtering the billing proforma.VBELN=’${property.Vbeln}’ → Sales document number (optional for specific filtering).$value:This keyword is used to fetch the raw value of the requested data, typically used for downloading files or direct content retrieval.2.Select the proxy type: On-Premise: The on-Premise proxy type is suitable for scenarios where the OData service is hosted within your organization’s network. It allows the adapter to establish a connection within the internal network, ensuring secure and controlled access.3.Select the Method:Here we will choose Get method because we are fetching data from SAP.4.Authentication:Specify the authentication here we are using Basic Auth and provide the required credentials. Leave the remaining fields as empty as they are not mandatory.5.Now save and deploy the I-FlowTesting Using PostmanTrigger the endpoint from Postman below are the screenshot of the response.You can convert the retrieved PDF to a Base64 string, use the Base64 Converter pallets in CPI Read More Technology Blogs by Members articles
#SAP
#SAPTechnologyblog