cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Fiori Elements problem with CAP hierarchical entity

martinstenzig
Contributor
1,583

Using the Github Repo SAP-samples/cloud-cap-samples as template I wanted to create a new entity with the following format.

entity PlanningEntities: managed{
 key entity_id : Integer;
 entity_name : String(255);
 description: String(1000);
 parent : Association to PlanningEntities;
 children : Composition of many PlanningEntities on children.parent = $self;
}

As soon as I use the Fiori components to create or edit an entity, I run into problems.

Creation of an entity does not store the parent id reference to the database.

Initiating the edit, blows it sky high... see below.

Does anybody have experience with using a parent child relationship in one entity and/or can recommend a solution?

POST /admin/$batch
> READ PlanningEntities {
  '$count': 'true',
  '$expand': 'DraftAdministrativeData($select=DraftUUID,InProcessByUser,LastChangedByUser),parent($select=IsActiveEntity,entity_id)',
  '$filter': '(IsActiveEntity eq false or SiblingEntity/IsActiveEntity eq null)',
  '$select': 'HasActiveEntity,HasDraftEntity,IsActiveEntity,entity_id,entity_name',
  '$skip': '0',
  '$top': '30'
}
POST /admin/$batch
> READ PlanningEntities(entity_id=11,IsActiveEntity=true) {
  '$select': 'HasDraftEntity,IsActiveEntity,createdAt,createdBy,description,entity_id,entity_name,modifiedAt,modifiedBy',
  '$expand': 'DraftAdministrativeData($select=DraftUUID,InProcessByUser),parent($select=IsActiveEntity,entity_id,entity_name)'
}
POST /admin/$batch
> EDIT PlanningEntities(entity_id=11,IsActiveEntity=true)/AdminService.draftEdit null
[2020-05-14T22:16:46.725Z | ERROR | 1991765]: Maximum call stack size exceeded
[INTERNAL ERROR] RangeError: Maximum call stack size exceeded
    at Select.where (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\statements\Where.js:45:17)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:69:16)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
    at _generateSubCQNs (C:\_projects\RizInno\unit-base\node_modules\@sap\cds-runtime\lib\cds-services\services\utils\draftUtils.js:76:9)
Please report this error.

Accepted Solutions (1)

Accepted Solutions (1)

vansyckel
Product and Topic Expert
Product and Topic Expert

Hi martin.stenzig3,

This is a known bug in the current release. The fix will be included in the next release.

Best,
Sebastian

Answers (0)