Way to create OData from RFC and consume into SAP UI5 application – Part I
Objective: Create OData from RFC and consume into UI5 application and run into local host of Eclipse.
Author Bio :
Name : Biplab Ray
Company : TATA Consultancy Services
To achieve the target we should follow the bellow approach.
Step 1: Before we start to create our first OData, we should setup our system configuration.
First we have to set up a RFC connection to do so, execute t-code : SM59 and do the below settings.
Open the node ABAP Connections and create a new RFC connection for our application like below.
And provide required information as below.
And we will get a entry like below under node ABAP connection.
Now execute the t-code : spro and do the below configuration.
And make a entry like below for gateway hub connection.
To manage SAP system alias we have to execute below option of spro.
And we will make an entry like below.
And now execute t-code : sicf and make sure all the below node should be in active status.
Path : default_host -> sap -> opu
Now we are ready to create our first OData.
Step 2: Execute the t-code : segw and we will get screen like below.
Now press the create button to create our first project. And Provide required information.
Now our first project is created as below.
Step 3: Now we have to import our RFC as below.
In the wizard provide the below details:
Entity Type Name |
SalesOrder |
Target System |
Local |
Data Source Type |
Remote Function Calls |
Data Source Name |
BAPI_EPM_SO_GET_LIST |
Step 4: Now expand the SOHEADERDATA node and select the below fields.
Step 5: Now select field SO_ID as a key.
Step 6: Now we are going to create one more entity as above.
In the wizard please provide the below details.
Entity Type Name |
SalesOrderItem |
Target System |
Local |
Data Source Type |
Remote Function Calls |
Data Source Name |
BAPI_EPM_SO_GET_LIST |
Step 7: Now expand the node SOITEMDATA and select the below fields.
Step 8: Please select the key fields as below. And press Finish button.
Step 9: Now we could see the Entity Sets automatically get created as below.
And provide the name as below of entity set.
Step 10: Now we have to generate the necessary the run time artifacts.
Press the below button and leave the fields of the wizards as it came.
Step 11: Now we have to register and activate the service.
Open the node and select the system GW_HUB and press the register button.
And in the subsequent pop us do not change any configuration. And it would get registered. As above.
Step 12: Now press the button Gateway Client to test the application.
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/$metadata and choose Execute.
Now we have to map our entity sets to our BAPI.
Step 13: Expand the node Service Implementation and right – click GetEntitySet(Query) and select Map to Data Source.
And provide the below information in the pop up.
Target System |
Local |
Data Source System |
Remote Function Call |
Data Source Name |
BAPI_EPM_SO_GET_LIST |
Now we will get screen like below , where we have to do the mapping.
Now we have to do the mapping of the Read Query as above. And do the mapping as below.
In the pop up , please provide the details as below.
Target System |
Local |
Data Source Type |
Remote Function Call |
Data Source Name |
BAPI_EPM_SO_GET_DETAIL |
Now, we have to do the mapping.
Expand the Header Node and do the below mapping.
In any read operation, we require one input parameter, based on that read query would work.
For this we have to manually add a new line to the mapping screen.
Please click on the selected button and do the below configuration.
Please go to Part II of the document.