如何在SAP ABAP系统里创建和消费Web Service

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:


如何在SAP ABAP系统里创建和消费Web Service

Make sure the FM is marked as “Remote enabled”.


如何在SAP ABAP系统里创建和消费Web Service


(2) start the web service creation wizard:


如何在SAP ABAP系统里创建和消费Web Service


Just follow the wizard to finish creation. Choose the appropriate authentication approach according to your use case.


如何在SAP ABAP系统里创建和消费Web Service


(3) Once creation is finished, you would find your service definition as below:


如何在SAP ABAP系统里创建和消费Web Service


click tab WSDL, write down your WSDL link:


如何在SAP ABAP系统里创建和消费Web Service


(4) use tcode SOAMANAGER, click Web Service Configuration


如何在SAP ABAP系统里创建和消费Web Service


you can find your service definition created just now:


如何在SAP ABAP系统里创建和消费Web Service


click the hyperlink and create a new service:


如何在SAP ABAP系统里创建和消费Web Service


For security reasons choose radio box “SSL”.


如何在SAP ABAP系统里创建和消费Web Service


click Finish button:


如何在SAP ABAP系统里创建和消费Web Service


Now your web service is ready for consumption. click this icon:


如何在SAP ABAP系统里创建和消费Web Service


write down this link for later usage.


如何在SAP ABAP系统里创建和消费Web Service


How to consume web service in ABAP system

(1) tcode SE80, create a new service consumer:


如何在SAP ABAP系统里创建和消费Web Service


(2) Choose external WSDL:


如何在SAP ABAP系统里创建和消费Web Service


choose the url got from last step of chapter “How to create web service provider in ABAP system”:


如何在SAP ABAP系统里创建和消费Web Service


activate your consumer proxy and write down the ABAP class name.


如何在SAP ABAP系统里创建和消费Web Service


(3) go back to SOAMANAGER, find the consumer proxy created in step2:


如何在SAP ABAP系统里创建和消费Web Service


create a new logical port:


如何在SAP ABAP系统里创建和消费Web Service



(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.


如何在SAP ABAP系统里创建和消费Web Service


(5) consume the web service in ABAP report:

you can find the data type for input and output parameters in SE80:


如何在SAP ABAP系统里创建和消费Web Service

Now we execute the report and get the web service execution result as expected:


如何在SAP ABAP系统里创建和消费Web Service


The product description in UI:


如何在SAP ABAP系统里创建和消费Web Service


How to trace the web service execution

Use tcode SRT_UTIL, add a new configuration for your user which triggers the web service call:


如何在SAP ABAP系统里创建和消费Web Service


Set the Functional Trace to “High”. You could also enable Performance and Payload trace if necessary.

Click Save Configuration button to persist the change.


如何在SAP ABAP系统里创建和消费Web Service


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.


如何在SAP ABAP系统里创建和消费Web Service


Double click and select the row with type “Response”, where you could find the product description value returned by service provider.



如何在SAP ABAP系统里创建和消费Web Service


上一篇:Oracle完善融合中间件“即服务” 云计算大数据原来可以更灵活


下一篇:如何在SAP云平台ABAP编程环境里创建自己的Z表