Quantcast
Channel: SCN : Blog List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 68

IDOC as Web Service

$
0
0

We had a requirement to convert IDOC’s in web service without PI (PO). We tried to find out whether SAP provides such solutions. SAP replied to our OSS message saying NO. So we developed our own solution that can convert any IDOC into a web service within minutes. Here I will explain the steps.

 

Once you set up the system then all programs are reusable to convert any IDOC into web service.

 

Step 1. Create WSDL for the IDOC basic type or extension type

Step 2. Create server proxy for the WSDL to host the IDOC

 

Step 1. Create WSDL for the IDOC basic type or extension type. You don’t need to transport step 1 to subsequent systems.

 

      1) Copy class CL_PROXY_TEST_UTILS to ZCL_PROXY_UTILS

            I) Edit method XSD2WSDL. Paste the source code attached below.

            II) Create method GET_WSDL.  Paste the source code attached below.

      2) Copy program SAPMSEDIDOCU to ZSAPMSEDIDOCU

            I) Copy all include programs with prefix Z

            II) Edit ZMSEDIDOCUF01 and paste source code below

      3) Activate all programs

      4) Assign a TCODE to program ZSAPMSEDIDOCU. In my case I have assigned ZIDOCWSDL

 

 

 

Run the transaction to download the WSDL of the IDOC. If you are using standard IDOC type then use parameter Basic Type or else if you have IDOC extension use Enhancement to download the WSDL.

 

Here I am downloading standard basic type ORDERS05

1.png

 

Save the file in your local drive. I have saved the file into my desktop.

 

2.png

3.png

 

Step 2. Create server proxy for the WSDL to host the IDOC

Create a class ZCL_CA_IDOC_SERVICE with 3 methods as below and copy paste the source code attached below and activate the class.

4.png

5.png

6.png

7.png

    Now create the server proxy from the WSDL you downloaded in step 1. Go to SE80 and crate a service

 

8.png

9.png

10.png

11.png

12.png

13.png

I have used $tmp. Please use your package and transport here.

14.png

15.png

16.png

Activate the service

 

Go to the implementing class by double clicking, Insert this code and activate the class.

17.png

output-tid = zcl_ca_idoc_service=>trigger_idoc( input = input queueid = space ).

18.png

 

Go to SOAMANAGER and create an endpoint for the service.

19.png

Now test the service from SOAPUI to post an IDOC into the system

 

20.png

 

TID 0A6A381E48FE541C4FFF0304 create with IDOC 881704

21.png

IDOC posted in SAP

 

22.png

Similarly you can convert any IDOC into a web service. With ABAP 7.40, SP05 you can further fine tune the code.


Viewing all articles
Browse latest Browse all 68

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>