This video tutorial focuses on the implementation of the ETag Code Base Approach in SAP using Core Data Services (CDS) and Runtime Data Services (RDS). The tutorial covers the concept of concurrency control, which is crucial for preventing conflicts when multiple users attempt to update the same data simultaneously. The tutorial also demonstrates the creation of an OData service with reference to a CDS view, and the implementation of create, update, and delete operations.
Key topics covered in the session:
- Understanding the Need for ETag Code Base Approach: The presenter begins by explaining the necessity of a code-based approach for ETag handling. This becomes essential when creating an OData service with reference to a CDS view, as the ETag property cannot be directly edited in the service creation wizard.
- Creating a New Project and Importing a CDS View: The presenter creates a new project in the SAP Gateway client (transaction code SEGW) and imports a CDS view as a data source. He explains that read operations will work immediately, but create, update, and delete operations require additional implementation.
- Adding a Timestamp Property to the Entity Set: The presenter demonstrates how to add a timestamp property to the entity set in the project. This timestamp is used as the ETag value for concurrency control. The presenter explains that the framework automatically checks if the timestamp value (ETag) has changed before updating or deleting data.
- Generating Runtime Artifacts: The presenter shows how to generate runtime artifacts for the project, including the Model Provider Class (MPC) and Data Provider Class (DPC) extension classes.
- Adding the ETag Property in the MPC Extension Class: The presenter explains how to add the ETag property in the MPC extension class. This is done by overriding the DEFINE method and adding the ETag property to the entity set.
- Implementing CREATE_ENTITY, UPDATE_ENTITY, and DELETE_ENTITY Methods: The presenter shows how to implement the CREATE_ENTITY, UPDATE_ENTITY, and DELETE_ENTITY methods in the DPC extension class. He explains that these methods need to calculate the ETag value and update the timestamp in the database.
- Testing the OData Service: The presenter demonstrates how to test the OData service using the SAP Gateway client. He shows how to perform create, update, and delete operations, and how the ETag value is used to prevent conflicts.
- Discussion on Manual ETag Handling: The presenter explains that the ETag handling can also be implemented manually in certain scenarios, such as when using function imports or when the read and update operations are performed in different methods. He mentions that this topic will be covered in a future video.