场景:SAP云平台上的两个ABAP系统实例,一个作为数据的提供者另一个作为数据的消费者clientsystem,后者从前者读取数据,并显示 实现步骤概述: (1)clientSystem创建outboundcommunication。 (2)在provision系统创建inboundcommunication。 (3)CreateaServiceConsumptionModel,andsavethislocallyasametadataXMLFromthisyouwillcreateproxyartefactsintheclientsystem,representingtheremoteservice,andusethismodeltogenerateanabstractentity。 (4)创建一个remoteclientproxy (5)在clientSystem创建一个OData服务,使用FioriElements消费并展示从provision系统取回的数据 SAP标准发布的CommunicationScenarioSAPCOM0276,提供了SAPCloudPlatformABAP实例同远端的ABAPOnPremises系统或者第三方系统集成的可能性。 Acommunicationarrangementspecifiesthemetadataforaspecificcommunicationscenario,suchasyourhostsystemandtheauthenticationmethod。Thismetadataiscontainedinaservicekey。Youcanthendefineoneormorespecificdestinationsforthisarrangement。 CommunicationArrangement为CommunicationScenario指定了必须的元数据,包括通信系统和消息认证方式等信息,这些元数据以Servicekey的形式存储。可以基于CommunicationArrangement创建Destination。 在SAP云平台CloudFoundry环境里创建一个Destination服务实例: 基于这个Destination服务创建一个新的Destination实例: url字段维护成provisionSystem的url,确保连接能够成功建立。 给Destinationservice创建一个新的servicekey,将其内容保存在本地: 在clientSystem上打开ABAPserviceinstance的dashboard: 在CommunicationArrangementtile里,创建一个新的实例: 从CommunicationScenario下拉列表里,选择之前介绍的SAPCOM0276:SAPCPCFDestinationServiceintegration: 选择好CommunicationScenario后,维护CommunicationArrangement的名称,比如OUTBOUNDXXX。 在CommunicationArrangement的additionalproperties里,将serviceinstancename的值从默认值OUTBOUNDXXX改成更便于记忆的值,比如OutboundForTutorialsXXX。 最后一步,在ABAPclientSystem上创建ABAP实现类: CLASSZCLOUTPUTHTTPXXXDEFINITIONPUBLICFINALCREATEPUBLIC。PUBLICSECTION。INTERFACESifooadtclassrun。PROTECTEDSECTION。PRIVATESECTION。ENDCLASS。CLASSZCLOUTPUTHTTPXXXIMPLEMENTATION。METHODifooadtclassrunmain。TRY。DATA(lodestination)createbyclouddestination(A4CACCESSXXXHTTPOutboundForTutorialXXXiauthnmodeifa4servicespecific)。DATA(lohttpclient)createbyhttpdestination(idestinationlodestination)。DATA(lorequest)gethttprequest()。DATA(loresponse)execute(get)。write(gettext())。CATCHcxrootINTODATA(lxexception)。write(gettext())。ENDTRY。ENDMETHOD。ENDCLASS。 第18行的参数iname的值,就是之前在SAPCloudPlatform里创建的Destination名称。 iserviceinstancename,就是创建的CommunicationArrangementadditionalproperties里创建的Serviceinstancename的值。 执行ABAP类,测试结果如下: 要获取更多Jerry的原创文章,请关注公众号汪子熙: