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
Save the file in your local drive. I have saved the file into my desktop.
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.
Now create the server proxy from the WSDL you downloaded in step 1. Go to SE80 and crate a service
I have used $tmp. Please use your package and transport here.
Activate the service
Go to the implementing class by double clicking, Insert this code and activate the class.
output-tid = zcl_ca_idoc_service=>trigger_idoc( input = input queueid = space ).
Go to SOAMANAGER and create an endpoint for the service.
Now test the service from SOAPUI to post an IDOC into the system
TID 0A6A381E48FE541C4FFF0304 create with IDOC 881704
IDOC posted in SAP
Similarly you can convert any IDOC into a web service. With ABAP 7.40, SP05 you can further fine tune the code.