Ansicht
Dokumentation

ABENCDS_F1_DEFINE_TABLE_FUNCTION - CDS F1 DEFINE TABLE FUNCTION

ABENCDS_F1_DEFINE_TABLE_FUNCTION - CDS F1 DEFINE TABLE FUNCTION

Addresses (Business Address Services)   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

- DEFINE TABLE FUNCTION

$[@entity_annot1$]
$[@entity_annot2$]
...
$[@function_annot1$]
$[@function_annot2$]
...
$[DEFINE$] TABLE FUNCTION table_function
         $[parameter_list$]
          element_list
          IMPLEMENTED BY METHOD amdp_function $[;$]


Effect

Defines a CDS entity table_function as a CDS table function in the CDS DDL. In platform-dependent SQL, the CDS table function is implemented in an AMDP method amdp_function, which is created using the AMDP framework in the database system as an AMDP table function. The name table_function must comply with the naming conventions for dictionary types and can have a maximum of 30 characters.

  • parameter_list is used to declare a list of optional input parameters for the CDS table function. These also define the input parameters of the AMDP table function.
  • element_list is used to declare the elements of the CDS table function. These also define the columns of the tabular return value of the AMDP table function.
  • When amdp_function is used, an AMDP function implementation must be specified for an AMDP table function in the form amdp_class=>amdp_method. Here amdp_class is an AMDP class and amdp_method is an AMDP function implementation contained in this class. When this function implementation is declared, the current CDS table function is specified after the addition FOR TABLE FUNCTION. The AMDP function implementation must not exist when the CDS table function is created and activated. The name of an AMDP function implementation amdp_function can be specified in a single CDS table function only.

A CDS table function returns a tabular result set. Like any CDS entity, it can be used as a data source in other CDS entities or read statements. The prerequisite for use is that the specified AMDP function implementation exists and is active.

The name of a CDS table function is located in the namespace of all global types of an AS ABAP.

Notes

  • Table functions constitute a database extension that is not supported by all database systems. However, the CDS DDL in ABAP CDS allows table functions to be created and accessed independently of the database system. If SELECT is used to access a table function or a view that contains table functions as data sources but the current database system does not support them, an uncatchable exception of the class CX_SY_SQL_UNSUPPORTED_FEATURE is raised.
  • In an ABAP program, it is possible to use the method USE_FEATURES of the class CL_ABAP_DBFEATURES to check whether the current database system supports table functions. This requires the constant AMDP_TABLE_FUNCTION of the class to be passed to the method in an internal table.
  • The DDL source code of a CDS table function does not need to have the same name as the CDS table function, but it is advisable to use the name of the CDS table function.
  • After a piece of DDL source code is transported, the combination of its name and the name of the CDS table function view is defined and can no longer be modified by being renamed.
  • No ABAP Dictionary DDIC structure visible in the tools for structures is created for a CDS table function.

Example

The following DDL source code shows a client-dependent CDS table function. It contains an input parameter (with the annotation @Environment.systemField and the predefined value #CLIENT) for the client, which is implicitly supplied with the ID of the current client when used as a data source of the statement SELECT. For more information about how to use this function, see the executable example for AMDP Functions.






PERFORM Short Reference   ROGBILLS - Synchronize billing plans  
This documentation is copyright by SAP AG.

Length: 9436 Date: 20240424 Time: 023344     sap01-206 ( 117 ms )