创建数据库表

ABAP RESTful 应用程序编程模型 › 开发 › 开发应用程序 › 使用分层数据结构开发应用 › 具有只读功能的树视图 › 创建数据库表

在此示例中,我们与 ABAP 航班参考场景一起提供,我们使用表 /dmo/employee_hr。在此示例表中,每个员工也可以是一个经理。因此,员工号(节点编号)也可以是经理编号(上级节点编号)。

数据库表的列表视图

员工列指示每个员工的员工标识。“经理”列指明哪个员工是相应人员的经理。例如,员工 007-010 向员工 006 Christoph Mustermann 报告。Christoph Mustermann 向员工 004 报告,即 Holm Illner。

雇员 001, Friedrich Meier, 是机构的负责人,因此他上面没有经理。因此,他的经理显示为零。

数据库表 /DMO/EMPLOYEE_HR

展开以下代码示例以查看数据库表 /dmo/employee_hr 的源代码。

示例代码

@EndUserText.label : 'Hierarchy: Read Only: Employee'
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table /dmo/employee_hr {

  key client      : abap.clnt not null;
  key employee    : /dmo/employee_id not null;
  first_name      : /dmo/first_name;
  last_name       : /dmo/last_name;
  @EndUserText.label : 'Salary'
  @Semantics.amount.currencyCode : '/dmo/employee_hr.salary_currency'
  salary          : abap.curr(21,2);
  salary_currency : /dmo/currency_code;
  manager         : /dmo/employee_id;

}

来源:SAP Help Portal · 2025 FPS02 (Oct 2026) · 中文为 SAP 官方机器翻译

← 具有只读功能的树视图 · 创建界面视图 →