cancel
Showing results for 
Search instead for 
Did you mean: 

Optimizing field column widths in a Fiori Elements List Application

kchatch1
Explorer
0 Kudos

Hi Experts,

I would like to have the fields displayed in my Fiori Elements List Application optimized by PERCENTAGE as I am told you are able to do using CDS Annotation.  However, even though I have this in my CDS view entity as a percentage, it does not work in the application when it is viewed.  

Here is my CDS view entity code:

@AbapCatalog.sqlViewName: 'ZUSAGETRACKER'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@VDM.viewType: #CONSUMPTION
@OData.publish: true
@EndUserText.label: 'CDS View for Usage Tracker'

define view ZCDS_USAGE_TRACKER
with parameters

@EndUserText.label: 'Start Date and Time'
@Consumption.defaultValue: '20231210013000'
P_STMP : timestamp,

@EndUserText.label: 'End Date and Time'
@Consumption.defaultValue: '20240315233000' // find way to use formula here
P_ESTMP : timestamp

as select from zusage_tracker as a left outer join
user_addr as b on
a.zuser = b.bname

association [0..1] to ZCDS_ACTION_VH as _ActionValueHelp on $projection.action =_ActionValueHelp.action

{
@UI.hidden: true
key a.guid as guid,

@UI.hidden: true
a.zuser as ZUser,

@UI.lineItem: [{position: 1, label: 'User Name',
// cssDefault.width: '7rem'
cssDefault.width: '10%'
}]
@UI.selectionField: [ { position: 1 } ]
concat_with_space(b.name_first, b.name_last, 1) as uname,

@UI.lineItem: [{position: 18, label: 'Timestamp',
// cssDefault.width: '7rem'
cssDefault.width: '10%'
}]
cast( a.timestamp as char20 ) as TIMESTAMP,

@UI.lineItem: [{position: 22, label: 'Semantic Object',
cssDefault.width: '15%'
// cssDefault.width: '10rem'
//cssDefault.width: '15%'
}]
a.sem_obj as Object,

@UI.lineItem: [{position: 27, label: 'Action',
// cssDefault.width: '10rem'
cssDefault.width: '15%'
}]
@UI.selectionField: [ { position: 27 } ]
@Consumption.valueHelp: '_ActionValueHelp'
a.action as action,
_ActionValueHelp,

@UI.lineItem: [{position: 35, label: 'URL',
// cssDefault.width: '10rem'
cssDefault.width: '20%'
}]
a.url as URL,

@UI.lineItem: [{position: 43, label: 'Session Identification',
// cssDefault.width: '10rem'
cssDefault.width: '15%'
}]
a.session_id as SessionID,

@UI.lineItem: [{position: 48, label: 'Tile Title',
// cssDefault.width: '10rem'
cssDefault.width: '15%'
}]
@UI.selectionField: [ { position: 48 } ]
@EndUserText.label: 'Tile Title'
@Consumption.valueHelpDefinition:
[{ entity:{ element : 'app_title', name : 'ZCDS_TILE_TITLE_SH' } }]
a.app_title as App_Title

} where a.timestamp >= :P_STMP and a.timestamp <= :P_ESTMP;

That code does NOT optimize the columns (see attached).  

This is something I tried in my manifest file for the FE app (in VS Code).  This also did not work (presumably because "controlConfiguration" is in the wrong place, but I have no idea where it should go.  

"sap.ui.generic.app": {
        "_version": "1.3.0",
        "settings": {
            "forceGlobalRefresh": false,
            "objectPageHeaderType": "Dynamic",
            "considerAnalyticalParameters": true,
            "showDraftToggle": false
        },
        "pages": {
            "ListReport|ZCDS_USAGE_TRACKERSet": {
                "entitySet": "ZCDS_USAGE_TRACKERSet",
                "component": {
                    "name": "sap.suite.ui.generic.template.ListReport",
                    "list": true,
                    "settings": {
                        "condensedTableLayout": true,
                        "smartVariantManagement": true,
                        "enableTableFilterInPageVariant": true,
                        "controlConfiguration": {
                            "_Item/@com.sap.vocabularies.UI.v1.LineItem": {
                                "columns": {
                                    "DataField::Object": {
                                        "width": "2rem"
                                    }
                                }
                            }
                        },
                        "filterSettings": {
                            "dateSettings": {
                                "useDateRange": true
                            }
                        }
                    }
                },
                "pages": {
                    "ObjectPage|ZCDS_USAGE_TRACKERSet": {
                        "entitySet": "ZCDS_USAGE_TRACKERSet",
                        "defaultLayoutTypeIfExternalNavigation": "MidColumnFullScreen",
                        "component": {
                            "name": "sap.suite.ui.generic.template.ObjectPage"
                        },
                        "pages": {
                            "ObjectPage|Parameters": {
                                "navigationProperty": "Parameters",
                                "entitySet": "ZCDS_USAGE_TRACKER",
                                "defaultLayoutTypeIfExternalNavigation": "MidColumnFullScreen",
                                "component": {
                                    "name": "sap.suite.ui.generic.template.ObjectPage"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "sap.fiori": {
        "registrationIds": [],
        "archeType": "transactional"
    }
 
That did not work either.  I also tried this in my annotations file in the FE app:
<edmx:DataServices>
        <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="local">

        <Annotation Term="UI.LineItem">
    <Collection>
        <!-- Example: DataField -->
        <Record Type="UI.DataField">
            <PropertyValue Property="Value" Path="uname" />
            <Annotation Term="com.sap.vocabularies.HTML5.v1.CssDefaults">
                <Record>
                    <PropertyValue Property="width" String="2rem" />
                </Record>
            </Annotation>
        </Record>
    </Collection>
</Annotation>

        </Schema>
    </edmx:DataServices>
 
It also had no effect.  Not sure why the column widths are unaffected.  Mostly puzzled why the percentages don't work and half the columns are hidden based on the CDS view entries.  Only 5 of the 7 columns are visible, even though I have each column taking up at least 10%.  
 
Thanks,
Kevin
 
 
 

Accepted Solutions (0)

Answers (0)