Skip to main content
skill CX Codex

sap-fiori-add-visual-filter · cline — Claude Code skill: filters and install

This skill configures chart-based filters in SAP Fiori Elements for OData V4. Use it when adding a visual filter to a filter bar or value help dialog.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add cline/skills --skill sap-fiori-add-visual-filter -a claude-code
Open on GitHub

What sap-fiori-add-visual-filter does

The skill sets up the annotations and configuration behind a visual filter. For CAP, it defines aggregation and uses DynamicMeasures; for ABAP RAP, it uses Measures and puts aggregation in backend CDS. Both setups connect a chart, presentation variant, value list, and filter field through the manifest.

Before making changes, the agent must collect five details: the entity, dimension field, numeric measure, aggregation method (sum, avg, min, or max), and chart type (Bar or Line). It should ask for anything missing first. RAP metadata is read-only, so backend CDS configuration is required; CAP and RAP also define measures differently.

What it helps with

  • add a chart-based filter to a SAP Fiori Elements filter bar
  • configure a visual filter in a value help dialog
  • define field aggregation in CAP CDS
  • connect a filter field to its chart in the manifest

Example prompts for the agent

  • Add a visual filter for Category on the Products entity; sum Amount and use a Bar chart.
  • Configure a Status filter for Orders, averaging TotalPrice with a Line chart.
  • For ABAP RAP, add a visual filter on Category using Amount as the measure and configure it in the manifest.

How to install sap-fiori-add-visual-filter

1Skills CLI (Vercel)

npx skills add cline/skills --skill sap-fiori-add-visual-filter -a claude-code

2Manually: put the files in place

~/.claude/skills/sap-fiori-add-visual-filter/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/sap-fiori-add-visual-filter/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about sap-fiori-add-visual-filter

How do I install sap-fiori-add-visual-filter in Claude Code?

Run npx skills add cline/skills --skill sap-fiori-add-visual-filter -a claude-code. The skill file is at ~/.claude/skills/sap-fiori-add-visual-filter/SKILL.md.

What does sap-fiori-add-visual-filter do?

It helps configure Bar or Line chart filters for SAP Fiori Elements. Its setup differs for CAP and ABAP RAP.

What details does the agent need before configuring a filter?

Provide the entity, dimension field, numeric measure, aggregation method, and chart type. For RAP, backend CDS must provide the aggregation because its metadata is read-only.

Source text

SKILL.md · Apache-2.0
---
name: sap-fiori-add-visual-filter
description: Add visual filters (chart-based) to SAP Fiori Elements filter bar/value help using CAP or ABAP RAP.
argument-hint: field name (e.g., Category, Status)
metadata:
  author: sap-fiori-tools
  version: "0.0.4"
---

# SAP Fiori Visual Filter

## Purpose
Add **chart-based filters (Bar/Line)** to filter bar or value help dialog (OData V4).

---

## MANDATORY: Gather Required Inputs First

**STOP and ASK the user for ALL of these inputs if ANY are missing from the prompt:**

1. **Entity** - Which entity to add the visual filter to
2. **Dimension field** - The field to filter by (e.g., Category, Status, Destination)
3. **Measure field** - The numeric field to aggregate (e.g., Amount, TotalPrice, ReservationPrice)
4. **Aggregation method** - How to aggregate: sum, avg, min, or max
5. **Chart type** - Bar or Line (recommend Bar as default)

**DO NOT proceed with implementation until all inputs are confirmed.**

---

## CAP Implementation


### Enable Aggregation (MANDATORY)
```cds
@Aggregation.ApplySupported: {
  Transformations: ['aggregate','groupby'],
  AggregatableProperties: [{ Property: Amount }],
  GroupableProperties: [Category]
}
```

### Aggregated Property (Measure)
```cds
Analytics.AggregatedProperty #Amount_sum : {
  $Type: 'Analytics.AggregatedPropertyType',
  Name: 'Amount_sum',
  AggregatableProperty: Amount,
  AggregationMethod: 'sum'
}
```

### Chart Annotation
```cds
UI.Chart #visualFilter : {
  ChartType: #Bar,
  Dimensions: [Category],
  DynamicMeasures: ['@Analytics.AggregatedProperty#Amount_sum']
}
```

✅ Uses **DynamicMeasures**

### PresentationVariant
```cds
UI.PresentationVariant #visualFilter: {
  Visualizations: ['@UI.Chart#visualFilter']
}
```

