当前位置:网站首页>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 .

边栏推荐
- 社区访谈丨一个IT新人眼中的JumpServer开源堡垒机
- . NETCORE unified authentication authorization learning - run (1)
- 0/1 score planning topic
- At least 3 years for learning amplifier?
- File contains vulnerability
- 从众伤害的是自己
- MySQL JSON data types & functions
- 「运维有小邓」Active Directory 密码过期通知功能
- 【编译原理】语法分析
- Uncover the secret! Pay attention to those machines under the membership system!
猜你喜欢

「运维有小邓」AD域委派

Etcd database source code analysis - put process of server

At least 3 years for learning amplifier?

Koa source code analysis

Real time tracking of bug handling progress of the project through metersphere and dataease

【Try to Hack】vulnhub narak

「运维有小邓」Active Directory批量用户创建
![[notes] take notes again -- learn by doing Verilog HDL – 008](/img/7f/0ca73446247455ac4d8f9667083a87.png)
[notes] take notes again -- learn by doing Verilog HDL – 008

.NetCore统一认证授权学习——Run(1)

Hangfire details
随机推荐
输入年份与月份,求该月共有多少天
0/1分数规划专题
「运维有小邓」Active Directory批量用户创建
Koa source code analysis
Sentinel's quick start takes you through flow control in three minutes
What is a database? Database detailed notes! Take you into the database ~ you want to know everything here!
Win7 easy connect 提示:选路连接失败,可能当前连接网络异常,请稍后重试
[notes] take notes again -- learn by doing Verilog HDL – 014
JMeter BeanShell explanation and thread calling
攻防演练中的防守基石——全方位监控
分析影响导电滑环传输信号的因素
High energy live broadcast, a gathering of celebrities! We invite you to explore bizdevops.
Stm32cubemx learning (6) external interrupt experiment
.NetCore统一认证授权学习——Run(1)
Hangfire details
导航【微机原理】
「运维有小邓」AD域委派
Defense cornerstone in attack and defense drill -- all-round monitoring
解释PBR纹理贴图(texture-maps)
使用Gunicorn部署web.py应用