Create Web Service in ERP to be called from C4C
In this series of blogs I have tried to document the steps I performed from creating a web service in ERP, configure this in PI and then implement this is C4C.
This part is the creation of a web service in ERP. I have chosen to create a very simple function module that calls the Master Data Template, and creates one Connection Object and one Premise. If you are familiar with Master Data Templates then you know that there is a lot of possibilities to configure this to create ad perform many different processes. That is why i thought this a good concept, as it would open up the possibility to have one call from C4C potentially performing different things, based on the configuration in ERP.
As a rule – I have included many screen shots.
The function module I created to test this is quite simple:
As you can see it accepts a few parameters for Connection Object and Premise, like city, street house number etc. Then after calling the Master Data Template it returns the ID of the Connection Object and the Premise. I have hard coded the name of the Master Data Template, but it would be logical to also pass this as a parameter if used in real life.
If you are interested in the entire source code, I put this in the end of the blog – but it is very simple and have juts the call of the Master Data Template, no error handling or similar.
In order to use the function module as the bases for a web service it has to be remote enabled.
Creating a web service is very simple:
Open the function module using transaction SE37, and then under ‘Utilities -> More Utilities’ we have the option to create a web service from a function module (see above). This will start a wizard that will walk the user through the needed steps – I have included all the screen shots, even thoug there is not a lot that needs to be entered.
For Authentication I selected user and password.
Since this is just a test, I created this as a local object only.
After this we have a web service created. In order to get a runtime version, we need to create using transaction: SOAMANAGER.
When you call SOAMANGER the following view is opened:
Select ‘Web Service Configuration’.
In the ‘Object Name’ search for the web service we just created.
Next click on the ‘Create Service’. When I attempted this the first time, this option was ‘greyed out’. I figured out this was due to missing authorization for my user and not a problem with the service.
This will start a wizard, walking you through the steps required to initialize the service.
For the above step, the only option selected was ‘User ID/Password’.
Nothing was entered for the above step.
Click ‘Finish’ and the screen below will now show the service and binding.
On the second line – click on the icon marked with the red arrow:
This will open the below view:
Herewe have a URL for the WSDL – copy this URL as we will need to upload this WSDL whe we peform the configuration in PI.
As a last verification that the service is created, you can go to transaction SICF, here you will be able to find your activated service:
This end the ERP part of creating the service.
The next step isto perform the PI confuguration – this starts HERE.
As promised a screenshot of the code from the function module:
Thanks Steen - great information and thanks for sharing.
Will it possible to give us the HCI configuration for this as well?
unfortunately I do not curently have access to an HCI system. Maybe you have already seen this, but there is a very nice document on configuration for both PI and HCI - here.
I think that combining the 2 should make it possible for you to perform this in HCI as well.
Good afternoon a one query Can be accessed directly from C4C to a webservice created in ERP, without the need to use PI or HCI ???
technically it would be possible to call directly from C4C to ERP, but you would need to allow the ERP system to allow a directl call. You should discuss this with basis and security if they are happy to do this.