Skip to Content
Author's profile photo Titto Antony

Use of User-Defined Transform in Data Service 4.X for Accessing Web Service Part 1

In this blog I will be explaining how to use the User_Defined Transform in DataServices 4.x for accessing Web Services.

User-Defined Transform

The User-Defined transform provides you with custom processing in a data flow using full Python scripting language. It can do just about anything that you can write Python code to do. You can use the User-Defined transform to generate new records, populate a field with a specific value, create a file, connect to a website, or send an email, just to name a few possibilities. User Defined Transforms comes under the Data Quality Transforms.



Here I’m demonstrating a process where I will be accessing a web service and mapping the response and from the web service to a target table using the user-defined transform. i.e. key field coming from the source (hard-coded value) is passed to the web service and the required output is extracted from the web service response.

In this process we are using a simple restful web service that will be accepting the key value from the source as a parameters

http://Server_Path: parameter1= value1? parameter2=”Value2”

Output of the web Service is a simple XML Structure which will be like


            <name>Output Need to Mapped to Target</name>



Step by Step Details of Process Followed

1)  Create a batch job and build the scenario in the Dataflow. For our scenario we have two input rows and value of the key field that need to be passed to the user defined transform is explicitly provided using the Query transform.


2)      Map the input to the User Defined transform. Open the User-Defined transform and map  input fields from the schema in to the schema out of the Transform which need to be directly mapped  to the target .  In our case we can map the MAT_KEY field in the input schema to the schema out of the transform.


2)   3)     To use input field in a Python expression in your User-Defined transform, we first need to map it to a recognized field name in the Input tab. For that Drag and drop the input field which need to be used in the User-Defined editor into the input tab of the Editor. So are we mapping the input field MATNR into the input tab of the user-defined transform.


3)   4)     In User-Defined user cannot edit options in the User-Defined transform editor. To edit options, you must use the User-Defined editor, which is accessed from the Options tab in the User-Defined transform editor.


4)   5)     The User-Defined transform contains options that determine how the transform processes data. There are two modes to process the data they are

Per collection: Applies the expression to entire data collection. Use this option when adding new records, which did not exist before, into the data flow. Selecting this option displays the Group Forming option group, in which you set up break groups and candidate selection.

Per record: Applies the expression to each record. You cannot add new records into the data flow with this option. This option is the default and what you will want to use most often.

In this demonstration we are using the per record Data processing mode


5)     6)      Click the Launch Python Editor button to access the Python Expression editor.


6)   7)     In the Python Expression editor, create and edit Python code in the editor pane of the window. The Python expression that you create here depends on what you need to do with User-Defined transform. Python Expression editor contain The Python API tab which list the objects, functions, classes, and methods that are available for the specific transform and processing mode.


And it also contains the I/O Fields tab displays the input fields and output fields that have been mapped in the User-Defined transform. we can also add, delete, and edit the properties of user-defined input and output fields from this tab by right-clicking Input Fields or Output Fields and selecting Insert, Delete, or Properties.


7)  8)     Next we will be creating an output field with a name DESC_OUT by right clicking the Output fields and selecting Insert. Output of the transform is mapped to this field in our python code.


8)  9)     Python Expression editor is used to create our python expression for doing the required transformation logic. In our case we have to build the Web Service URL by appending the Input key field and call the web service for getting the response and extract the output field from the response.  Please find below the python expression we built for handling the above mentioned process. More details explanation the python expression will be given in the part 2 for your reference


9)    10)     After the creating the python expression we can validate the expression by clicking the Validate button in the Python Expression editor. The syntax checker makes sure that the Python code has required colon (:) characters, string literal closing characters and Correct indentation.


1011)     On coming back to the User-defined transform you have specify the output fields that need to be mapped to the output of the transform. These are useful if you repeatedly use a transform with different and input and output fields


1112)     Next we have to map the output of the User-Defined mapping to the target table and run the job. Here in my target table the field value coming from the user-defined transform is mapped to DESC field in the target.

1213)     Please find the input and output generated


These are the Steps that are followed to access a web service using user-defined transform. By using the above approach we can access a web service which cannot be accessed using conventional ways available in the BODS. 

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Titto Antony
      Titto Antony
      Blog Post Author
      Author's profile photo Former Member
      Former Member
      Author's profile photo Titto Antony
      Titto Antony
      Blog Post Author

      Done Mikhail nice initiative and its useful..

      Author's profile photo Pan Cheng
      Pan Cheng

      Nice one..

      Author's profile photo Former Member
      Former Member


      Does the web service have to be configured by a SAP Basis person or can it be done by a Developer?

      Also would you be able to help me on what checks/configurations need to be done to get the Web Service to work?

      I am currently trying to consume a SharePoint Web Service, and I am new to SAP.

      Thank You,


      Author's profile photo Titto Antony
      Titto Antony
      Blog Post Author

      You can directly consume the web service  if it is accessible form the job server machine.

      Author's profile photo Former Member
      Former Member

      Hi Antony,

      Am trying to create web service from Client system ( Not from Job server Machine). SO, i cannot able to create webservice Datastore.  Can i know the configurations required in order to create datastore from BODS Client.

      THanks in advance

      Best Regards,

      Author's profile photo Titto Antony
      Titto Antony
      Blog Post Author

      Please select datastore Type as Webservice_SOAP or Webservice_REST for creating Webservice datastore. PFB details

      Author's profile photo Vyacheslav Tsoy
      Vyacheslav Tsoy

      Hello, Titto Antony, very usefull topic. As i understand you call WS REST using GET method and your input parameters is a part of URL, didn't work with python so my question is how will change the UDT if we need using method POST with request json body.


      Author's profile photo JUHI GOYAL

      Hi Vyacheslav Tsoy .. can you share steps steps you used for GET .. do we need to create adaptor for JSON or only user defined transofrm will work ?

      Author's profile photo JUHI GOYAL

      Hello Experts, I am trying to read data from web service giving output in json format .. My GET gives me error always on udt_transformu.dll .. can anyone help wht will possibly be wrong.. ?? I am called webservice through user defined transform invoking python code for Get