In this blog, I want to share the details about the CRUD Operation by using RFC function module. RFC stands for ‘Remote Function Call’-It can be called across the server and can access the data from SAP and Non SAP also. In RFC we always use pass by value mode.
Basically, this functionality includes the RFC function module, when we trigger data services, this RFC should trigger and perform CRUD operations according to the update flag field.
Please follow the steps below to obtain further details.
Step 1: In this scenario I have used the custom table ( ZEMPDETAILS) to perform the CRUD Operations.
Step 2: Created a RFC Function Module (ZEMP_DATA) as below code. This RFC will trigger through OData service.
Step 3: Built an OData service (ZRFC_ODATA) and properties as shown in below.
Entity Types: EMPDATA
Step 4:Mapping of operation CREATE for EMPDATASET as shown in below.
Here, RFC function module will take action by right click on Create->Provide RFC FM then click on propose mapping button to map the corresponding fields as below.
After execution of OData service. We can able to create the entry in custom table. When we click on execute button the RFC FM will trigger and perform the action based on update flag ‘I‘.
Output: Successfully inserted entry in custom table.
Step 5:Mapping of operation GETENTITY for EMPDATASET as shown in below.
Here, RFC function module will take action by right click on GetEntity->RFC FM then click on propose mapping button to map the corresponding fields as below.
After execution of OData service. We can able to get the entry from custom.
Step 6:Mapping of operation UPDATE for EMPDATASET as shown in below.
Here, RFC function module will take action by right click on Update-> RFC FM then click on propose mapping button to map the corresponding fields as below.
After execution of OData service. We can able to update the entry into custom table. When we click on execute button the RFC FM will trigger and perform the action based on update flag ‘U‘.
Output: Successfully updated the record.
Step 7:Mapping of operation DELETE for EMPDATASET as shown in below.
Here, RFC function module will take action by right click on Delete-> RFC FM then click on propose mapping button to map the corresponding fields as below.
After execution of OData service. We can able to delete the entry from custom table When we click on execute button the RFC FM will trigger and perform the action based on update flag ‘D’.
Output: Successfully deleted the record from table.
Conclusion:
By following the steps above, we can accomplish the similar requirement of performing CRUD operations by RFC at the custom table.
Thanks for reading. Hope this blog will be helpful. Please provide your feedback on comment section.
-Ask or follow questions about SAP NetWeaver .
-Read other SAP NetWeaver and follow blog posts.
-Please follow Puligilli Mahesh for future posts.