This document could be used as guide for beginners to learn and use ABAP web service.
How to create web service provider in ABAP system
The following steps demonstrates how to expose a function module as a web service provider in SAP CRM system.
(1) create a new function module to return product description by given input product ID. Signature and source code of function module:
FUNCTION ZGET_PROD_DESCRIPTION.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_PROD_ID) TYPE COMM_PRODUCT-PRODUCT_ID
*" EXPORTING
*" VALUE(RV_TEXT) TYPE STRING
*"----------------------------------------------------------------------
SELECT SINGLE A~short_text INTO rv_text FROM COMM_PRSHTEXT AS A
INNER JOIN comm_product AS B ON B~product_id = iv_prod_id AND B~product_guid = A~product_guid.
ENDFUNCTION.
Make sure the FM is marked as “Remote enabled”.
(2) start the web service creation wizard:
Just follow the wizard to finish creation. Choose the appropriate authentication approach according to your use case.
(3) Once creation is finished, you would find your service definition as below:
click tab WSDL, write down your WSDL link:
(4) use tcode SOAMANAGER, click Web Service Configuration
you can find your service definition created just now:
click the hyperlink and create a new service:
For security reasons choose radio box “SSL”.
click Finish button:
Now your web service is ready for consumption. click this icon:
write down this link for later usage.
How to consume web service in ABAP system
(1) tcode SE80, create a new service consumer:
(2) Choose external WSDL:
choose the url got from last step of chapter “How to create web service provider in ABAP system”:
activate your consumer proxy and write down the ABAP class name.
(3) go back to SOAMANAGER, find the consumer proxy created in step2:
create a new logical port:
(4) Make sure you specify URL got from the last step of web service creation chapter. If you just use the URL got from SE80 in tab “WSDL”, you will meet withbelow error.
(5) consume the web service in ABAP report: you can find the data type for input and output parameters in SE80:
data: lr_proxy TYPE REF TO CO_ZPRODUCTDESCRIPTION4,
input TYPE ZGET_PROD_DESCRIPTION,
output TYPE ZGET_PROD_DESCRIPTION_RESPONSE.
input-iv_prod_id = 'ARNO_TEST004'.
CREATE OBJECT lr_proxy
EXPORTING
LOGICAL_PORT_NAME = 'ZLP_JERRY1'.
CALL METHOD lr_proxy->ZGET_PROD_DESCRIPTION
EXPORTING
input = input
IMPORTING
output = output.
Now we execute the report and get the web service execution result as expected:
The product description in UI:
How to trace the web service execution
Use tcode SRT_UTIL, add a new configuration for your user which triggers the web service call:
Set the Functional Trace to “High”. You could also enable Performance and Payload trace if necessary. Click Save Configuration button to persist the change.
Execute the report which triggers the web service call. After it finishes, click tab “Functional Trace” and click refresh button, you should see several records for execution trace.
Double click and select the row with type “Response”, where you could find the product description value returned by service provider.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
相关推荐
在SAP ECC 6.0系统中,使用ABAP调用Web Service的第一步是生成代理。使用SAP Gateway或Web Services Directory找到生成的WSDL地址(例如`http://localhost:8080/SayHello/SayHelloToMe?wsdl`),然后在SAP SE80事务...
在SAP ABAP环境中,调用外部Web服务是常见的任务,尤其在系统间集成和数据交换时。本案例将详细讲解如何配置SAP ABAP来调用外部接口Web服务。 首先,我们需要创建一个企业服务(Enterprise Service)的消费者代理。...
10. **Web服务和ABAP**:了解如何在ABAP环境中集成Web服务,如使用HTTP请求和响应,以及调用Web Service Consumer。 通过这些实例,读者不仅可以熟悉ABAP的基本语法,还能理解在实际SAP项目中如何运用这些技能解决...
- **工具集**: 在 ABAP Workbench 中,开发者可以利用 SAP 提供的标准化体系结构和工具集来创建 Web Service,这些工具集覆盖了从设计到实现再到测试和发布的整个生命周期。 总之,基于 ABAP Workbench 创建并发布 ...
SAP ABAP(Advanced Business Application Programming)是SAP系统中用于开发应用程序的主要编程语言。本篇文章将深入探讨通过实例学习SAP ABAP编程的关键知识点,旨在帮助初学者及有经验的开发者更好地理解和实践...
### ABAP调用Web服务详解 #### 一、引言 ...通过这些步骤,可以实现ABAP与外部Web服务的有效集成,从而增强SAP系统的功能性和灵活性。此外,为了确保调用的成功,还需要对可能出现的异常进行适当的处理。
ABAP支持创建和消费Web服务,通过SOAP和RESTful协议与其他系统进行集成。ABAP开发者可以使用ABAP Web Service Consumer(WSCONSUMER)和Web Service Provider(WSPROVIDER)来实现这一功能。 八、ABAP工作流...
### SAP应用及ABAP开发最佳实践—在ABAP程序中调用Web Service #### 概述 在现代企业级应用环境中,Web服务作为一种重要的技术手段,被广泛应用于不同系统之间的集成与交互。对于SAP环境而言,无论是基于ABAP工作...
本开发配置文档详细介绍了如何在SAP系统中创建和调用Web Service。 **第一章 SAP创建WS** 1.1 概要技术说明 在SAP中创建Web Service主要涉及以下步骤:首先定义RFC(远程功能调用)函数,然后基于RFC创建Web ...
在本文档中,我们将详细介绍BAPI的创建、发布,以及Web Service的发布和ABAP调用。 一、BAPI的创建 1. 首先,你需要创建一个Function Group,这是一个容器,用于包含一组相关的Function Modules。在SAP中,使用...
abap 与 java web service 集成
3. **ABAP Web服务的调用与消费**:书中会讲解如何在ABAP环境中调用外部Web服务,以及如何让其他系统消费SAP内部的Web服务,以实现系统间的集成。 4. **安全性与管理**:安全是Web服务的关键议题,书籍会涵盖认证、...
调用SAP的Web Service,首先需要获取服务的WSDL,然后在SOAMANAGER中创建Logical Port,最后通过ABAP代码实现实际的调用逻辑。这种集成方式使得SAP系统能够与非SAP系统,如C#、Java或.NET系统进行无缝交互,增强企业...
1. **选择Service Consumer:** 首先,在SAP系统中选择“Service Consumer”选项,这标志着我们将创建一个消费者来调用外部服务。 2. **指定WSDL URL:** 接下来,需要提供目标Web服务的WSDL URL。WSDL URL是指向服务...
- **Adobe Document Service**:作为SAP NetWeaver的一个重要组成部分,它提供了与Adobe LiveCycle Designer的紧密集成,允许开发者在ABAP环境中设计和管理交互式表单。 #### 结论 SAP NetWeaver ABAP与Adobe ...
在SAP系统中,ABAP调用ABAP Proxy是一种常见的技术操作,用于在不同系统间或者同一系统内的组件之间实现通信。ABAP Proxy是SAP提供的一个强大的接口技术,它允许开发者创建安全、高效的远程调用机制。接下来,我们将...