### ValueList (on Dimension Field)
```cds
Category @Common.ValueList #visualFilter: {
  $Type: 'Common.ValueListType',
  CollectionPath: 'EntityName',
  Parameters: [
    { $Type: 'Common.ValueListParameterInOut', LocalDataProperty: Category, ValueListProperty: 'Category' }
  ],
  PresentationVariantQualifier: 'visualFilter'
}
```

### SelectionFields
```cds
UI.SelectionFields: [Category]
```

---

## ABAP RAP Implementation

- Aggregation.ApplySupported and Aggregation.CustomAggregate annotations must be available in metadata.xml (RAP). If not, below backend configuration is required.

### Backend CDS (MANDATORY)
```abap
@OData.applySupportedForAggregation: #FULL
define root view entity ZC_ENTITY
  provider contract analytical_query
  as projection on ZI_ENTITY
{
  key EntityID,

  @Aggregation.default: #SUM
  Amount,

  Category
}
```

### Chart Annotation
```xml
<Annotation Term="UI.Chart" Qualifier="visualFilter">
  <Record Type="UI.ChartDefinitionType">
    <PropertyValue Property="ChartType" EnumMember="UI.ChartType/Bar"/>
    <PropertyValue Property="Dimensions">
      <Collection>
        <PropertyPath>Category</PropertyPath>
      </Collection>
    </PropertyValue>
    <PropertyValue Property="Measures">
      <Collection>
        <PropertyPath>Amount</PropertyPath>
      </Collection>
    </PropertyValue>
  </Record>
</Annotation>
```

✅ Uses **Measures (not DynamicMeasures)**  
❌ Metadata is **read-only**

### PresentationVariant Annotation
```xml
<Annotation Term="UI.PresentationVariant" Qualifier="visualFilter">
  <Record Type="UI.PresentationVariantType">
    <PropertyValue Property="Visualizations">
      <Collection>
        <AnnotationPath>@UI.Chart#visualFilter</AnnotationPath>
      </Collection>
    </PropertyValue>
  </Record>
</Annotation>
```

### ValueList Annotation
```xml
<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>
```

### SelectionFields Annotation
```xml
<Annotation Term="UI.SelectionFields">
  <Collection>
    <PropertyPath>Category</PropertyPath>
  </Collection>
</Annotation>
```

---

## Manifest Configuration (REQUIRED)
```json
"@com.sap.vocabularies.UI.v1.SelectionFields": {
  "layout": "CompactVisual",
  "initialLayout": "Visual",
  "filterFields": {
    "Category": {
      "visualFilter": {
        "valueList": "com.sap.vocabularies.Common.v1.ValueList#visualFilter"
      }
    }
  }
}
```

✅ Connects filter field to visual filter chart  
✅ Sets initial layout to visual mode

---

## Testing

### CAP Projects
```bash
npm run watch-<app-name>  # e.g., npm run watch-manage-travel
# or use generic watch script if available
cds watch
```

### RAP Projects
```bash
npm run start-mock # Needs metadata refresh

npm start          # No refresh needed - fetches metadata from live backend at runtime
```
- Consult fiori mcp server if available on how to refresh metadata for sap/cloud systems in case of RAP

---

## Key Differences

- **CAP**: DynamicMeasures + AggregatedProperty defined in CDS
- **RAP**: Measures + @Aggregation.default in backend CDS only
- **CAP**: Aggregation and chart defined in same place
- **RAP**: Metadata is read-only, must be configured in backend CDS.
- **Qualifier**: Must use same qualifier (#visualFilter) across Chart, ValueList, and manifest

---

## Common Mistakes

- Missing backend aggregation setup
- Qualifier mismatch between Chart, ValueList, PresentationVariant, and manifest
- Wrong path in manifest (use full vocabulary path)
- RAP projects using DynamicMeasures instead of Measures
- Forgetting PresentationVariantQualifier in ValueList
- Missing SelectionFields annotation

---

## Best Practices

- Use **Bar chart** (most common and recommended)
- Limit to 3–5 visual filters per filter bar
- Always configure backend aggregation first
- Use consistent qualifiers throughout
- Test with real data to verify aggregation works correctly

© sap-fiori-tools · Apache-2.0 · cline/skills

Similar skills

Everything for Frontend and UI →

sap-fiori-add-visual-filter by other authors comes first.

From the same set29

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor