Testing is a crucial and time-consuming process for every SAP project. Automated testing saves time and cost for the project and significantly improves the quality of the testing. It enables users to do more exploratory testing. Web service automation tests will also help when interface design is under development and therefore downstream processes can be tested using SOAP UI. SOAP UI web service automation is easy to configure and execute web services. This article will cover how to set up and execute automated tests for SAP TM web services using SOAP UI. Forwarding order creation web service (TransportationRequestReqest_In) will be used as an example.
Prerequisites:
SOA Manager should be configured already. For more information, see SAP Documentation.
There will be three parts to test SAP TM with SOAP UI:
Step 1)
Firstly, a binding should be created from SAP TM. From SAP TM GUI, the transaction SOAMANAGER should be called. After the web screen pops up, Web Service Configuration under Service Administration should be selected.
Step 2)
Since we will use TransportationRequestReqest_In to create the order, we need to search and find the relevant service.
Step 3)
After clicking the service, Create Service Button should be clicked. Name the service and its binding and click next and follow the easy steps and finish setting up the web service.
Step 4)
As we can see new binding, we need to create WSDL to integrate with SOAP:
Step 1)
After downloading SOAP UI (current version is 5.5.0) it needs to be integrated with SAP TM using the WSDL file that we have created in Part I.
Step 2)
After creating New SOAP Project (Ctrl+N) following screen should appear. We need to paste the WSDL URL to the Initial WSDL textbox.
Step 3)
Now we can create a new SOAP Request by right-clicking on the request.
Step 4)
Since the new request will contain all possible fields in TransportationRequestRequest_In service, accurate XML files can be found in SXMB_MONI transaction.
Step 5)
Username and password should be entered to properties pane in SOAP.
Below please find an example:
Step 6)
Now you are ready to test. You can use SRT_UTIL transaction to track the reasons for errors of the XML in SAP TM.
For more information for TransportationRequestRequest_In, you can see SAP note 2474566.
Step 7)
After solving all the problems, the web service should produce an FWO in SAP TM. You cannot see any response from SOAP for this service. Another thing to mention is that every BaseBusinessTransactionDocumentReference should be different for each FWO.
SOAP UI has a powerful testing tool for web service testing and automation. However, in order to create mass FWOs using web services, we need to use SOAP UI PRO to retrieve external data and integrate them into web service. If you want to use SOAP UI free version, you need to use Groovy scripting.
Step 1)
Firstly, we need to create a Test Suite on SOAP PRO by right-clicking on the project:
Step 2)
We need to create a new test case by right-clicking on the test suite.
Basically, when we right-click on TestCase, three steps are required to create a system for mass FWO:
Step 3)
Firstly, we need to configure the data source:
The data source can be addressed as an Excel file, but it can be different. Properties’ names should be the same as excel file columns. After locating the file and adding properties, data can be imported by pressing the green arrow button on the top left. Starting cell should be A2 if your spreadsheet has a header.
You can see the Excel file screenshot below:
Step 4)
After we import the excel data to SOAP, we can configure the working web service. The easiest way to configure web service is using form tabs inside the SOAP Request. When we right click on the relevant field, we can address the data with the excel fields. Here ID data will be addressed.
Step 5)
We can see the field is replaced by a code ${DataSource#ID}
Step 6)
After applying all fields, the test case and mass FWO creation are ready to use. Please find the actual FWO screenshot below.
As you can see, SAP TM web services can be triggered and tested using SOAP UI in a very convenient way.
We have shown TransportationRequestReqest_In service as an example; however, any custom SAP TM web service or different services such as TransportationOrderGenericRequest, TransportationRequestQuotationCreateRequest, etc. can be used in SAP TM. You need to check your S/4 Hana version to make sure you can use the web service. It is also possible to create a SOAP Test Suite that covers all web service tests within the SAP TM project. By implementing SOAP TestSuites, you can increase your test coverage in your automated tests and improve the overall quality of the web service tests in SAP TM implementations.