Ingest HANA views from SAP(从 SAP 导入 HANA 视图(HANA views))¶
To extract data from a HANA view to Foundry, the HANA view needs to be published as an external view. This document describes the steps for doing that.
Prerequisites¶
- SAP HANA Studio or SAP HANA Tools for Eclipse
- ABAP Development Tools for Eclipse
Note that these tools are available from SAP development tools ↗.
External views¶
An external view is a special view in the ABAP Dictionary that defines an SAP HANA view in ABAP programs.
External views can only be created using the ABAP Development Tools (ADT) and only if the current database is an SAP HANA database.
When an external view is activated, an alias with the name of the view is created on the SAP HANA database that points to the SAP HANA view. The names of the view fields of the external view can be defined differently from the names of the view fields of the SAP HANA view. This performs a mapping of HANA-specific data types to the predefined types in ABAP Dictionary. The following table lists the currently supported HANA-specific data types and indicates which ABAP Dictionary types they are mapped to by default.
| HANA Type | Meaning | Type in ABAP Dictionary |
|---|---|---|
SMALLINT |
2-byte integer | INT2 |
INTEGER |
4-byte integer | INT4 |
BIGINT |
8-byte integer | INT8 |
DECIMAL |
Packed number | DEC |
SMALLDECIMAL |
Packed number | DEC |
FLOAT |
Binary floating point number | FLTP |
NVARCHAR |
Unicode character string | CHAR |
VARBINARY |
Byte string | RAW |
BLOB |
Byte string | RAWSTRING |
NCLOB |
Unicode character string | STRING |
External views can be displayed using the ABAP Dictionary tool in the SAP GUI-based ABAP Workbench, but not edited.
Creating external view on top of SAP HANA view¶
- Create new ABAP repository object and select Dictionary View.
- In the next screen, choose the External View option and give a name and description to your external view.
- Next, you can verify the column mapping from the SAP HANA view to the external view.
- You can test your external view by displaying its content using the SE16 transaction code.
Ingesting HANA views in Foundry¶
Once the external view is created, it can be ingested via the SAP connector by selecting the HANA View object type when configuring a sync.
中文翻译¶
从 SAP 导入 HANA 视图(HANA views)¶
要从 HANA 视图(HANA view)提取数据至 Foundry,需先将该 HANA 视图发布为外部视图(external view)。本文档将说明具体操作步骤。
前提条件¶
- SAP HANA Studio 或适用于 Eclipse 的 SAP HANA 工具(SAP HANA Tools for Eclipse)
- 适用于 Eclipse 的 ABAP 开发工具(ABAP Development Tools for Eclipse)
请注意,上述工具可从 SAP 开发工具 ↗ 获取。
外部视图(External views)¶
外部视图是 ABAP 字典(ABAP Dictionary)中的一种特殊视图,用于在 ABAP 程序中定义 SAP HANA 视图。
外部视图只能通过 ABAP 开发工具(ADT)创建,且仅当当前数据库为 SAP HANA 数据库时方可操作。
激活外部视图后,SAP HANA 数据库上会创建一个指向该 SAP HANA 视图的别名(alias),其名称与视图名称相同。外部视图的字段名称可与 SAP HANA 视图的字段名称不同,从而实现将 HANA 特定数据类型映射至 ABAP 字典中预定义类型的功能。下表列出了当前支持的 HANA 特定数据类型及其默认映射的 ABAP 字典类型:
| HANA 类型 | 含义 | ABAP 字典类型 |
|---|---|---|
SMALLINT |
2 字节整数 | INT2 |
INTEGER |
4 字节整数 | INT4 |
BIGINT |
8 字节整数 | INT8 |
DECIMAL |
压缩数字 | DEC |
SMALLDECIMAL |
压缩数字 | DEC |
FLOAT |
二进制浮点数 | FLTP |
NVARCHAR |
Unicode 字符串 | CHAR |
VARBINARY |
字节串 | RAW |
BLOB |
字节串 | RAWSTRING |
NCLOB |
Unicode 字符串 | STRING |
外部视图可通过基于 SAP GUI 的 ABAP 工作台(ABAP Workbench)中的 ABAP 字典工具进行显示,但无法编辑。
在 SAP HANA 视图之上创建外部视图¶
- 新建 ABAP 仓库对象,选择 字典视图(Dictionary View)。
- 在下一屏幕中,选择 外部视图(External View) 选项,并为外部视图命名并添加描述。
- 随后,可验证从 SAP HANA 视图到外部视图的列映射关系。
- 可通过事务代码 SE16 显示外部视图内容,以进行测试。
在 Foundry 中导入 HANA 视图¶
外部视图创建完成后,可通过 SAP 连接器(SAP connector)进行导入:在配置同步时,选择 HANA 视图对象类型 即可。