如何从 SAP ABAP 系统中提取数据?

2021-11-25 00:00:00 oracle11g oracle abap

我需要从 SAP ABAP 系统中提取一种格式的数据,然后可以将其加载到 Oracle 数据库(xlsx、csv、dmp 等)中

I need to extract data from a SAP ABAP system in a format that can then be loaded into an Oracle database (xlsx,csv,dmp.. etc)

提取数据后,我将使用 Pentaho 将其上传到 Oracle 数据库中.

Once the data is extracted I'll use Pentaho to upload it into the Oracle database.

有没有办法从 SAP 中提取数据?我还需要将它自动化(提取),但现在这不是什么大问题,我以后可以考虑/担心那部分.

Is there a way to extract the data from SAP? I will also need to automate it (the extraction) but that is not too much of a problem right now, I can figure/worry about that part later.

如果不可能这样做,解释为什么会有帮助!

If it is not possible to do so, an explanation why would be helpful!

推荐答案

您有多种选择来执行此操作.

You have a number of options to do this.

如果您正在运行 SAP BW,有许多标准工具可以帮助您进行提取和自动化流程.

If you are running SAP BW, there are many standard tools to help you do extractions and automate the processes.

否则,您可以编写一个简单的 ABAP 程序(类型 1)来从表中读取数据并将其放入一个平面文件中.

Otherwise, you can write a simple ABAP program (type 1) to read data from tables and put it into a flat file.

否则,您可以编写支持远程功能的功能模块 (RFC) 并使用 SAP 的 RFC 库调用它.

Otherwise, you could write a remote-enabled function module (RFC) and call it using SAP's RFC library.

您还可以使用 Web 服务包装您的 RFC 函数并通过 SOAP/HTTP 调用它.

You could also wrap your RFC function with a web service and call it via SOAP/HTTP.

最后,如果您可以访问数据库,您甚至可以编写脚本来提取您需要的数据.

Lastly, if you have access to the database, you might even be able to write a script to extract the data you need.

从数据库表中提取内容的简单程序示例:

A simple example of a program to extract something from a DB table:

report ZEXTRACT_EXAMPLE.

data: lt_t001 type table of t001.
data: ls_t001 type t001.
data: lv_filename type string value '/tmp/outfile.txt'.

select * from t001 into table lt_t001.

open dataset lv_filename for output in text mode encoding default.

loop at lt_t001 into ls_t001.
  transfer ls_t001-bukrs to lv_filename.
endloop.

close dataset lv_filename.

这真的很原始,但你懂的.它从数据库表中选择数据到内部表(在内存中)并将其写入服务器上名为 /tmp/outfile.txt 的文件,您可以从那里获取它.(您必须将输出更改为您所需的格式).

This is really primitive, but you get the idea. It selects data from a DB table into an internal table (in memory) and writes it to a file called /tmp/outfile.txt on the server, from where you can pick it up. (You would have to alter the output to be in your required format).

然后您可以使用 SM36 安排您的程序作为后台作业定期运行.

You could then schedule your program with SM36 to run periodically as a background job.

相关文章