cancel
Showing results for 
Search instead for 
Did you mean: 

Sap Fiori Element Composition of one issues when using 3 levels hierarchy

tatiana_fetecua
Explorer
0 Kudos

Hi CAP/Fiori Elements experts.

I am working on one application that is using several levels of hierarchy. please see the schema below:

entity groups:cuid{  
  groupID : String;
  description: String;
  versions : Composition of many GroupVersion on versions.groupID = $self ;
}

entity GroupVersion:cuid{
  groupID : Association to groups;   
  limitsGroupVersion: Composition of one LimitsGroupVersion on limitsGroupVersion.groupVersionID = $self;
}

entity LimitsGroupVersion:cuid{  
  groupVersionID : Association to GroupVersion;
  value1: Integer;
  value2: Integer;
  dimensionLimit: Composition of many MachineDimensionLimits on dimensionLimit.limitGroupVersion = $self;
}

entity MachineDimensionLimits{
  limitGroupVersion: Association to  LimitsGroupVersion;
  limitType: Association to LimitTypes;
  min: Integer;
  max: Integer;
  unit: String(3);
}

 

When trying to create a fiori element list report application in the group version object page I can add the data from the composition entity limitsGroupVersion(groupVersionID,value1,value2) but I cannot add the data related to the dimensionLimit (that is a composition to many relation). It seems I cannot added because it does not directly belong to the GroupVersion Entity and fiori does not recognize it from the composition to one definition.

Screenshot 2024-04-03 at 12.44.13 PM.png

 the example application can be found here

what could be done in Fiori Elements to be able to maintain this grand-grandchild entities when using several hierarchy levels and composition to one?

Thanks,

Tatiana F

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Dinu
Contributor
0 Kudos

could it be because MachineDimensionLimits does not have a key?

try changing the definition to

entity MachineDimensionLimits:cuid{
  limitGroupVersion: Association to  LimitsGroupVersion;
  limitType: Association to LimitTypes;
  min: Integer;
  max: Integer;
  unit: String(3);
}
Ajit_K_Panda
Product and Topic Expert
Product and Topic Expert

Ideally i am not sure why you need GroupVersion entity. That is the reason, pagemap can not help. However, you can still add following annotations manually in annotations.cds :

annotate service.MachineDimensionLimits with @(
    UI.LineItem #dimensionLimit : [
        {
            $Type : 'UI.DataField',
            Value : limitType.description,
            Label : 'Limit Type',
        },{
            $Type : 'UI.DataField',
            Value : min,
            Label : 'Min',
        },{
            $Type : 'UI.DataField',
            Value : max,
            Label : 'Max',
        },{
            $Type : 'UI.DataField',
            Value : unit,
            Label : 'Unit',
        },]
);

annotate service.GroupVersion with @(
    UI.Facets : [
        {
            $Type : 'UI.ReferenceFacet',
            Label : 'General Version',
            ID : 'GeneralVersion',
            Target : '@UI.FieldGroup#GeneralVersion',
        },
        {
            $Type : 'UI.ReferenceFacet',
            Target : 'limitsGroupVersion/dimensionLimit/@UI.LineItem#dimensionLimit',
            Label : 'Dimension Limits',
            ID : 'DimensionLimits',
        }
    ],
    UI.FieldGroup #GeneralVersion : {
        $Type : 'UI.FieldGroupType',
        Data : [
            {
                $Type : 'UI.DataField',
                Value : limitsGroupVersion.value1,
                Label : 'value1',
            },
            {
                $Type : 'UI.DataField',
                Value : limitsGroupVersion.value2,
                Label : 'value2',
            }
        ],
    }
);
Dinu
Contributor
0 Kudos

True. The issue in Fiori Tools is not because of missing key for MachineDimensionLimits. Tools is expecting a to-many association at the node itself. But, missing key will be a problem at runtime. Even when this key is added, one lands up in another issue in CAP; creation at path involving to-one composite associations is currently problematic. So, currently working scenario is when the to-one association limitsGroupVersion is merged like Ajit suggests.

tatiana_fetecua
Explorer
0 Kudos

Thank you so much @Ajit_K_Panda I added the annotation manually using the target in this way, I was not aware of accessing the grandchild like this ''limitsGroupVersion/dimensionLimit' and it worked, I am still using the composition of one and it seems to be working without any issue(I know in this example Group Version is not really need it, but the business case it is more complex and using something like this could make more sense) , I was able to create and save the grand child (dimension limit entity under the limitsGroupVersion) entity. However I see the problem that @Dinu mentioned at creation I am not able to save the information of of the one composition entity. 

Answers (1)

Answers (1)

Ajit_K_Panda
Product and Topic Expert
Product and Topic Expert
0 Kudos

Ideally i am not sure why you need GroupVersion entity. That is the reason, pagemap can not help. However, you can still add following annotations manually in annotations.cds :

 

annotate service.MachineDimensionLimits with @(
    UI.LineItem #dimensionLimit : [
        {
            $Type : 'UI.DataField',
            Value : limitType.description,
            Label : 'Limit Type',
        },{
            $Type : 'UI.DataField',
            Value : min,
            Label : 'Min',
        },{
            $Type : 'UI.DataField',
            Value : max,
            Label : 'Max',
        },{
            $Type : 'UI.DataField',
            Value : unit,
            Label : 'Unit',
        },]
);

annotate service.GroupVersion with @(
    UI.Facets : [
        {
            $Type : 'UI.ReferenceFacet',
            Label : 'General Version',
            ID : 'GeneralVersion',
            Target : '@UI.FieldGroup#GeneralVersion',
        },
        {
            $Type : 'UI.ReferenceFacet',
            Target : 'limitsGroupVersion/dimensionLimit/@UI.LineItem#dimensionLimit',
            Label : 'Dimension Limits',
            ID : 'DimensionLimits',
        }
    ],
    UI.FieldGroup #GeneralVersion : {
        $Type : 'UI.FieldGroupType',
        Data : [
            {
                $Type : 'UI.DataField',
                Value : limitsGroupVersion.value1,
                Label : 'value1',
            },
            {
                $Type : 'UI.DataField',
                Value : limitsGroupVersion.value2,
                Label : 'value2',
            }
        ],
    }
);