Get Example source ABAP code based on a different SAP table
• FOR TABLE FUNCTION CLASS-METHODS ID METHODS-FOR-TABLE-FUNCTION
CLASS-METHODS>, FOR TABLE FUNCTION> Short Reference >
ABAP_SYNTAX CLASS-METHODS meth FOR TABLE FUNCTION cds_tabfunc.>
What does it do? This statement declares the static method > meth> as an AMDP function implementation> that implements a CDS table function> cds_tabfunc > as an AMDP table function>. This statement can only be specified in the public> visibility section> of an AMDP class> and not in an interface. The method must be implemented using the addition BY DATABASE FUNCTION>> of the statement METHOD>. cds_tabfunc> expects a CDS table function defined using the statement DEFINE TABLE FUNCTION>> in the ABAP CDS> CDS DDL>. This CDS entity must refer to the current class and the method meth> after the addition IMPLEMENTED BY METHOD>. No other additions are possible. The interface parameters in the AMDP function implementation are added to the CDS table function as follows:
Mandatory input parameters of the AMDP function implementation are generated from the input parameters > of the CDS table function. The names are copied, and the ABAP types are derived from the dictionary types.
A return value of the type of a standard table with an empty table key with the name result> with a structured row type is generated from the elements> of the CDS table function. The names of the components of the row type correspond to the names of the elements and the data types are derived from their dictionary types.