Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Make a custom function call without using SAP NetWeaver
There are several ways you can make custom function calls without using SAP NetWeaver when working with RFC (Remote Function Call) in SAPUI5. Here are the most effective approaches ?
Web Service or REST Service Approach
You can create a web service or REST service that utilizes the RFC you have created. Host this service in the SAP environment and then consume it in SAP UI5 using the service URL. This approach provides a clean separation between your UI5 application and the backend RFC functionality.
// Example of consuming REST service in UI5
var oModel = new sap.ui.model.json.JSONModel();
var sServiceUrl = "https://your-sap-server.com/sap/bc/rest/your_custom_service";
jQuery.ajax({
url: sServiceUrl,
type: "GET",
success: function(data) {
oModel.setData(data);
}
});
SICF Service with Handler
Alternatively, you can create a SICF (SAP Internet Communication Framework) service with a custom handler. In the handler implementation, include the same logic for fetching content that you have in your RFC. This approach gives you more control over the HTTP communication layer.
" Example SICF handler class
CLASS zcl_custom_http_handler DEFINITION
PUBLIC
INHERITING FROM cl_rest_resource.
PUBLIC SECTION.
METHODS: if_rest_resource~post REDEFINITION.
ENDCLASS.
SAP HANA Cloud Connector
If you prefer not to create services, you can use the connector approach with SAP HANA Cloud Connector. This solution works seamlessly with SAP Cloud Platform (SCP) applications and provides secure connectivity between cloud applications and on-premise SAP systems.
The Cloud Connector acts as a reverse proxy that establishes a secure tunnel between your cloud application and the on-premise SAP system, allowing you to call RFCs without exposing internal systems directly to the internet.
Conclusion
You can choose any of these approaches based on your specific requirements and infrastructure setup. The REST service approach offers simplicity, while SICF provides more control, and the Cloud Connector ensures secure connectivity for hybrid scenarios.
