I try to create an AMDP method that returns a single field that would be SNWD_COMPANY_NAME on the ABAP side. The documentation says only table types and elementary types can be returned.
SNWD_COMPANY_NAME is not elementary, it is CHAR 80, but I don't want to return the whole 19 field of SNWD_BPA, and the elementary type C
has a length of only 1.
How can I return a single row, single field of a table?
Could you please check following AMDP code?
class zcl_kodyaz_amdp_test definition
public
final
create public .
public section.
INTERFACES if_amdp_marker_hdb.
class-methods read_company_name
importing value(node_key) type SNWD_NODE_KEY
exporting value(company_name) type SNWD_COMPANY_NAME
raising cx_amdp_error.
protected section.
private section.
endclass.
class zcl_ey_amdp_test implementation.
method read_company_name
by database procedure
for hdb language sqlscript
options read-only
using SNWD_BPA.
select COMPANY_NAME into "COMPANY_NAME" from SNWD_BPA where NODE_KEY = :node_key;
endmethod.
endclass.