当前位置:网站首页>How to call RFC function of ABAP on premises system directly in SAP BTP ABAP programming environment
How to call RFC function of ABAP on premises system directly in SAP BTP ABAP programming environment
2022-06-29 20:37:00 【Hua Weiyun】
Log in first ABAP On-Premises System , Run transaction code :aco_proxy, by RFC function RFC_SYSTEM_INFO and RFC_READ_TABLE, Generate proxy class metadata , The format is xml. take xml Save file locally .

Use ABAP Development Tool Sign in SAP BTP ABAP Running environment , Create a new one Service Consumption Model, Type selection RFC:

Generate a Proxy Class, We'll be back in ABAP In the code , Through this Proxy Class To call On-Premises On the system RFC function . Put the previous step in On-Premises Generated in the system metadata.xml, Import to Proxy In the class Generation Wizard .

Activate this Service Consumption Model, In the automatically generated proxy class , We can find ABAP The code template , This code template , It can be copied directly to our ABAP In the code , Minor modifications , Can call ABAP On-Premises Systematic RFC Function .

Create a new one ABAP class , Copy the code in the above proxy class to this ABAP Class Main In the method :

The complete code is as follows :
CLASS zcl_consume_rfc DEFINITION PUBLIC FINAL CREATE PUBLIC .PUBLIC SECTION. INTERFACES if_oo_adt_classrun .PROTECTED SECTION.PRIVATE SECTION.ENDCLASS.CLASS zcl_consume_rfc IMPLEMENTATION. METHOD if_oo_adt_classrun~main. DATA dest TYPE REF TO IF_RFC_DEST. DATA myobj TYPE REF TO ZCL_JERRY_RFC_PROXY. DATA CURRENT_RESOURCES TYPE ZCL_JERRY_RFC_PROXY=>SYST_INDEX. DATA FAST_SER_VERS TYPE INT4. DATA MAXIMAL_RESOURCES TYPE ZCL_JERRY_RFC_PROXY=>SYST_INDEX. DATA RECOMMENDED_DELAY TYPE ZCL_JERRY_RFC_PROXY=>SYST_INDEX. DATA RFCSI_EXPORT TYPE ZCL_JERRY_RFC_PROXY=>RFCSI. DATA S4_HANA TYPE ZCL_JERRY_RFC_PROXY=>CHAR1. TRY. dest = CL_RFC_DESTINATION_PROVIDER=>create_by_cloud_destination( 'AG3' ). CREATE OBJECT myobj EXPORTING destination = dest. catch CX_RFC_DEST_PROVIDER_ERROR. " handle CX_RFC_DEST_PROVIDER_ERROR ENDTRY. TRY. myobj->RFC_SYSTEM_INFO( IMPORTING CURRENT_RESOURCES = CURRENT_RESOURCES FAST_SER_VERS = FAST_SER_VERS MAXIMAL_RESOURCES = MAXIMAL_RESOURCES RECOMMENDED_DELAY = RECOMMENDED_DELAY RFCSI_EXPORT = RFCSI_EXPORT S4_HANA = S4_HANA ). CATCH CX_ACO_COMMUNICATION_FAILURE INTO DATA(lcx_comm). " handle CX_ACO_COMMUNICATION_FAILURE (sy-msg* in lcx_comm->IF_T100_MESSAGE~T100KEY) CATCH CX_ACO_SYSTEM_FAILURE INTO DATA(lcx_sys). " handle CX_ACO_SYSTEM_FAILURE (sy-msg* in lcx_sys->IF_T100_MESSAGE~T100KEY) CATCH CX_ACO_APPLICATION_EXCEPTION INTO DATA(lcx_appl). " handle APPLICATION_EXCEPTIONS (sy-msg* in lcx_appl->IF_T100_MESSAGE~T100KEY) ENDTRY. ENDMETHOD.ENDCLASS.Be careful , According to this article article The steps mentioned , With the help of SAP Cloud Connector , stay SAP BTP Cockpit On , Complete pointing ABAP On-Premises System AG3 Of Destination To configure .
as a result of , stay SAP BTP、ABAP There are two problems when setting up the connection between environment and on premises :
- ABAP Environmental Science “ There is ” On Internet in , But the customer's internal deployment system is behind the firewall
- RFC I won't support it Internet
therefore , You need to build from on premises systems to SAP BTP、ABAP Secure tunnel connection for the environment .
- ABAP Environmental tenants from Destination Get the destination in the service instance .
- ABAP Environmental tenants pass Connectivity Service request to open tunnel connection .
- The connection service tells the cloud connector to use the management connection to open a connection with this particular server ABAP Connection of environmental tenants .
- The cloud connector uses its public tenant URL Open to ABAP Tunnel connection of environmental tenants .
- After the tunnel was built , Available for use RFC or HTTP(S) Protocol for actual data connection .

边栏推荐
- C#_ Convert camera images to bitmap format and draw Crosshairs
- 利用积分商城游戏进行营销需要避免哪些问题出现?
- 分析影响导电滑环传输信号的因素
- [notes] take notes again -- learn by doing Verilog HDL – 008
- Bigder: Automation Test Engineer
- Exercise 8 Chapter 8 Verilog finite state machine design -4 Verilog quartus Modelsim
- Sentinel's quick start takes you through flow control in three minutes
- Real time tracking of bug handling progress of the project through metersphere and dataease
- Dynamics crm: among locally deployed servers, sandbox, unzip, VSS, asynchronous and monitor services
- "Xiaodeng" active directory password expiration notification function is available for operation and maintenance
猜你喜欢

AI scene Storage Optimization: yunzhisheng supercomputing platform storage practice based on juicefs

Hangfire详解

【编译原理】语法分析

Etcd database source code analysis - put process of server

【Try to Hack】vulnhub narak

"Xiaodeng" in operation and maintenance monitors user login operations in real time

Set up your own website (12)

Mysql Json 数据类型&函数

The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize

WIN10设置自动拨号联网任务,实现开机、断网自动重连
随机推荐
Dynamics crm: among locally deployed servers, sandbox, unzip, VSS, asynchronous and monitor services
如何评价科大讯飞AI翻译笔P20系列,值得买吗?
mapbox-gl开发教程(十二):加载面图层数据
Software engineering - principles, methods and Applications
Oracle保留字查询
跳转打开新窗口
Nutch2.1 using eclipse debug to store the build process in MySQL on the windows platform
Jupyter service installation and startup
一个超赞的开源的图片去水印解决方案
A great open source image watermarking solution
Oracle reserved word query
Command execution (RCE) vulnerability
2021 CCPC Harbin E. power and modulo (thinking questions)
分析影响导电滑环传输信号的因素
0/1 score planning topic
Website stress testing tool - webbench
18. `bs对象.节点名.next_sibling` previous_sibling 获取兄弟节点
Xiaomi written test real question 1
[today in history] June 29: SGI and MIPS merged; Microsoft acquires PowerPoint developer; News corporation sells MySpace
"Xiaodeng" in operation and maintenance monitors user login operations in real time