This blog post will provide the steps to implement the pagination in OData by leveraging the CDS view and the SADL framework based on Mapped Data Source.
Introduction:
SADL offers a mapping editor in the SAP Gateway Service Builder to bind one or several SADL models to OData entity sets. This enables you to use SADL models as an additional data source besides RFC and others. Once the OData properties are mapped, the system provides a standard, optimized implementation of the OData service to retrieve the data.
Now let see how to create the Gateway project using CDS view and SADL framework.
1. Create the CDS view:
Create the CDS view from Eclipse
◉ Right click on the package icon, and from the context menu select New->other ABAP repository object.
2. Create Gateway project:
3. Test from Gateway client:
Option | Use Case | Tool |
Auto-Exposure |
Let us assume that you created a quite elementary data model based on multiple CDS views. All these views together form a quite simple composition: One CDS view serves as root and the other CDS entities are children of your root CDS view. The CDS views of this composition might also have associations to other entities. With this option, a simple way of creating OData services has been introduced. Here, the OData model definition as well as the OData service runtime is provided generically and with low manual effort. Use this option if: - You want to expose such an elementary CDS data model as an OData service, together with first the level of associations. Do not use this option if: - Your data model composition is more complex and/or you need to include deeper association levels in your OData service. |
ABAP Development Tools |
Referenced Data Source (RDS) |
Use Case 1: You created several CDS views and complex CDS view compositions. You need to include in the OData service several levels of associations from CDS views to other entities. Use Case 2: You created a CDS view that contains features that are not supported by CDS or complex CDS view compositions. You need to implement these features manually in the model provider extension class (MPC_EXT class) or in the data provider extension class of your Service Builder project. To provide, for example, dynamic field control, you need to implement custom logic in a model provider extension class. Use this option if: - The CDS model and the CDS annotations fully specify the OData Model and the runtime behavior Do not use this option if: - Your data model is not only based on CDS. |
Transaction SEGW |
Mapped Data Source (MDS) |
You modeled an entity set in transaction SEGW from a DDIC structure. You want to map fields of a CDS view to your custom model. You furthermore want to reference from your custom model to another CDS view, for example, and therefore need to map the two different entity sets. Caution Future changes of the entities might invalidate the service runtime. Use this option if: - Your data model includes non-CDS entities Do not use this option if: - One of the other options is applicable. |
Transaction SEGW |
No comments:
Post a Comment