如何将ABAP透明表的内容导入PostgreSQL数据库

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
简介: 如何将ABAP透明表的内容导入PostgreSQL数据库

In my previous blog Replicate ABAP database table definition to PostgreSQL the step how to replicate the table definition in ABAP server into PostgreSQL is introduced. As now we already have empty table, the next step is to replicate the transaction data of that table from ABAP server to PostgreSQL.


Now ABAP table COMM_PRODUCT is successfully replicated to PostgreSQL:


image.pngIn my ABAP server table COMM_PRODUCT has totally 94331 entries:

image.pngExecute the report below:REPORT zexport_data.

DATA: lt_export  TYPE string_table,

     l_filename TYPE string,

     l_path     TYPE string,

     l_fullpath TYPE string,

     lv_from    TYPE string,

     lv_to      TYPE string,

     lt_result  TYPE TABLE OF comm_product.

SELECT * INTO TABLE lt_result FROM comm_product.

LOOP AT lt_result INTO DATA(r).

 PERFORM format_timestamp USING r-valid_from CHANGING lv_from.

 PERFORM format_timestamp USING r-valid_to CHANGING lv_to.

 DATA(lv_line) = |{ r-client };{ r-product_guid };{ r-product_id };{ r-product_type };| &

 |{ r-config };{ r-xnosearch };{ r-object_family };{ r-batch_dedicated };{ r-competitor_prod };| &

 |{ lv_from };{ lv_to };{ r-upname };{ r-histex };{ r-logsys }| .

 APPEND lv_line TO lt_export.

ENDLOOP.

CALL METHOD cl_gui_frontend_services=>file_save_dialog

 EXPORTING

   window_title         = 'Save export data file'

   default_file_name    = 'PostgreSQL.txt'

 CHANGING

   filename             = l_filename

   path                 = l_path

   fullpath             = l_fullpath

 EXCEPTIONS

   cntl_error           = 1

   error_no_gui         = 2

   not_supported_by_gui = 3

   OTHERS               = 4.

IF sy-subrc <> 0.

 WRITE:/ 'file save dialog failed.'.

 RETURN.

ENDIF.

CALL METHOD cl_gui_frontend_services=>gui_download

 EXPORTING

   filename                = l_fullpath

 CHANGING

   data_tab                = lt_export

 EXCEPTIONS

   file_write_error        = 1

   no_batch                = 2

   gui_refuse_filetransfer = 3

   invalid_type            = 4

   no_authority            = 5

   unknown_error           = 6

   header_not_allowed      = 7

   separator_not_allowed   = 8

   filesize_not_allowed    = 9

   header_too_long         = 10

   dp_error_create         = 11

   dp_error_send           = 12

   dp_error_write          = 13

   unknown_dp_error        = 14

   access_denied           = 15

   dp_out_of_memory        = 16

   disk_full               = 17

   dp_timeout              = 18

   file_not_found          = 19

   dataprovider_exception  = 20

   control_flush_error     = 21

   not_supported_by_gui    = 22

   error_no_gui            = 23

   OTHERS                  = 24.

FORM format_timestamp USING iv_timestamp TYPE comt_valid_from CHANGING cv_line.

 CONVERT TIME STAMP iv_timestamp TIME ZONE 'UTC' INTO DATE DATA(date)

    TIME DATA(time).

 CLEAR: cv_line.

 cv_line = |{ date DATE = ISO } { time TIME = ISO }|.

ENDFORM.Those entries are exported from ABAP server to my local laptop stored in txt format.image.pngNow go back to PostgreSQL console, choose import from context menu:image.pngLoad the local text file:image.pngAnd you can see import successful notification:image.pngClick detail hyperlink, and you see totally 94331 lines are imported from ABAP server.image.pngJust do some double click to confirm whether the data imported are exactly equal to the records in ABAP server.

image.png

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
20天前
|
SQL 数据库 索引
关于 SAP ABAP REPOSRC 数据库表在 HANA 中的 DDL Definition
关于 SAP ABAP REPOSRC 数据库表在 HANA 中的 DDL Definition
18 1
关于 SAP ABAP REPOSRC 数据库表在 HANA 中的 DDL Definition
|
22天前
|
SQL 关系型数据库 PostgreSQL
把PostgreSQL的表导入SQLite
把PostgreSQL的表导入SQLite
15 0
|
1月前
|
数据库
ABAP 泛型编程实战 - 分享一个数据库表内容的拷贝工具试读版
ABAP 泛型编程实战 - 分享一个数据库表内容的拷贝工具试读版
20 0
|
2月前
|
存储 SQL 数据库
关于 SAP ABAP 数据库表 GTADIR
关于 SAP ABAP 数据库表 GTADIR
27 0
|
1月前
|
关系型数据库 分布式数据库 数据库
PolarDB PostgreSQL版:Oracle兼容的高性能数据库
PolarDB PostgreSQL版是一款高性能的数据库,具有与Oracle兼容的特性。它采用了分布式架构,可以轻松处理大量的数据,同时还支持多种数据类型和函数,具有高可用性和可扩展性。它还提供了丰富的管理工具和性能优化功能,为企业提供了可靠的数据存储和处理解决方案。PolarDB PostgreSQL版在数据库领域具有很高的竞争力,可以满足各种企业的需求。
|
20天前
|
数据库 存储 BI
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
11 0
SAP ABAP CDS View 源代码存储的数据库表揭秘和其他相关数据库表介绍试读版
|
20天前
|
数据库
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
9 0
迈入 SAP CDS View 世界的前置知识 - SAP ABAP 数据库视图介绍试读版
|
1月前
|
存储 关系型数据库 MySQL
TiDB与MySQL、PostgreSQL等数据库的比较分析
【2月更文挑战第25天】本文将对TiDB、MySQL和PostgreSQL等数据库进行详细的比较分析,探讨它们各自的优势和劣势。TiDB作为一款分布式关系型数据库,在扩展性、并发性能等方面表现突出;MySQL以其易用性和成熟性受到广泛应用;PostgreSQL则在数据完整性、扩展性等方面具有优势。通过对比这些数据库的特点和适用场景,帮助企业更好地选择适合自己业务需求的数据库系统。
|
2月前
|
关系型数据库 分布式数据库 数据库
PolarDB for PostgreSQL报错问题之psql连接数据库报错如何解决
PolarDB for PostgreSQL是基于PostgreSQL开发的一款云原生关系型数据库服务,它提供了高性能、高可用性和弹性扩展的特性;本合集将围绕PolarDB(pg)的部署、管理和优化提供指导,以及常见问题的排查和解决办法。
|
2月前
|
存储 BI 数据库
SAP ABAP 系统数据库表 TFDIR的作用介绍
SAP ABAP 系统数据库表 TFDIR的作用介绍
35 1