SAP云平台上两个ABAP系统实例之间的互连
場景:SAP云平臺上的兩個ABAP系統實例,一個作為數據的提供者-provision system;另一個作為數據的消費者 - client system,后者從前者讀取數據,并顯示
實現步驟概述:
(1) client System創建outbound communication.
(2) 在provision系統創建inbound communication.
(3) Create a Service Consumption Model, and save this locally as a $metadata XML file; From this you will create proxy artefacts in the client system, representing the remote service, and use this model to generate an abstract entity.
(4) 創建一個remote client proxy
(5) 在client System創建一個OData服務,使用Fiori Elements消費并展示從provision系統取回的數據
SAP標準發布的Communication Scenario SAP_COM_0276,提供了SAP Cloud Platform ABAP實例同遠端的ABAP On-Premises系統或者第三方系統集成的可能性。
A communication arrangement specifies the metadata for a specific communication scenario, such as your host system and the authentication method. This metadata is contained in a service key. You can then define one or more specific destinations for this arrangement.
Communication Arrangement為Communication Scenario指定了必須的元數據,包括通信系統和消息認證方式等信息,這些元數據以Service key的形式存儲??梢曰贑ommunication Arrangement創建Destination.
在SAP云平臺CloudFoundry環境里創建一個Destination服務實例:
基于這個Destination服務創建一個新的Destination實例:
url字段維護成provision System的url,確保連接能夠成功建立。
給Destination service創建一個新的service key,將其內容保存在本地:
在client System上打開ABAP service instance的dashboard:
在Communication Arrangement tile里,創建一個新的實例:
從Communication Scenario下拉列表里,選擇之前介紹的SAP_COM_0276: SAP CP CF Destination Service integration:
選擇好Communication Scenario后,維護Communication Arrangement的名稱,比如OUTBOUND_XXX.
在Communication Arrangement的additional properties里,將service instance name的值從默認值OUTBOUND_XXX改成更便于記憶的值,比如Outbound-For-Tutorials_XXX.
最后一步,在ABAP client System上創建ABAP 實現類:
CLASS ZCL_OUTPUT_HTTP_XXX DEFINITIONPUBLICFINALCREATE PUBLIC .PUBLIC SECTION.INTERFACES if_oo_adt_classrun.PROTECTED SECTION.PRIVATE SECTION. ENDCLASS.CLASS ZCL_OUTPUT_HTTP_XXX IMPLEMENTATION.METHOD if_oo_adt_classrun~main.TRY.DATA(lo_destination) = cl_http_destination_provider=>create_by_cloud_destination(i_name = 'A4C_ACCESS_XXX_HTTP'i_service_instance_name = 'Outbound-For-Tutorial-XXX'i_authn_mode = if_a4c_cp_service=>service_specific ).DATA(lo_http_client) = cl_web_http_client_manager=>create_by_http_destination( i_destination = lo_destination ).DATA(lo_request) = lo_http_client->get_http_request( ).DATA(lo_response) = lo_http_client->execute( i_method = if_web_http_client=>get ).out->write( lo_response->get_text( ) ).CATCH cx_root INTO DATA(lx_exception).out->write( lx_exception->get_text( ) ).ENDTRY.ENDMETHOD.ENDCLASS.第18行的參數i_name的值,就是之前在SAP Cloud Platform里創建的Destination名稱。
i_service_instance_name, 就是創建的Communication Arrangement additional properties里創建的Service instance name的值。
執行ABAP類,測試結果如下:
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的SAP云平台上两个ABAP系统实例之间的互连的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阴阳师纸舞好用吗?纸舞技能一览
- 下一篇: 如何导入某网站的certificate证