Skip to Content
Author's profile photo Biplab Ray

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.

1.JPG

Open the node ABAP Connections and create a new RFC connection for our application like below.

And provide required information as below.

2.JPG

And we will get a entry like below under node ABAP connection.

3.JPG

Now execute the t-code : spro and do the below configuration.

4.JPG

And make a entry like below for gateway hub connection.

5.JPG

To manage SAP system alias we have to execute below option of spro.

6.JPG

And we will make an entry like below.

7.JPG

And now execute t-code : sicf and make sure all the below node should be in active status.

Path : default_host -> sap -> opu

8.JPG

Now we are ready to create our first OData.

Step 2: Execute the t-code : segw and we will get screen like below.

9.JPG

Now press the create button to create our first project. And Provide required information.

10.JPG

Now our first project is created as below.

11.JPG

Step 3: Now we have to import our RFC as below.

12.JPG

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

13.JPG

Step 4: Now expand the SOHEADERDATA node and select the below fields.

14.JPG

Step 5: Now select field SO_ID as a key.

15.JPG

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

16.JPG

Step 7: Now expand the node SOITEMDATA and select the below fields.

17.JPG

Step 8: Please select the key fields as below. And press Finish button.

18.JPG

Step 9: Now we could see the Entity Sets automatically get created as below.

19.JPG

And provide the name as below of entity set.

20.JPG

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.

21.JPG

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.

22.JPG

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.

23.JPG

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.

24.JPG

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

25.JPG

Now we will get screen like below , where we have to do the mapping.

26.JPG

Now we have to do the mapping of the Read Query as above. And do the mapping as below.

27.JPG

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

28.JPG

Now, we have to do the mapping.

Expand the Header Node and do the below mapping.

29.JPG

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.

30.JPG

Please click on the selected button and do the below configuration.

Please go to Part II of the document.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.