- 浏览: 373173 次
- 性别:
- 来自: 南京
文章分类
最新评论
-
wangjian160910:
找到了文档,看了挺不错的,谢谢分享.
SAP HANA 数据pivot table的方式在EXCLE中显示 -
wangjian160910:
求详细步骤,或HANA学习笔记
SAP HANA 数据pivot table的方式在EXCLE中显示 -
mahone:
<div class="quote_title ...
如何将SAP数据传输到其他系统(Transferring Data from SAP to Other Systems) -
chenzan2010:
,请教个问题:我用abap调用Java Servlet,在A ...
如何将SAP数据传输到其他系统(Transferring Data from SAP to Other Systems) -
harry_2013:
<转>SY-SUBRC 的含义
在sap里有GUI_DOWNLOAD 函数将sap的数据下载到客户端机器(presentation server),而Dataset则是将数据传输到应用服务器(Application server)。然而在有些时候需要将数据传输到第三方其他系统(3rd Party System),这是我们就可以使用FTP命令来完成数据传输。
1、相关函数
HTTP_SCRAMBLE
FTP_CONNECT
FTP_R3_TO_SERVER
FTP_DISCONNECT
RFC_CONNECTION_CLOSE
2、函数说明
HTTP_SCRAMBLE: 将密码转化为SAP的格式
样例代码
l_pwd = p_pwd.
l_slen = STRLEN( l_pwd ).
CALL FUNCTION 'HTTP_SCRAMBLE'
exporting
source = l_pwd
sourcelen = l_slen
key = c_key
importing
destination = l_pwd.
FTP_CONNECT : 连接其他系统
* To Connect to the Server using FTP
样例代码
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = l_pwd
host = p_host
rfc_destination = c_dest
IMPORTING
handle = w_hdl
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
FTP_R3_TO_SERVER: 将SAP的内表数据按字符方式传输到其他系统.
样例代码
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = w_hdl
fname = <file path of destination system>
character_mode = 'X'
TABLES
text = <internal table data>
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING invalid_output_file.
ENDIF.
FTP_DISCONNECT: 关闭SAP与其他系统的连接.
样例代码
* To disconnect the FTP
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = w_hdl.
RFC_CONNECTION_CLOSE:关闭SAP与其他系统的RFC连接.
样例代码
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = c_dest
EXCEPTIONS
OTHERS = 1.
3、SAP的样例代码
report rsftp004.
parameters: suser(30) type c lower case,
spwd(30) type c lower case,
shost(64) type c lower case,
duser(30) type c lower case,
dpwd(30) type c lower case,
dhost(64) type c lower case,
lines type i default 1000,
pasv.
selection-screen skip 1.
parameters: dest like rfcdes-rfcdest default 'SAPFTP'.
types: begin of text,
line(120) type c,
end of text.
types: begin of blob,
line(80) type x,
end of blob.
data: shdl type i,
dhdl type i,
key type i value 26101957,
slen type i,
bline(80) type x,
sdocid like sysuuid-c,
ddocid like sysuuid-c,
blob_length type i,
cmd(120),
error.
data: result type table of text with header line,
bindata type table of blob with header line.
* Create data
set extended check off.
error = 0.
bline = '0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F' &
'0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F' &
'0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F' &
'0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F'.
do lines times.
bindata-line = bline.
append bindata.
enddo.
call function 'SYSTEM_UUID_C_CREATE'
importing
uuid = sdocid.
call function 'SYSTEM_UUID_C_CREATE'
importing
uuid = ddocid.
* connect to ftp server - source
slen = strlen( spwd ).
call function 'HTTP_SCRAMBLE'
exporting
source = spwd
sourcelen = slen
key = key
importing
destination = spwd.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Connect to FTP Server - Source'.
call function 'FTP_CONNECT'
exporting
user = suser
password = spwd
host = shost
rfc_destination = dest
importing
handle = shdl.
* connect to ftp server - destination
slen = strlen( dpwd ).
call function 'HTTP_SCRAMBLE'
exporting
source = dpwd
sourcelen = slen
key = key
importing
destination = dpwd.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Connect to FTP Server - Destination'.
call function 'FTP_CONNECT'
exporting
user = duser
password = dpwd
host = dhost
rfc_destination = dest
importing
handle = dhdl.
if not pasv is initial.
refresh result.
call function 'FTP_COMMAND'
exporting
handle = shdl
command = 'set passive on'
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3.
if sy-subrc eq 0.
write: / 'Set passive mode - Source'.
endif.
refresh result.
call function 'FTP_COMMAND'
exporting
handle = dhdl
command = 'set passive on'
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3.
if sy-subrc eq 0.
write: / 'Set passive mode - Destination'.
endif.
skip 1.
endif.
* Create file on Source
blob_length = lines * 80.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Create File on Source'.
call function 'FTP_R3_TO_SERVER'
exporting
handle = shdl
fname = sdocid
blob_length = blob_length
tables
blob = bindata.
* Copy Files
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Copy File to Destination'.
refresh result.
call function 'FTP_COPY'
exporting
handle_source = shdl
handle_destination = dhdl
file_source = sdocid
file_destination = ddocid
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3
others = 4.
if sy-subrc ne 0. error = 1. endif.
loop at result.
write / result-line.
endloop.
* compare content
if error eq 0.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Compare Content'.
skip 1.
refresh bindata.
call function 'FTP_SERVER_TO_R3'
exporting
handle = shdl
fname = sdocid
importing
blob_length = blob_length
tables
blob = bindata.
slen = lines * 80.
if slen ne blob_length.
error = 1.
write: / 'Length error - expected',slen,'received',blob_length.
else.
loop at bindata.
if bindata-line ne bline.
slen = sy-tabix * 80.
write: / 'Content error at',slen,bindata-line.
error = 1.
exit.
endif.
endloop.
endif.
refresh bindata.
call function 'FTP_SERVER_TO_R3'
exporting
handle = dhdl
fname = ddocid
importing
blob_length = blob_length
tables
blob = bindata.
slen = lines * 80.
if slen ne blob_length.
error = 1.
write: / 'Length error - expected',slen,'received',blob_length.
else.
loop at bindata.
if bindata-line ne bline.
slen = sy-tabix * 80.
write: / 'Content error at',slen,bindata-line.
error = 1.
exit.
endif.
endloop.
endif.
if error eq 0.
write: / 'Content compare OK'.
else.
write: / 'Content compare error'.
endif.
skip 1.
endif.
* Delete
concatenate 'del' sdocid into cmd separated by ' '.
refresh result.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Delete Files'.
call function 'FTP_COMMAND'
exporting
handle = shdl
command = cmd
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3.
loop at result.
write / result-line.
endloop.
concatenate 'del' ddocid into cmd separated by ' '.
refresh result.
call function 'FTP_COMMAND'
exporting
handle = dhdl
command = cmd
tables
data = result
exceptions
tcpip_error = 1
command_error = 2
data_error = 3.
loop at result.
write / result-line.
endloop.
* Disconnect
call function 'FTP_DISCONNECT'
exporting
handle = shdl.
call function 'FTP_DISCONNECT'
exporting
handle = dhdl.
call function 'RFC_CONNECTION_CLOSE'
exporting
destination = dest
exceptions
others = 1.
if error ne 0.
format color col_negative.
write: / 'Error im Test'.
else.
format color col_positive.
write: / ' Test OK'.
endif.
* password not visible
at selection-screen output.
loop at screen.
if screen-name = 'SPWD' or screen-name = 'DPWD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/CompassButton/archive/2007/01/25/1492922.aspx
评论
请教个问题:我用abap调用Java Servlet,在ABAP端用call method http_client->request->set_cdata( data = 'abc' ).发送数据,在Java端应该怎么接收这个data数据,是用InputStream吗?该怎么写?
非常感谢!
不好意思 这个我也没玩过
请教个问题:我用abap调用Java Servlet,在ABAP端用call method http_client->request->set_cdata( data = 'abc' ).发送数据,在Java端应该怎么接收这个data数据,是用InputStream吗?该怎么写?
非常感谢!
发表评论
-
Sap SE16n 修改表数据
2012-08-23 11:13 4804SAP中直接修改表、视图的Tcode有SE16N和SM30。 ... -
SAP IDOC并行发送
2012-07-27 15:43 8135在生成IDOC 以后快速并行发送 程序RBDAPP01 一般 ... -
DIALOG 屏幕金额字段有值不显示问题
2012-07-03 09:11 8323问题 : 在结构中是有值的 而在屏幕显示的时候显示不出来? ... -
ABAP 事件
2012-05-30 09:25 9781******************************* ... -
ABAP:区别CALL SCREEN/SET SCREEN/LEAVE TO SCREEN
2012-05-09 12:57 3107ABAP:区别CALL SCREEN/SET SC ... -
程序提交后台作业
2012-05-08 15:00 2479form sub_bgdjob_process using ... -
长文本读取
2012-05-08 09:50 1921data:ls_stxh like stxh. conc ... -
table control 回车
2012-04-26 16:12 2204如何在TC(TableControl)里面获取回车和双击行 ... -
table control 双击事件
2012-04-26 16:09 4083Table Control 响应双击事件 一、T ... -
SAP TR的下载和上传
2012-04-25 13:05 1656在没有相互关联的两个系统传输TR比较麻烦 可以使用命令 和 ... -
Transactions short text translate
2012-03-13 09:17 1131translare the short text of T ... -
smartforms translate
2012-03-08 16:34 973smartforms 翻译一直是个问题 都是 ... -
使用SAP标准功能实现复杂ABAP对象在不同系统间的迁移(转载)
2012-02-22 16:01 954使用SAP标准功能实现复杂ABAP对象在不同系统间的迁移(转载 ... -
sap abap调用job
2012-02-02 17:17 1523直接abap代码调用job http://sc ... -
SAP TR
2012-02-02 17:03 1266TR 存在 E070 E071表中 -
table的维护标题
2011-12-30 16:58 815在创建A表的时候 需要维护时 在英文 ... -
sap表修改记录查询
2011-12-20 17:11 11187SAP中修改频率较低的定制表(T001等)一般都会有修改记录存 ... -
pm order
2011-11-29 16:50 890关于PM order创建 更改 BAPI_A ... -
sap 实现图表几种方式
2011-11-10 15:38 2250SAP实现图表的几种方式 1、GFW 2、C ... -
funcation location分配classification
2011-11-04 09:45 1667data: lt_list like table of ba ...
相关推荐
本文将深入探讨“使用DB进行数据传输”的核心概念、技术细节以及在SAP Business Information Warehouse(SAP BI)中的具体应用,旨在为数据库管理员、IT专业人士以及对数据处理感兴趣的读者提供详尽的指导。...
本书《Transferring Human Impedance Regulation Skills to Robots》的主题是关于阻抗控制的知识转移,即如何将人类在操作时对阻抗(机械阻抗)的调节技巧传授给机器人,从而提升机器人的操作技能和智能水平。...
- **Nutch**: An open-source web crawler that can be used to gather data from the web. - **Apache Solr**: A powerful search platform for indexing and searching text-based documents. The chapter ...
How to compress files to save space and make transferring data easy. How and why to redirect input and output from applications. How to customize your shell prompt. How to be efficient at the ...
Using Sqoop or SSIS (SQL Server Integration Services) to move data to/from HDInsight and build data integration workflows for transferring data Using Oozie for scheduling, co-ordination and managing ...
简述使用蓝牙设备实现数据传输的单片机控制方案
数据元素(Data Element)是 SAP 系统中的基本数据单元,用于描述数据的结构和格式。在本例中,我们需要创建一个名为 ZZSCM_STATUS 的数据元素,用于描述 SCM 状态字段的数据结构。创建数据元素的步骤如下: 1. ...
Includes DataDriver, which is responsible for transferring TMemTableEh records from other databases. Process the records that have been modified in TMemTableEh and write them in another data set. ...
A Power User's Guide brings together a wealth of ideas about strategic and tactical solutions to everyday situations experienced when transferring, extracting, processing, analyzing, and reporting the...
and transferring data between Oracle and MongoDB * How to use Kundera, Spring Data, and Spring XD with MongoDB * How to load MongoDB data into Oracle Database and integrating MongoDB with Oracle ...
and (iii) prohibits the end user from (a) copying the Software, except as reasonably necessary for internal back-up purposes, (b) using and/or transferring the Software to any third party apart from ...
14. If the two ISPs do not peer with each other, then when they send traffic to each other they have to send the traffic through a provider ISP (intermediary), to which they have to pay for carrying ...
DDR SDRAM is a type of synchronous dynamic random-access memory that has been designed to double the data transfer rate compared to single data rate (SDR) SDRAM by transferring data on both the rising...
The "MAC Security Bible" serves as an indispensable resource for Mac users seeking to protect their systems and data from potential threats. By covering a wide range of topics, from understanding the ...
在本项目中,我们将探讨如何将数据从一个Arduino设备传输到另一个,这通常涉及到嵌入式系统中的通信协议。此项目的关键技术是I2C(Inter-Integrated Circuit)通信,这是一种多主控、多从属的串行通信协议,允许微...
This function is crucial for multi-GPU systems where the developer needs to control which device should be used for computation. **1.1.3 cudaGetDevice** `cudaGetDevice` retrieves the ID of the ...