sap-fiori-app-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SAP Fiori App Development Guidelines (CAP & Standalone Projects)

SAP Fiori应用开发指南(CAP与独立项目)

General Guidelines (Applicable to CAP and Standalone Fiori Projects)

通用指南(适用于CAP和独立Fiori项目)

  1. Always ask the user whether they want to create a Fiori app for CAP (Cloud Application Programming) or a standalone Fiori project connected to an external OData service before proceeding with implementation, unless the technology stack is explicitly specified in the user's request.
  2. Use the Fiori MCP tools to create the Fiori UI using SAP Fiori Elements.
  3. After the Fiori MCP Server tools execute successfully, inform the user of completion. Do not verify or double-check - treat successful tool execution as confirmation.
  4. The data model should be suitable for SAP Fiori elements: at minimum one entity type that serves as the main entity for the application. Navigation properties to related entities are optional but enable richer UI patterns.
  5. Each property of an entity must have a proper datatype.
  6. Before modifying the code directly - first check whether Fiori MCP server provides a suitable function or tool, or if a specialized skill exists (e.g.
    sap-fiori-analytical-chart
    ).
  1. 在开始实施之前,务必询问用户是要为CAP(Cloud Application Programming,云应用编程)创建Fiori应用,还是创建连接到外部OData服务的独立Fiori项目,除非用户的请求中明确指定了技术栈。
  2. 使用Fiori MCP工具,基于SAP Fiori Elements创建Fiori UI。
  3. Fiori MCP Server工具执行成功后,告知用户已完成。无需验证或复核——将工具执行成功视为完成确认。
  4. 数据模型需适配SAP Fiori Elements:至少包含一个作为应用主实体的实体类型。关联实体的导航属性为可选,但可实现更丰富的UI模式。
  5. 实体的每个属性必须具备合适的数据类型。
  6. 在直接修改代码之前——首先检查Fiori MCP server是否提供合适的功能或工具,或者是否存在专用技能(例如
    sap-fiori-analytical-chart
    )。

Available Application Templates (Both CAP and Standalone Projects)

可用应用模板(CAP与独立项目通用)

The Fiori MCP can create the following application templates for both CAP and standalone project backends:
  1. FE_LROP - List Report Object Page (most common, OData V2/V4)
  2. FE_ALP - Analytical List Page (OData V2/V4)
  3. FE_OVP - Overview Page (OData V2/V4)
  4. FE_WORKLIST - Worklist (OData V2/V4)
  5. FE_FEOP - Form Entry Object Page (OData V4 only)
  6. FE_FPM - Flexible Programming Model / Custom Page (OData V4 only)
  7. FF_SIMPLE - Basic SAPUI5 Freestyle template (can work without a data source)
Fiori MCP可为CAP和独立项目后端创建以下应用模板:
  1. FE_LROP - 列表报告对象页面(最常用,OData V2/V4)
  2. FE_ALP - 分析列表页面(OData V2/V4)
  3. FE_OVP - 概览页面(OData V2/V4)
  4. FE_WORKLIST - 工作列表(OData V2/V4)
  5. FE_FEOP - 表单录入对象页面(仅支持OData V4)
  6. FE_FPM - 灵活编程模型/自定义页面(仅支持OData V4)
  7. FF_SIMPLE - 基础SAPUI5自由风格模板(可在无数据源情况下运行)

Available Page Types

可用页面类型

The Fiori MCP can add the following page types to existing applications:
  1. ListReport - Table view with filtering and search
  2. ObjectPage - Detail page for viewing/editing records
  3. CustomPage - Fully custom page with your own views
Fiori MCP可为现有应用添加以下页面类型:
  1. ListReport - 带筛选和搜索功能的表格视图
  2. ObjectPage - 用于查看/编辑记录的详情页面
  3. CustomPage - 可自定义视图的完全自定义页面

Application Structure

应用结构

  • When asked to create a SAP Fiori elements app, check whether the user input can be interpreted as an application organized into one or more pages containing table data or forms.
  • Applications typically start with a List Report page showing data in a table, but other templates are available (see above).
  • Details of a specific table row are shown in an Object Page based on the base entity.
  • An Object Page can contain sections based on navigation properties (both to-one (0..1) and to-many associations) of its entity type.
  • Details of a table section row (for to-many associations) can be shown in another Object Page based on the association's target entity.
  • 当被要求创建SAP Fiori Elements应用时,检查用户输入是否可解读为包含一个或多个表格数据或表单页面的应用。
  • 应用通常以显示表格数据的List Report页面起步,但也可使用上述其他模板。
  • 特定表格行的详情将基于基础实体在Object Page中展示。
  • Object Page可包含基于其实体类型导航属性(一对一(0..1)和一对多关联)的章节。
  • 表格章节行(针对一对多关联)的详情可基于关联目标实体在另一个Object Page中展示。

Application Preview Guidelines

