Skip to Content
0
Mar 10 at 04:14 PM

How to create cds entity with Association to table function with input parameter

244 Views Last edit Mar 11 at 07:01 AM 8 rev

I am referring to URL:

https://cap.cloud.sap/docs/advanced/hana

Please get back to me on the following feedback:

Hello

I have table function with input parameter. Entity which represent this table function is define like

namespace cii.persistence;
@cds.persistence.exists
@cds.persistence.udf
entity Test_Hierarchy_Function(in_email: String) {
key nodeID: Integer;
superParent: Integer;
hierarchyLevel: Integer;
parentNodeID: Integer;
description: String;
drillState: String;
interest: String;
score: Integer;
email: String;
}

And I have another CDS view like

namespace cii.persistence;
using {cii.persistence as cii} from '.';
@cds.persistence.exists
entity Profile_Admin_View {
customer_id: Integer64;
key email: String(255);
customer: Association to one cii.Customer_With_Consent on customer.customer_id = customer_id;
consent_status: String;
is_legitimate: Boolean @Consumption.filter:{ mandatory:true };
interest_1: String;
interest_2: String;
interest_3: String;
interest_4: String;
interest_5: String;
criticality_1: Integer;
criticality_2: Integer;
criticality_3: Integer;
criticality_4: Integer;
criticality_5: Integer;
//table_function: Association to many cii.Test_Hierarchy_Function(in_email = $projection.email);
}

And I want to add Association to my table function and somehow pass input parameter (value of 'email' field).

But I don't have any idea how it can me done. And CAP documentation also doesn't explain how to reach this.

Please help me