SAP Fiori Elements のフィルターバー(絞り込み条件の入力欄)や値ヘルプ(データ選択画面)に、グラフを使った視覚的フィルター(見た目でわかりやすい絞り込み機能)を追加する機能です。 CAP(クラウドアプリケーションプログラミング・モデル)または ABAP RAP(新しいアプリケーション開発の枠組み)を使って実装できます。
Add visual filters (chart-based) to SAP Fiori Elements filter bar/value help using CAP or ABAP RAP.
フィルターバーまたは値ヘルプダイアログ(OData V4)に、チャートベースのフィルター(Bar / Line) を追加します。
以下の情報がプロンプトに一つでも不足している場合は、必ず一時停止してユーザーに確認してください:
すべての入力情報が確認できるまで、実装を進めないでください。
@Aggregation.ApplySupported: {
Transformations: ['aggregate','groupby'],
AggregatableProperties: [{ Property: Amount }],
GroupableProperties: [Category]
}
Analytics.AggregatedProperty #Amount_sum : {
$Type: 'Analytics.AggregatedPropertyType',
Name: 'Amount_sum',
AggregatableProperty: Amount,
AggregationMethod: 'sum'
}
UI.Chart #visualFilter : {
ChartType: #Bar,
Dimensions: [Category],
DynamicMeasures: ['@Analytics.AggregatedProperty#Amount_sum']
}
✅ DynamicMeasures を使用
UI.PresentationVariant #visualFilter: {
Visualizations: ['@UI.Chart#visualFilter']
}
Category @Common.ValueList #visualFilter: {
$Type: 'Common.ValueListType',
CollectionPath: 'EntityName',
Parameters: [
{ $Type: 'Common.ValueListParameterInOut', LocalDataProperty: Category, ValueListProperty: 'Category' }
],
PresentationVariantQualifier: 'visualFilter'
}
UI.SelectionFields: [Category]
下記「Manifest 設定」セクションを参照してください。
@OData.applySupportedForAggregation: #FULL
define root view entity ZC_ENTITY
provider contract TRANSACTIONAL_QUERY
as projection on ZR_ENTITY
{
@Aggregation.default: #SUM
Amount;
Category;
}
@UI.chart: [{
qualifier: 'visualFilter',
chartType: #BAR,
dimensions: ['Category'],
measures: ['Amount']
}]
@UI.presentationVariant: [{
qualifier: 'visualFilter',
visualizations: [{
type: #AS_CHART,
qualifier: 'visualFilter'
}]
}]
annotate view ZC_ENTITY with
{
@UI.selectionField: [{ position: 10 }]
Category;
@EndUserText.label: 'Amount'
Amount;
}
チャートアノテーション:
<Annotations Target="EntityType/Category">
<Annotation Term="Common.ValueList" Qualifier="visualFilter">
<Record Type="Common.ValueListType">
<PropertyValue Property="CollectionPath" String="EntityName"/>
<PropertyValue Property="PresentationVariantQualifier" String="visualFilter"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="Category"/>
<PropertyValue Property="ValueListProperty" String="Category"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
下記「Manifest 設定」セクションを参照してください。
"@com.sap.vocabularies.UI.v1.SelectionFields": {
"layout": "CompactVisual",
"initialLayout": "Visual",
"filterFields": {
"Category": {
"visualFilter": {
"valueList": "com.sap.vocabularies.Common.v1.ValueList#visualFilter"
}
}
}
}
settings プロパティの内部に visualFilter をネストしないでください!
npm run watch-<app-name> # 例: npm run watch-manage-travel
# または汎用 watch スクリプトが利用可能な場合
cds watch
npm run start-mock # メタデータのリフレッシュが必要
npm start # リフレッシュ不要 — 実行時にライブバックエンドからメタデータを取得
CAP:
RAP:
RAP 固有:
@Consumption.valueHelpDefinition を使用しようとしている
(これは値ヘルプダイアログ用であり、ビジュアルフィルターには使用不可)layout: "CompactVisual" および initialLayout: "Visual" を含めるRAP 固有:
.ddlx.acds)Add chart-based filters (Bar/Line) to filter bar or value help dialog (OData V4).
STOP and ASK the user for ALL of these inputs if ANY are missing from the prompt:
DO NOT proceed with implementation until all inputs are confirmed.
@Aggregation.ApplySupported: {
Transformations: ['aggregate','groupby'],
AggregatableProperties: [{ Property: Amount }],
GroupableProperties: [Category]
}
Analytics.AggregatedProperty #Amount_sum : {
$Type: 'Analytics.AggregatedPropertyType',
Name: 'Amount_sum',
AggregatableProperty: Amount,
AggregationMethod: 'sum'
}
UI.Chart #visualFilter : {
ChartType: #Bar,
Dimensions: [Category],
DynamicMeasures: ['@Analytics.AggregatedProperty#Amount_sum']
}
✅ Uses DynamicMeasures
UI.PresentationVariant #visualFilter: {
Visualizations: ['@UI.Chart#visualFilter']
}
Category @Common.ValueList #visualFilter: {
$Type: 'Common.ValueListType',
CollectionPath: 'EntityName',
Parameters: [
{ $Type: 'Common.ValueListParameterInOut', LocalDataProperty: Category, ValueListProperty: 'Category' }
],
PresentationVariantQualifier: 'visualFilter'
}
UI.SelectionFields: [Category]
refer to the "Manifest Configuration" section below.
@OData.applySupportedForAggregation: #FULL
define root view entity ZC_ENTITY
provider contract TRANSACTIONAL_QUERY
as projection on ZR_ENTITY
{
@Aggregation.default: #SUM
Amount;
Category;
}
@UI.chart: [{
qualifier: 'visualFilter',
chartType: #BAR,
dimensions: ['Category'],
measures: ['Amount']
}]
@UI.presentationVariant: [{
qualifier: 'visualFilter',
visualizations: [{
type: #AS_CHART,
qualifier: 'visualFilter'
}]
}]
annotate view ZC_ENTITY with
{
@UI.selectionField: [{ position: 10 }]
Category;
@EndUserText.label: 'Amount'
Amount;
}
Chart Annotation:
<Annotations Target="EntityType/Category">
<Annotation Term="Common.ValueList" Qualifier="visualFilter">
<Record Type="Common.ValueListType">
<PropertyValue Property="CollectionPath" String="EntityName"/>
<PropertyValue Property="PresentationVariantQualifier" String="visualFilter"/>
<PropertyValue Property="Parameters">
<Collection>
<Record Type="Common.ValueListParameterInOut">
<PropertyValue Property="LocalDataProperty" PropertyPath="Category"/>
<PropertyValue Property="ValueListProperty" String="Category"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
refer to the "Manifest Configuration" section below.
"@com.sap.vocabularies.UI.v1.SelectionFields": {
"layout": "CompactVisual",
"initialLayout": "Visual",
"filterFields": {
"Category": {
"visualFilter": {
"valueList": "com.sap.vocabularies.Common.v1.ValueList#visualFilter"
}
}
}
}
NEVER nest visualFilter inside a settings property!
npm run watch-<app-name> # e.g., npm run watch-manage-travel
# or use generic watch script if available
cds watch
npm run start-mock # Needs metadata refresh
npm start # No refresh needed - fetches metadata from live backend at runtime
CAP:
RAP:
RAP:
RAP Specific:
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。