UI5 スマートコントロール(sap.ui.comp)の OData V2 アノテーション(メタデータに付与する注記)駆動型コントロールのベストプラクティスです。 **次のような場合に使用:** SmartField、SmartForm、SmartFilterBar、SmartChart、SmartLink、SmartMultiInput、SmartTable の作成やトラブルシューティング時 **カバー範囲:** - コントロール選択 - アノテーション(ValueList、FieldControl、SemanticObject、UI.LineItem、UI.Chart) - 必須ルール - 一般的なエラーと対処法 - コントロール別 API リファレンス **トリガーキーワード:** SmartField、SmartForm、SmartFilterBar、SmartChart、SmartLink、SmartMultiInput、sap.ui.comp、スマートコントロール アノテーション、OData V2 メタデータ駆動、値ヘルプ アノテーション、ValueList アノテーション、フィールドコントロール アノテーション、セマンティックオブジェクト ナビゲーション **キーワード:** sap.ui.comp、SmartField、SmartForm、SmartFilterBar、SmartChart、SmartLink、SmartMultiInput、SmartTable、ValueHelpDialog、OData V2、アノテーション、ValueList、FieldControl、SemanticObject、entitySet、ControlConfiguration、GroupConfiguration、textArrangement、FilterProvider、initialise、beforeRebindChart、navigationTargetsObtained
UI5 smart controls (sap.ui.comp) best practices for OData V2 annotation-driven controls. Use when creating/troubleshooting SmartField, SmartForm, SmartFilterBar, SmartChart, SmartLink, SmartMultiInput, or SmartTable. Covers control selection, annotations (ValueList, FieldControl, SemanticObject, UI.LineItem, UI.Chart), mandatory rules, common errors, and per-control API reference. Triggers: "SmartField", "SmartForm", "SmartFilterBar", "SmartChart", "SmartLink", "SmartMultiInput", "sap.ui.comp", "smart control annotations", "OData V2 metadata-driven", "value help annotations", "ValueList annotation", "field control annotation", "semantic object navigation". Keywords: sap.ui.comp, SmartField, SmartForm, SmartFilterBar, SmartChart, SmartLink, SmartMultiInput, SmartTable, ValueHelpDialog, OData V2, annotations, ValueList, FieldControl, SemanticObject, entitySet, ControlConfiguration, GroupConfiguration, textArrangement, FilterProvider, initialise, beforeRebindChart, navigationTargetsObtained
OData V2 サービスを使用するフリースタイルアプリケーションで、UI5 スマートコントロール(自動生成・調整機能を備えたコンポーネント)のコードを生成、レビュー、トラブルシューティングする際に、以下のガイドラインを適用してください。
UI5 バージョン基準: SAPUI5 1.136+ LTS。記載がない限り、このバージョン以上で紹介されたすべての機能が利用できます。
| トリガー(きっかけ) | 読み込むドキュメント |
|---|---|
sap.ui.comp.smartfield.SmartField に取り組む、または計画する |
references/smart-field.md |
sap.ui.comp.smartform.SmartForm に取り組む、または計画する |
references/smart-form.md |
sap.ui.comp.smartfilterbar.SmartFilterBar に取り組む、または計画する |
references/smart-filter-bar.md |
sap.ui.comp.smartchart.SmartChart に取り組む、または計画する |
references/smart-chart.md |
sap.ui.comp.navpopover.SmartLink に取り組む、または計画する |
references/smart-link.md |
sap.ui.comp.smartmultiinput.SmartMultiInput に取り組む、または計画する |
references/smart-multi-input.md |
sap.ui.comp.filterbar.FilterBar に取り組む、または計画する |
references/filter-bar.md |
sap.ui.comp.valuehelpdialog.ValueHelpDialog に取り組む、または計画する |
references/value-help-dialog.md |
出力を作成する前に必ず読み込んでください。記憶に頼らないでください。
entitySet を指定するか、エンティティタイプを解決するバインディングコンテキストを継承するコントロールを配置してください。ControlConfiguration を使用してください(コントロール型、フィルタ型、インデックスを指定)。実行時に変更できるのは visible、label、visibleInAdvancedArea のみです。getInnerControl()、getChart())にアクセスする前に、initialise イベントを待機してください。sap.ui.model.odata.type.* 型を使用してください。OData V2 で sap.ui.model.type.* は使用しないでください。ariaLabelledBy を設定し、表示されているタイトルを参照してアクセシビリティを確保してください。check() を使用して、クライアント側の必須フィールド検証を実行してください。get_api_reference MCP ツール(API リファレンス取得ツール)でコントロール API を確認してください。run_ui5_linter でコードを検証してください。sap.ui.mdc)を使用してください。value プロパティにカスタムフォーマッターを設定しないでください。SmartField はメタデータに基づいて独自のレンダリングを管理します。アノテーション(メタデータの補足情報)を使用して動作に影響を与えてください。parts: [...])を使用しないでください。SmartField は単位・通貨フィールドの複合バインディングを独自に管理します。getChart() を同期的に呼び出さないでください。initialise イベントまたは getChartAsync() を使用してください。sap.chart.Chart)を直接変更しないでください。スマートコントロールの公開 API を使用してください。sap:label または @Common.Label アノテーションを使用してください。sap.ui.comp.smartfield.SmartField)を使用しないでください。sap.ui.define または ES6 インポートを使用してください。| コントロール | 次のような場合に使用 | 次のような場合は使用しない |
|---|---|---|
SmartField |
OData V2、単一プロパティの表示/編集、Edm 型とアノテーションに基づく自動レンダリング | OData V4、JSON モデル、カスタムレンダリング必須、複合/複数プロパティフィールド |
SmartForm |
OData V2、複数の SmartField を含むエンティティ編集、アノテーションからの自動ラベル | OData V4、複雑なカスタムレイアウト、非 OData データ |
SmartFilterBar |
OData V2、アノテーション駆動(メタデータに基づくフィルタUI、SmartTable/SmartChart との統合) | OData V4(MDC FilterBar を使用)、JSON のみ、純粋にカスタムなフィルタロジック |
SmartChart |
OData V2、アノテーション駆動のチャート表示、ドリルダウン、バリアント(表示設定)管理 | OData V4(MDC Chart を使用)、分析データでない、カスタムチャート JavaScript |
SmartLink |
OData V2、セマンティックオブジェクト(意味的な業務概念)ナビゲーション、FLP(ファイアフライプラットフォーム)経由のクロスアプリナビゲーション | OData V4(MDC Link を使用)、単純な静的リンク、FLP が利用不可 |
SmartMultiInput |
OData V2、トークン(複数値を表すタグ)による複数値入力、範囲を含む値のヘルプ | OData V4、単純な単一値入力、JSON のみ |
FilterBar |
OData アノテーションなしの手動フィルタ UI、ValueHelpDialog 内での使用、カスタムフィルタ | OData V2 でアノテーションあり(SmartFilterBar を使用)、OData V4(MDC FilterBar を使用) |
ValueHelpDialog |
テーブルと条件タブを含む複雑な値選択、トークンベースの複数選択 | 単純なドロップダウン、単一値選択、OData V4(MDC ValueHelp を使用) |
| 症状 | 原因 | 対処法 |
|---|---|---|
| SmartField が編集モードでプレーンテキストとしてレンダリングされる | バインディングコンテキストが不足しているか、entitySet が誤っている |
value="{PropertyName}" を確認し、エンティティコンテキストの解決を確認してください。 |
| SmartField が DatePicker の代わりに Input を表示する | OData メタデータのプロパティに sap:display-format="Date" アノテーションがない |
アノテーションを追加するか、ControlConfiguration で controlType を使用してください。 |
| SmartForm のラベルが表示されない | OData メタデータに sap:label アノテーションが設定されていない |
プロパティに sap:label を追加するか、GroupElement に label を設定してください。 |
| SmartFilterBar のタイプアヘッド(入力候補表示)が機能しない | ValueList アノテーションが不足しているか、ターゲットパスが誤っている | ターゲットが正しいか確認してください:{Namespace}.{EntityName}/{FieldName} |
| SmartFilterBar のデフォルト値が無視される | ControlConfiguration を initialise イベント後に動的に設定している |
値を XML で静的に設定するか、setFilterData() API を使用してください。 |
| SmartChart の高さが 0 / 表示されない | コンテナが明示的な高さを指定していない | 親コンテナに高さを設定してください(例:height="50vh")。 |
| SmartChart にディメンション/メジャー(分析データの軸と値)が不足している | UI.Chart アノテーションが誤っているか、不足している |
アノテーションの MeasureAttributes と DimensionAttributes を確認してください。 |
| SmartLink ポップオーバーが「利用可能なコンテンツがありません」と表示される | FLP でセマンティックオブジェクトのナビゲーションターゲットが設定されていない | FLP の設定とユーザー権限を確認してください。 |
| SmartLink がテキストとしてレンダリングされている(クリッカブルでない) | プロパティに SemanticObject アノテーションがない |
OData プロパティに @Common.SemanticObject アノテーションを追加してください。 |
| SmartMultiInput のトークンが保存されない | ValueList アノテーションが不足しているか、バインディングが誤っている | ValueList アノテーションとナビゲーションプロパティバインディングを確認してください。 |
liveMode="true" を使用して、バックエンド負荷の大きいクエリを実行しないでください(急速な再フェッチが発生します)。ignoredChartTypes を設定してください(不要な UI オプションが表示されません)。ariaLabelledBy を設定し、表示されているタイトルを参照してください。ariaLabelledBy を設定し、表示されているタイトルを参照してください。Apply these guidelines whenever generating, reviewing, or troubleshooting UI5 smart control code in freestyle applications using OData V2 services.
UI5 version baseline: SAPUI5 1.136+ LTS. All features mentioned are available from this version unless noted.
| Trigger | Load |
|---|---|
Working on or planning a sap.ui.comp.smartfield.SmartField |
references/smart-field.md |
Working on or planning a sap.ui.comp.smartform.SmartForm |
references/smart-form.md |
Working on or planning a sap.ui.comp.smartfilterbar.SmartFilterBar |
references/smart-filter-bar.md |
Working on or planning a sap.ui.comp.smartchart.SmartChart |
references/smart-chart.md |
Working on or planning a sap.ui.comp.navpopover.SmartLink |
references/smart-link.md |
Working on or planning a sap.ui.comp.smartmultiinput.SmartMultiInput |
references/smart-multi-input.md |
Working on or planning a sap.ui.comp.filterbar.FilterBar |
references/filter-bar.md |
Working on or planning a sap.ui.comp.valuehelpdialog.ValueHelpDialog |
references/value-help-dialog.md |
Load before producing any output. Do not work from memory.
entitySet on Smart controls or ensure the control inherits a binding context that resolves the entity type.ControlConfiguration in XML for SmartFilterBar field overrides (control type, filter type, index). Only visible, label, and visibleInAdvancedArea can be changed at runtime.SmartForm > Group > GroupElement > SmartField. Never place SmartFields directly in a SmartForm.initialise event before programmatically accessing inner controls (e.g., getInnerControl(), getChart()).sap.ui.model.odata.type.* types in bindings alongside OData V2 models. Never use sap.ui.model.type.* with OData V2.ariaLabelledBy on SmartFilterBar and SmartChart referencing a visible title for accessibility.check() on SmartForm for client-side mandatory field validation before submitting data.get_api_reference MCP tool to verify control APIs. Use run_ui5_linter to validate code.sap.ui.mdc) instead.value property. SmartField manages its own rendering based on metadata. Use annotations to influence behavior.parts: [...]) on SmartField. It manages its own composite bindings for unit/currency fields.getChart() synchronously during initialization. Use the initialise event or getChartAsync().sap.chart.Chart). Use the smart control's public API.sap:label or @Common.Label annotations in OData metadata.sap.ui.comp.smartfield.SmartField). Use sap.ui.define or ES6 imports.| Control | Use when | Do not use when |
|---|---|---|
SmartField |
OData V2, single property display/edit, auto-rendering by Edm type and annotations | OData V4, JSON models, custom rendering required, composite/multi-property fields |
SmartForm |
OData V2, entity editing with multiple SmartFields, auto-labels from annotations | OData V4, complex custom layouts, non-OData data |
SmartFilterBar |
OData V2, annotation-driven filter UI, integration with SmartTable/SmartChart | OData V4 (use MDC FilterBar), JSON-only, purely custom filter logic |
SmartChart |
OData V2, annotation-driven chart visualization, drill-down, variant management | OData V4 (use MDC Chart), non-analytical data, custom chart JS |
SmartLink |
OData V2, semantic object navigation, cross-app navigation via FLP | OData V4 (use MDC Link), simple static links, no FLP available |
SmartMultiInput |
OData V2, multi-value entry with tokens, value help with ranges | OData V4, simple single-value input, JSON-only |
FilterBar |
Manual filter UI without OData annotations, inside ValueHelpDialog, custom filters | OData V2 with annotations (use SmartFilterBar), OData V4 (use MDC FilterBar) |
ValueHelpDialog |
Complex value selection with table + conditions tabs, token-based multi-select | Simple dropdowns, single-value selection, OData V4 (use MDC ValueHelp) |
| Symptom | Cause | Fix |
|---|---|---|
| SmartField renders as plain text in edit mode | Missing binding context or wrong entitySet |
Verify value="{PropertyName}" and entity context resolution. |
| SmartField shows Input instead of DatePicker | Missing sap:display-format="Date" on property |
Add annotation or use controlType in ControlConfiguration. |
| SmartForm labels missing | sap:label annotation not set in OData metadata |
Add sap:label to property or set label on GroupElement. |
| SmartFilterBar type-ahead not working | Missing ValueList annotation with correct target path |
Verify target: {Namespace}.{EntityName}/{FieldName}. |
| SmartFilterBar default values ignored | Setting ControlConfiguration dynamically after initialise |
Set values statically in XML or use setFilterData() API. |
| SmartChart height is 0 / not visible | Container does not provide explicit height | Set height on parent container (e.g., height="50vh"). |
| SmartChart missing dimensions/measures | Wrong or missing UI.Chart annotation |
Verify MeasureAttributes and DimensionAttributes in annotation. |
| SmartLink popover shows "No content available" | No navigation targets for semantic object in FLP | Verify FLP configuration and user authorizations. |
| SmartLink rendered as text (not clickable) | No SemanticObject annotation on property |
Add @Common.SemanticObject annotation to OData property. |
| SmartMultiInput tokens not persisting | Missing ValueList or incorrect binding | Verify ValueList annotation and navigation property binding. |
liveMode="true" on SmartFilterBar with expensive backend queries (causes rapid re-fetching).ignoredChartTypes when certain chart types are irrelevant (unnecessary UI options).ariaLabelledBy on SmartFilterBar referencing a visible title.ariaLabelledBy on SmartChart referencing a visible title.原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。