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