Oldarabieats

Step by step to create, consume and trace web service in ABAP system

This document could be used as guide for beginners to learn and use ABAP web service.

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:

https://blogs.sap.com/wp-content/uploads/2014/05/clipboard2_456139.png

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

https://blogs.sap.com/wp-content/uploads/2014/05/clipboard3_456147.png

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

https://blogs.sap.com/wp-content/uploads/2014/05/clipboard4_456149.png

click tab WSDL, write down your

Read More