Skip to Content
0
Dec 28, 2019 at 11:16 AM

CDS associations on existing non-hdi tables

270 Views

Hello Experts,

I am working on the XSA express and manage to bring in non-hdi schema tables using cds ( used cds.persistence ). I also manage to expose the table data to be consumed by sapui5 with the odata v4 service.

Currently, I want to create associations to two existing tables in my cds. I manage to build the CDS without any errors but when i try to build the db i am getting errors.

Following is the errors i am getting.

Merged from "src/gen/CATALOGSERVICE_EKKO.hdbcds"
Error: com.sap.hana.di.cds: Sub artifact "ITEMS_MANDT" not found in "BHT_EKKO" [1310040]
at "src/gen/CATALOGSERVICE_EKKO.hdbcds" (22:12-23)
Error: com.sap.hana.di.cds: Sub artifact "ITEMS_EBELN" not found in "BHT_EKKO" [1310040]
at "src/gen/CATALOGSERVICE_EKKO.hdbcds" (23:12-23)
Error: com.sap.hana.di.cds: Sub artifact "ITEMS_EBELP" not found in "BHT_EKKO" [1310040]
at "src/gen/CATALOGSERVICE_EKKO.hdbcds" (24:12-23)

The two tables i am trying to link with association is EKKO and EKPO. Standard header - item tables. The code is as follows.

@cds.persistence.exists 
Entity EKKO {
 	key MANDT: String(3); 
	key EBELN: String(20);
	ITEMS: association to EKPO; 
	BUKRS: String(8); 
	BSTYP: String(2); 
}
@cds.persistence.exists 
Entity EKPO {
 	key MANDT: String(3); 
	key EBELN: String(20);
	HEADER : Association[*] to EKKO on HEADER.EBELN = EBELN; 
	key EBELP: String(10);
	LOEKZ: String(2); 
	STATU: String(2); 
	AEDAT: String(16); 
}

Is this even possible for existing tables or should I do the associations at the catalog service in odata.

Thanks.

Anand