This blog is about the workarounds for String functions in ABAP CDS Views and talks about the implementation using CDS Table and AMDP Functions.
This process involves creation of the calculation view, expose the HANA view as Dictionary table and use the same in CDS view to fetch the area code.
Create a calculation view as mentioned in the below example:
The below calculated column is created to fetch the Area code based on characteristics “_” and “.”
Note: All column names (Fields) should be in the Capital case.
Output of the calculation view:
An SAP HANA View (Attribute View, Analytic View, Calculation View) is an entity of the SAP HANA database and is defined here using SAP HANA Studio. This uses HANA-specific data types and different naming conventions which means the direct access to an SAP HANA view in CDS view is not possible. To access the SAP HANA view in ABAP programs we will create external views which creates a DDIC type table. This can be used as a proxy for the SAP HANA view which can be used to access the data in CDS views.
Process to create Dictionary table based on the SAP HANA view.
- Open the ABAP perspective and choose to create a new Other ABAP repository Object.
2. Search for the object of type dictionary view and proceed further
3. Provide the name and description and choose the view which you want to create the dictionary view
4. Verify the fields and active the dictionary view
5. Use the dictionary view and created above CDS view to fetch the area code based on ID
Below is the output of the CDS view with area codes(required_value)
As a continuation of this blog, please refer to the this blog on ABAP CDS Table Function with AMDP Function Implementation.