ABAP RESTful Programming Model Overview
ABAP RESTful Programming Model Overview
Managed and unmanaged implementation types in the ABAP RESTful application programming model differ primarily in who provides the business object's functionality. The managed implementation type uses a predefined business object provider that supports standard CRUD operations without requiring additional programming effort. This is suitable for scenarios where the default functionality suffices, such as greenfield projects. On the other hand, the unmanaged type allows developers to implement the business object's functionality themselves, providing flexibility for brownfield developments or when integrating existing applications into the RAP model. Unmanaged scenarios are ideal for complex requirements where predetermined functionality doesn’t meet specific business needs .
The orchestration framework supports extendability and flexibility in the ABAP RESTful application programming model by mapping OData requests to RAP requests for generic processing. It oversees transactional operations, such as locking, ETag handling, and commit/rollback processes, without tying application logic to specific protocols or database technologies. This allows developers to focus on business logic implementation while ensuring that applications are robust, scalable, and adaptable to different use cases. Managed and unmanaged implementation options further enhance flexibility, allowing the integration of existing APIs or customizing new functionalities within a given business process architecture .
Within the ABAP RESTful application programming model, the SAP Gateway is responsible for implementing the OData protocol, facilitating external application requests, and acting as an entry point into the SAP application. It forwards these requests to the orchestration framework, which maps them into RAP requests. The orchestration framework ensures generic evaluation of these requests, managing transactional locks, ETag handling, commit, and rollback behavior. It determines whether to invoke managed or unmanaged methods for operations and forms the transactional bracket around RAP requests .
The entity manipulation language (EML) is critical in the ABAP RESTful application programming model as it provides a standardized, type-safe API for accessing and modifying business object data. EML is used to perform write operations (using MODIFY ENTITIES) and read operations (using READ ENTITIES) on a business object. It is essential for defining transaction boundaries because EML statements can specify commit and rollback behaviors, making it integral to enforcing transactional integrity and consistency within a RAP-based application .
The business object framework ensures proper handling of CRUD operations within the ABAP RESTful programming model by controlling the actual execution of these operations on business objects. During the interaction phase and save sequence, it calls the appropriate methods of the business object provider API for both managed and unmanaged behavior implementations. This ensures that CRUD operations are correctly processed and that transaction integrity is maintained across the RAP model, regardless of whether operations are triggered through OData requests or local EML calls .
In the ABAP RESTful application programming model, the interaction phase involves performing operations on a business object instance, such as creating or modifying it. During this phase, instances of CDS entities are stored in the transaction buffer. The save sequence, triggered by a commit, writes the state of the transaction buffer persistently to the database. Stateless communication is ensured because the transaction buffer state isn't preserved across multiple requests, aligning with REST principles . Draft handling in the RAP model allows temporary storage of transaction buffer states with inconsistent data, enabling distribution of the interaction phase across multiple requests while maintaining statelessness .
Draft handling is significant in the ABAP RESTful programming model because it allows the temporary storage of the transaction buffer state with potentially inconsistent data on the database, facilitating the distribution of the interaction phase across multiple requests or user sessions. This feature enables users to pause and resume their work without losing progress, irrespective of device changes. It maintains stateless communication, adhering to REST principles, and ensures users can continue unfinished transactions seamlessly, enhancing user experience and flexibility in handling business processes .
The RAP transaction model's adherence to REST principles implies that the model must maintain stateless communication during interactions with business objects. This means that the transaction buffer state is not retained across multiple, independent requests. This design choice encourages the development of scalable applications that can handle failures and user interruptions gracefully. Application developers need to design systems that accommodate this stateless nature, employing strategies like draft handling to allow users to persist incomplete transactions temporarily. It also influences application performance and design considerations, such as session management and resource allocation .
Choosing between a managed and unmanaged query in the ABAP RESTful application programming model involves considerations related to the specific requirements of the use case. A managed query provides ready-to-use functions for reading and processing business data, such as sorting and filtering, with minimal coding. This is ideal for scenarios where standard data access is sufficient. In contrast, an unmanaged query requires the developer to implement these operations, offering the flexibility to integrate diverse data sources, adapt data models, or use custom logic, which may be necessary for complex integrations or when bridging significant differences between data models .
In the ABAP RESTful application programming model, customization can be integrated into a managed scenario by adding more logic to the save sequence, referred to as additional save. This allows developers to customize the default CRUD operations provided by the managed business object provider. Despite the out-of-the-box functionality offered by managed scenarios, developers can implement specific business logic where required, such as validation of certain data or calculations necessary for the business process, allowing some flexibility within a generally predefined structure .