Test OData Service using SAP Gateway Client
April 16, 2019

  1. Design / Prototype
  2. Create Dictionary Objects
  3. Create Interface View (CDS)
  4. Business Object Generation (CDS – Object Model Annotations )
  5. Generated Business Object
  6. BOPF – Development
  7. Test BOPF Object using BOBT
  8. Access Control (CDS)
  9. Consumption View (CDS)
  10. OData Service Generation and Registration
  11. Test OData Service using SAP Gateway Client
  12. UI development

Activities


Accessing Gateway Client

  1. From Service Implementation view of SEGW project. Select the service and click on SAP Gateway Client
  2. From Gateway Service Activate and Maintenance Screen (/IWFND/MAINT_SERVICE), select the service, select the ICF Node and click on SAP Gateway Client
  3. Go to transaction /IWFND/GW_CLIENT

If you navigate to gateway client from gateway builder or service maintenance then, service link will be auto-populated in Request URI. If you directly access using transaction, then it will show the last request used by you. You can select service using the SELECT option from the toolbar.

Execute the GET method for service link directly without any entity set or metadata option.

As a result it will display the list of Entity Sets for that particular service.

<< Activities


Read

If Service link is already mentioned in Request URI, then click on Entity Sets and select the set that you want to read.

Execute the selected service and entity set using the GET method. It will display the list of entities. Each entity is represented by XML tag <entry>. Link to the specific entity can be seen as value for “href” within XML tag <link>, copy that and use it with the entity set link. Alternatively, you can find complete URL in XML tag <id>.

Execute the whole entity link with GET method. It will display the entity details.
Example:

/sap/opu/odata/SAP/Z2812_PHONE_BOOK_SRV/Z2812_C_PB_HEAD_ND(pb_head_uuid=guid'42f2e9af-c507-1ee9-94ed-ce573097da51',IsActiveEntity=true)

<< Activities


Update

  1. First, read the entity you want to update.
  2. Next, click on option ‘Use as Request‘ on the HTTP response side. It will result in
    • Copying of the response body to the HTTP Request window.
    • And header attributes such as X-CSRF-Token and Content-Type
  3. Update the new value to the required field tag.
  4. Select the PUT method and click on Execute
  5. Data will be updated.

Updated data for the processed entity

<< Activities


Create

  1. First, read the entity you want to update.
  2. Next, click on option ‘Use as Request‘ on the HTTP response side. It will result in
    • Copying of the response body to the HTTP Request window.
    • And header attributes such as X-CSRF-Token and Content-Type
  3. Delete all the reference to the copied entity, between <entry> and <content> tag.
  4. Provide initial and new values to required fields tag.
  5. Select POST method and click on Execute
  6. The record will be created in DB.

Sample request for Creation.
I have removed my host-name with <hostname> in <entry> tag (sensitive data) In general, no action is required for this as request body is copied from the response.

<?xml version="1.0" encoding="utf-8"?>
<entry xml:base="https:<hostname>/sap/opu/odata/sap/Z2812_PHONE_BOOK_SRV/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
 <content type="application/xml">
  <m:properties>
   <d:Activation_ac>false</d:Activation_ac>
   <d:Copy_ac>true</d:Copy_ac>
   <d:Edit_ac>true</d:Edit_ac>
   <d:Email_ac>true</d:Email_ac>
   <d:Preparation_ac>false</d:Preparation_ac>
   <d:Validation_ac>false</d:Validation_ac>
   <d:pb_email_id_fc>3</d:pb_email_id_fc>
   <d:pb_first_name_fc>3</d:pb_first_name_fc>
   <d:pb_head_uuid_fc>1</d:pb_head_uuid_fc>
   <d:pb_last_name_fc>3</d:pb_last_name_fc>
   <d:pb_head_uuid>00000000-0000-0000-0000-000000000000</d:pb_head_uuid>
   <d:pb_id>0000000000</d:pb_id>
   <d:pb_owner>Gateway</d:pb_owner>
   <d:pb_first_name>oData</d:pb_first_name>
   <d:pb_last_name>Create</d:pb_last_name>
   <d:pb_full_name>Create oData</d:pb_full_name>
   <d:pb_email_id>email.created@oData.request</d:pb_email_id>
   <d:pb_created_at>2019-04-15T00:00:01Z</d:pb_created_at>
   <d:pb_changed_at>2019-04-15T00:00:01Z</d:pb_changed_at>
   <d:HasDraftEntity>false</d:HasDraftEntity>
   <d:ActiveUUID>00000000-0000-0000-0000-000000000000</d:ActiveUUID>
   <d:DraftEntityCreationDateTime m:null="true"/>
   <d:DraftEntityLastChangeDateTime m:null="true"/>
   <d:HasActiveEntity>false</d:HasActiveEntity>
   <d:IsActiveEntity>true</d:IsActiveEntity>
  </m:properties>
 </content>
</entry>

New entry created in DB

<< Activities


Delete

  1. First, read the entity you want to update.
  2. Next, click on option ‘Use as Request‘ on the HTTP response side. It will result in
    • Copying of the response body to the HTTP Request window.
    • And header attributes such as X-CSRF-Token and Content-Type
  3. Select the DELETE method and click on Execute
  4. The record will be deleted.

<< Activities

<< Top