URIs in SAP Netweaver Gateway - Sap 4 All

Latest

Please enter your email and get the updates in your inbox.

Thursday, 11 August 2016

URIs in SAP Netweaver Gateway

Go through the below post first, before starting with this content.


Two tables ZMA_GW_EMPZMA_GW_EMP_DEP are created in the working example. Lets maintain some data in these tables and check how the data will be returned using the gateway client requests.


Employee Header Data: ZMA_GW_EMP




Employee Dependents Data: ZMA_GW_EMP_DEP


Service Name: ZMA_EMPS_DEMO_SRV

Entities: Emp_Data
    Dependent_Data
   
EntitySets: Emp_DataSet
        Dependent_DataSet
     
Association Name: Emp_Dependents




Example URIs to Test:


/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet('00000001')/Dependent_Dataset?$format=json



/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet/$count?$filter=Employee gt '00000001'

Response: 3

/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet?$filter=Employee eq '00000001'&$expand=Dependent_Dataset

Response:  SAPNTGW - EXPAND Test Response


/sap/opu/odata/sap/ZMA_EMPS_SRV/Emp_DataSet?$filter=Employee eq '00000001'&$expand=Dependent_Dataset&$format=json

Response:   SAPNTGW - EXPAND_JSON Test Response



/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet?$filter=Employee eq '00000001'

Response:   SAPNTGW - FILTER Test Response


/sap/opu/odata/sap/ZMA_EMPS_SRV/Emp_DataSet?$filter=Employee ge '00000001' and EmployeeName eq 'Employee1'

Response:   SAPNTGW - FILTER_MULTIPLE_KEYS Test Response


/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet('00000001')/Employee

Response:

<?xml version="1.0" encoding="UTF-8"?>
<d:Employeexmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">00000001</d:Employee>




/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Dependent_DataSet(Employee='00000001',DepNo='002')?$format=json


Response: 
{
  
"d" : {
    
"__metadata" : {
      
"id" "http://devdgw-ci.sap.umb.vqss.com:8001/sap/opu/odata/sap/ZMA_EMPS_SRV/Dependent_DataSet(Employee='00000001',DepNo='002')",
      
"uri" "http://devdgw-ci.sap.umb.vqss.com:8001/sap/opu/odata/sap/ZMA_EMPS_SRV/Dependent_DataSet(Employee='00000001',DepNo='002')",
      
"type" "ZMA_EMPS_SRV.Dependent_Data"
    },
    
"Employee" "00000001",
    
"DepNo" "002",
    
"DepType" "0001",
    
"DependentName" "Dependent2"

  }
}



/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet?$orderby=EmployeeName desc&$format=json

Response:   SAPNTGW - ORDERBY_DESC_JSON Test Response



/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet('00000001')/Employee/$value

Response: 00000001


/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet?$select=Employee


Response:   SAPNTGW - SELECT Test Response


/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Dependent_DataSet?$format=json

Response:   SAPNTGW - GET_ENTITYSET Test Response


/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet


Request: 
        {
  "d" : {

    
"Employee" "00000008",
    
"EmployeeName" "Employee8"

  }
}

Response: Employee will be created


/sap/opu/odata/SAP/ZMA_EMPS_DEMO_SRV/Emp_DataSet

Request:

{
  
"d" : {
        
"Employee" "00000009",
        
"EmployeeName" "Employee9",
        
"Dependent_Dataset" : [
            {
              
"Employee" "00000009",
              
"DepNo" "001",
              
"DepType" "0001",
              
"DependentName" "Dependent1"

            }
            ]
        }
      }


Response: Employee will be created along with dependents

1 comment:

  1. Thanks for sharing this Information,

    Got to learn new things from your Blog on Sap abap.

    http://thecreatingexperts.com/sap-abap-training-in-chennai/

    Both online and classroom training is provided.

    Contact 8122241286

    ReplyDelete