应用预览指南

  • Use the most specific script for the app in
    package.json
    .
  • For CAP: Use watch scripts (e.g.,
    npm run watch-manage-travel
    )
  • For standalone Fiori projects: Use
    npm start
    (live backend) or
    npm run start-mock
    (mock data)
  • 使用
    package.json
    中最适合该应用的脚本。
  • 对于CAP:使用watch脚本(例如
    npm run watch-manage-travel
  • 对于独立Fiori项目:使用
    npm start
    (实时后端)或
    npm run start-mock
    (模拟数据)

CAP-Specific Guidelines

CAP专属指南

  1. The fiori app must be created in the
    app
    folder under the CAP application root folder created before with
    cds init
    operation. This root folder is always a subfolder directly under working directory.
  2. When creating UI applications following a CAP application summary, make sure to use UI application names as described in the project structure of the summary, unless user explicitly requested otherwise.
  3. On any follow-up request to change or modify the UI of the full stack CAP application, always try first to make the change in the fiori app unless really required in service.
  4. Provide primary keys of type UUID for all entities.
  5. When creating sample data in CSV files, all primary keys and foreign keys MUST be in UUID format (e.g.,
    550e8400-e29b-41d4-a716-446655440001
    ).
  1. Fiori应用必须创建在之前通过
    cds init
    操作创建的CAP应用根目录下的
    app
    文件夹中。该根目录始终是工作目录下的直接子文件夹。
  2. 在根据CAP应用概要创建UI应用时,务必使用概要项目结构中描述的UI应用名称,除非用户明确要求其他名称。
  3. 在对全栈CAP应用的UI进行后续修改请求时,除非确实需要在服务端修改,否则应优先尝试在Fiori应用中进行更改。
  4. 为所有实体提供UUID类型的主键。
  5. 在CSV文件中创建示例数据时,所有主键和外键必须采用UUID格式(例如
    550e8400-e29b-41d4-a716-446655440001
    )。

Standalone Fiori Project Guidelines

独立Fiori项目指南

  1. For standalone Fiori projects based on external services, the application is created at the root level by Fiori MCP tools.
  2. Destination or SAP System Name: If the user doesn't provide a destination name or SAP system name, use the Fiori MCP Server to retrieve and present available destinations/systems for user selection.
  3. Fetching OData Service Metadata: Refer to the tools instructions for downloading odata service metatdata. If Service Center MCP is available use that, otherwise use the Fiori MCP Server to download the metadata file.
  4. Annotations should primarily be maintained in the backend service, and only app-specific UI customizations or overrides should be placed in local (frontend) annotations.
  5. Use frontend annotations only for app-specific UI tweaks (e.g.,
    /webapp/annotations/annotation.xml
    ) referenced in
    manifest.json
    with matching
    uri
    and
    localUri
    values:
    json
    "annotation": {
      "type": "ODataAnnotation",
      "uri": "annotations/annotation.xml",
      "settings": {
        "localUri": "annotations/annotation.xml"
      }
    }
  6. Standalone Fiori projects connect to remote OData V2 or V4 services (defined in
    manifest.json
    dataSources).
  7. OData Service Metadata is Read-Only: The service metadata file (
    /webapp/localService/mainService/metadata.xml
    ) referenced in
    manifest.json
    must not be edited locally. Any changes to entity definitions, properties, or service structure must be made at the backend source:
    json
    "dataSources": {
      "mainService": {
        "uri": "/path/to/odata/service/",
        "type": "OData",
        "settings": {
          "annotations": ["annotation"],
          "localUri": "localService/mainService/metadata.xml",
          "odataVersion": "4.0"
        }
      }
    }
  1. 基于外部服务的独立Fiori项目,应用由Fiori MCP工具在根目录创建。
  2. 目标或SAP系统名称:如果用户未提供目标名称或SAP系统名称,使用Fiori MCP Server检索并展示可用的目标/系统供用户选择。
  3. 获取OData服务元数据:参考工具说明下载OData服务元数据。如果Service Center MCP可用则使用该工具,否则使用Fiori MCP Server下载元数据文件。
  4. 注释应主要在后端服务中维护,仅应用特定的UI自定义或覆盖内容应放在本地(前端)注释中。
  5. 仅将前端注释用于应用特定的UI调整(例如
    /webapp/annotations/annotation.xml
    ),并在
    manifest.json
    中用匹配的
    uri
    localUri
    值引用:
    json
    "annotation": {
      "type": "ODataAnnotation",
      "uri": "annotations/annotation.xml",
      "settings": {
        "localUri": "annotations/annotation.xml"
      }
    }
  6. 独立Fiori项目连接到远程OData V2或V4服务(在
    manifest.json
    的dataSources中定义)。
  7. OData服务元数据为只读
    manifest.json
    中引用的服务元数据文件(
    /webapp/localService/mainService/metadata.xml
    )不得在本地编辑。对实体定义、属性或服务结构的任何更改必须在后端源进行:
    json
    "dataSources": {
      "mainService": {
        "uri": "/path/to/odata/service/",
        "type": "OData",
        "settings": {
          "annotations": ["annotation"],
          "localUri": "localService/mainService/metadata.xml",
          "odataVersion": "4.0"
        }
      }
    }