Create an OData request to read an entity list (entity collection) in the Client Proxy instance.
See also: [MS-ODATA]: Open Data Protocol (OData).
A RetrieveEntitySet
Request is used by a client to update the entries in an AtomPub Collection, as specified in RFC5023, that maps to an EntitySet
in the abstract data model.
See also: OData Version 4.01. Part 1: Protocol.
OData services support data requests for using HTTP GET requests. The URL path specifies the target of the request (for example, the collection of entities, entity, navigation property, structural property, or operation).
Get all entities of entity set “Employees
”
GET /sap/opu/odata4/iwbep/tea/default/iwbep/tea_busi/0003/Employees
Get all entities of entity set “Employees
”
GET /sap/opu/odata/IWBEP/TEA_TEST_APPLICATION/Employees
As the coding is independent of the OData version, we're presenting a general example on how to create a
READ
request on an entity list.
The starting point for a GET
entity request is the Client Proxy Examples. You can create a read list request
based on an entity list resource
.
Running the read list request
provides the read list response that can provide the business data of the READ entity list request.
Fetch all entities of the Version 4 entity set ‘Employees
':
GET /sap/opu/odata4/iwbep/tea/default/iwbep/tea_busi/0003/Employees
DATA: lo_client_proxy TYPE REF TO /iwbep/if_cp_client_proxy,
lo_read_list_request TYPE REF TO /iwbep/if_cp_request_read_list,
lo_read_list_response TYPE REF TO /iwbep/if_cp_response_read_lst,
lo_entity_list_resource TYPE REF TO /iwbep/if_cp_resource_list,
lt_employee TYPE STANDARD TABLE OF /iwbep/s_v4_tea_employee.
lo_entity_list_resource = lo_client_proxy->create_resource_for_entity_set( 'EMPLOYEES' ).
lo_read_list_request = lo_entity_list_resource->create_request_for_read( ).
lo_read_list_response = lo_read_list_request->execute( ).
lo_read_list_response->get_business_data( IMPORTING et_business_data = lt_employee ).
Step 1: Create the entity list resource for entity set ‘Employees
’ (with internal name ‘EMPLOYEES
’):
DATA: lo_client_proxy TYPE REF TO /iwbep/if_cp_client_proxy,
lo_entity_list_resource TYPE REF TO /iwbep/if_cp_resource_list.
lo_entity_list_resource = lo_client_proxy->create_resource_for_entity_set( 'EMPLOYEES' ).
Step 2: Create the read list request instance on the entity resource:
DATA: lo_read_list_request TYPE REF TO /iwbep/if_cp_request_read_list,
lo_entity_list_resource TYPE REF TO /iwbep/if_cp_resource_list.
lo_read_list_request = lo_entity_list_resource->create_request_for_read( ).
Step 3: Run the read list request and get the read list response instance:
DATA: lo_read_list_request TYPE REF TO /iwbep/if_cp_request_read_list,
lo_read_list_response TYPE REF TO /iwbep/if_cp_response_read_lst.
lo_read_list_response = lo_read_list_request->execute( ).
DATA: lo_read_list_response TYPE REF TO /iwbep/if_cp_response_read_lst,
lt_employee TYPE STANDARD TABLE OF /iwbep/s_v4_tea_employee.
lo_read_list_response->get_business_data( IMPORTING et_business_data = lt_employee ).
When you're using the Version 4 local client proxy, the business data you receive from the local consumption response isn't converted again for outbound processing.
Related Information