We are now part of Eviden, discover more...

This blog is about the workarounds for String functions in ABAP CDS Views and talks about the implementation using CDS Table and AMDP Functions.

ABAP CDS table function is defined in the type CDS DDL. In general, the CDS table is implemented using the AMDP method amdp_function, which is created using the AMDP framework in the database system as an AMDP function. This blog is a follow up blog from the previous one where we discussed string operations in HANA Models and workarounds to achieving the same.

A CDS table function returns data of type table and it is available in the namespace of the data types in the ABAP dictionary so this can be used as a data source in other CDS entities.

Process

Steps to create the CDS table function, ABAP class and consuming it in CDS view is explained below:

  1. Go to ABAP perspective and create a CDS table function by using the same approach as of CDS view. Specify the columns which are required as output of the table function.
    abap-cds-table-function-amdp-function-implementation
  2. To create AMDP methods select the ABAP class in as mentioned in the below image.
    abap-cds-table-function-amdp-function-implementation
  3. Provide proper naming standards and click on finish.
    abap-cds-table-function-amdp-function-implementation
  4. Kindly note that AMDP function implementation for a CDS table function can only be declared in the public visibility section of a static AMDP class. Use the below image example to create class for table function. Here we also include the logic to determine the Area Code within the ID Description.
    abap-cds-table-function-amdp-function-implementation
  5. Consume the above created CDS Table Function in the CDS view to fetch Area code based on ID.
    abap-cds-table-function-amdp-function-implementation

Below is the output for the CDS view with area codes(required_value)
abap-cds-table-function-amdp-function-implementation


Corporate HQ:
5920 Windhaven Pkwy, Plano, TX 75093

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com


Copyright © Visual BI Solutions Inc.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This!

Share this with your friends and colleagues!