Skip to Content
0
Jul 26, 2022 at 01:58 PM

'managed' aspect adding createdBy_user, modifiedBy_user columns in SAP CAPM framework

347 Views

mtayaml.txt

packagejson.txt

Hello .

I have a simple CDS structure like below.

namespace com.atom.app; 
using {managed ,Currency , temporal } from '@sap/cds/common'; 
entity Product { 
key productId   : Integer; 
productType : Integer; 
name        : String(30); 
description : String(100); 
basePrice   : Decimal(10, 3); 
currency    : Currency ; 
ItsProductType : Association to one ProductType on ItsProductType.productTypeId = $self.productType; 
}; 

entity ProductType : managed { 
key productTypeId : Integer; 
name          : String(20); 
description   : String(100); 
ItsProducts   : Association to many Product on ItsProducts.productType = $self.productTypeId;
 };

if you look at the ProductType entity , I am using managed aspect. I am deploying this structure to HANA Express edition XSA ( virtual machine ). Corresponding hdbcds has the below fields

using COM_ATOM_APP_PRODUCT as COM_ATOM_APP_PRODUCT;
entity COM_ATOM_APP_PRODUCTTYPE {
  CREATEDAT : UTCTimestamp;
  CREATEDBY : String(255);
  MODIFIEDAT : UTCTimestamp;
  MODIFIEDBY : String(255);
  key PRODUCTTYPEID : Integer;
  NAME : String(20);
  DESCRIPTION : String(100);
  ITSPRODUCTS : association[*] to COM_ATOM_APP_PRODUCT on ITSPRODUCTS.PRODUCTTYPE = PRODUCTTYPEID;
};

But, when I am trying to post a record against this entity set , it throws an error message saying " "message": "invalid column name: CREATEDBY_USER"

Backend logs :

ERR query: 'INSERT INTO com_atom_app_ProductType ( productTypeId, name, description, createdAt, createdBy_user, modifiedAt, modifiedBy_user, createdBy, modifiedBy ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )

Why is the framework expecting the table to have createdBy_user & modifiedBy_user ? Is it anything to do with the version of npm packages I am using ?

error is thrown from my VS code ( when I run CDS watch ) and from XSA as well after deployment.

attached mta.yaml and package.json of my CDS project

Attachments

mtayaml.txt (1.4 kB)
packagejson.txt (1.1 kB)