Netweaver Gateway Development

OData Service importing RFC/BOR interface - Create operation implementation

        We have created our OData service importing RFC/BOR interface.We have implemented GET_ENTITYSET and GET_ENTITY methods also by mapping the fields from RFC.In this tutorial we will be implementing Create operation of CRUD-Q operations.We will be mapping BAPI_EPM_SO_CREATE to Create operation.For codebased implementation follow our DDIC tutorial series.
Pre-requisites
  1. ZRFC_ODATA service created by importing RFC/BOR interface.
  2. GET_ENTITYSET method(Query operation) implemented.
  3. GET_ENTITY method implemented.


Steps
  1. Go to SEGW and open ZRFC_ODATA project in edit mode.Expand Service Implementation node->expand SalesOrderHeaderSet->Right click on Create->Click on Map to Data Source.
  2. Now on Map to Data Source popup window choose target Local.Then select type Remote Function Call give RFC name as BAPI_EPM_SO_CREATE.Click continue.
  3. Now click Propose Mapping button in mapping screen.Note all the mapping direction is input.Now we need to add a new mapping line manually for sales order id.Press Insert Row button.Select SoId in entity set property side.Drag and drop SALESORDER_ID\SO_ID Data Source Parameter side.Check the project for errors.If mapping is correct no error will be thrown.Generate the project.
  4. Now for test open gateway client (/IWFND/GW_CLIENT). Execute get request with uri '/sap/opu/odata/sap/ZRFC_ODATA_SRV/SalesOrderHeaderSet('0500000005')' . Press Use AS Request button.This will copy the righ hand side (response) to left hand side (Request). Now we need to adjust the http body property fields. Remove all properties apart from Note,BuyerId,BuyerName and CurrencyCode. This is because the RFC used here doesn't allow other fields to be provided in create operation. Now change the uri to '/sap/opu/odata/sap/ZRFC_ODATA_SRV/SalesOrderHeaderSet'. Chooe POST http method and execute.
In the next tutorial we will implement Update operation of CRUD-Q operations
If you enjoyed this post, Please Share!!

0 comments :

Post a Comment

Powered by Blogger.