Netweaver Gateway Development

OData Service importing RFC/BOR interface - Update operation implementation

             We have created our OData service importing RFC/BOR interface.We have implemented GET_ENTITYSET, GET_ENTITY,CREATE_ENTITY methods also by mapping the fields from RFC.In this tutorial we will be implementing Update operation of CRUD-Q operations.We will be mapping BAPI_EPM_SO_CHANGE to Update 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 Update->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_CHANGE.Click continue.
  3. Now click Propose Mapping button in mapping screen. We also need to tell the RFC which all fields we are going to change.This is based on standard BAPI behaviour in which each import structure field has to have corresponding X structure. This X structure has a flag for each field of the original structure(except key field SOHEADERDATAX\SO_ID ) indicating whether the field to be considered. Here the X structure is SOHEADERDATAX. Add new line using Append Row button.Give 'X' in constant field for each field need to be changed. Also we need to map SoId to SO_ID\SO_ID. We are mapping SoId three times. See image .
  4. Check the project for errors.If mapping is correct no error will be thrown.Generate the project. To 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 http method to PUT and execute.Upon success we will get a 204 http response.
In the next tutorial we will implement Delete operation of CRUD-Q operations.
If you enjoyed this post, Please Share!!

0 comments :

Post a comment

Powered by Blogger.