Asynchronous Execution
To improve performance, ABAP SMI supports asynchronous execution of OData requests by separating the steps of sending and synchronizing.
- The submit method (see Submitting a Request) sends a request to SAP Jam and does not wait for the response.
- When calling one of the corresponding getter methods (see Collecting the Results), the result is synchronized. If necessary, these synchronizing methods wait for the response from SAP Jam.
Examples
For illustrative purposes, compare the following code examples for sending and synchronizing two requests:
-
Synchronizing immediately leads to de-facto synchronous execution and potential waiting times.
lo_request1->submit( ). lo_entity1 = lo_result1->get_result_entity( ). lo_request2->submit( ). lo_entity2 = lo_result2->get_result_entity( ). do_something( lo_entity_1 ). do_something( lo_entity_2 ).
-
Synchronizing later (when you actually need the result) enables asynchronous execution and can reduce waiting times.
lo_request1->submit( ). lo_request2->submit( ). lo_entity1 = lo_result1->get_result_entity( ). do_something( lo_entity_1 ). lo_entity2 = lo_result2->get_result_entity( ). do_something( lo_entity_2 ).