Upload
pallavi-koppula
View
217
Download
0
Embed Size (px)
Citation preview
8/17/2019 Use of User-Defined Transform in Data Service 14...pdf
1/7
5/9/2016 Use of User-Defined Transform in Data Service 4... | SCN
http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1 1/7
Getting Started Newsletters Store
Products Services & Support About SCN Downloads
Industries Training & Education Partnership Developer Center
Lines of Business University Alliances Events & Webinars Innovation
Log On Join UsHi, Guest Search the Community
Activity Communications Actions
Browse
Data Services and Data Quality
1 Tweet
In t his blog I will be explaini ng 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.
Introduction 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
Output Need to Mapped to Target
Step by Step Details of Process Followed1) 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.
Use of User-Defined Transform in Data Service 4.X for Accessing Web Service Part 1
Posted by Titto An tony in Data Services and Data Quality on 10-May-2013 08:49:29
Share 2 1Like
http://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215254/1.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215254/1.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215254/1.jpghttp://scn.sap.com/people/titto.antonyhttp://scn.sap.com/community/data-services/bloghttp://scn.sap.com/people/titto.antonyhttp://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1http://server_path/http://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215254/1.jpghttps://twitter.com/intent/tweet?hashtags=scn&original_referer=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F05%2F10%2Fuse-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1&ref_src=twsrc%5Etfw&text=Use%20of%20User-Defined%20Transform%20in%20Data%20Service%204.X%20for%20Accessing%20Web...&tw_p=tweetbutton&url=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F05%2F10%2Fuse-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1&via=SAPCommNethttp://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-2http://scn.sap.com/community/data-services/blog/2013/05/09/how-to-use-history-preserving-transformhttp://scn.sap.com/community/data-services/bloghttp://scn.sap.com/contenthttp://scn.sap.com/actionshttp://scn.sap.com/communicationshttp://scn.sap.com/activityhttp://scn.sap.com/login.jspahttp://scn.sap.com/community/data-services/blog/2013/05/10/login.jspahttp://scn.sap.com/community/uachttp://scn.sap.com/community/developer-centerhttp://scn.sap.com/community/downloadshttp://scn.sap.com/welcomehttps://www.sapstore.com/?url_id=banner-US-2015-SCN-HeadLinkhttp://scn.sap.com/community/newslettershttp://scn.sap.com/community/getting-started
8/17/2019 Use of User-Defined Transform in Data Service 14...pdf
2/7
5/9/2016 Use of User-Defined Transform in Data Service 4... | SCN
http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1 2/7
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.
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.
http://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215307/3.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215306/2.jpg
8/17/2019 Use of User-Defined Transform in Data Service 14...pdf
3/7
5/9/2016 Use of User-Defined Transform in Data Service 4... | SCN
http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1 3/7
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.
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 GroupForming 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
ith 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
6) Click the Launch Python Editor button to access the Python Expression editor.
http://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215314/7.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215313/6.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215312/5.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215308/4.jpg
8/17/2019 Use of User-Defined Transform in Data Service 14...pdf
4/7
5/9/2016 Use of User-Defined Transform in Data Service 4... | SCN
http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1 4/7
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.
) 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.
) 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 explanat ion the python expression will be given in the part 2 for your
reference
http://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215317/10.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215316/9.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215315/8.jpg
8/17/2019 Use of User-Defined Transform in Data Service 14...pdf
5/7
5/9/2016 Use of User-Defined Transform in Data Service 4... | SCN
http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1 5/7
0) 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.
1) 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
) Next we have to map the output of the User-Defined mapping to the target table and run the
ob. Here in my target table the field value coming from the user-defined transform is mapped to
DESC field in the target.
http://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215320/13.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215319/12.jpghttp://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215318/11.jpg
8/17/2019 Use of User-Defined Transform in Data Service 14...pdf
6/7
5/9/2016 Use of User-Defined Transform in Data Service 4... | SCN
http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1 6/7
Average User Rating
(11 ratings)
1 Tweet
3) 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 usingconventional ways available in the BODS.
4322 ViewsProducts: sap_businessobjects_business_intelligence_platform_4.0 Topics: business_intelligence Industries: professional_services
Tags: rest , python , webservice , bods , data_quaity , user_defined_transform , restful_webservice , access_webservice , website_access ,sap_bods_webservice , soap_webservice , sap_bods
Share 2 1Like
6 Comments
Like (2)
Titto Antony 17-May-2013 13:22
please visit http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-2 for details on pythone used.
Like (1)
Mikhail Budilov 01-Dec-2013 23:41
Add sup port Python 3.3.x in DS : View Idea
Like (0)
Titto Antony 19-Sep-2014 14:06 (in response to Mikhail Budilov)
Done Mikhail nice initiative and its useful..
Like (1)
Pan Cheng 19-Sep-2014 15:52
Nice one..
Like (0)
Shan eel 25-May-2015 07:58
Hi, Does the web service have to be configured by a SAP Basis person or can it be done by aDeveloper?
Also would you be able to help me on what checks/configurations need to be done to get theWeb Service to work? I am currently trying to consume a SharePoint Web Service, and I am new to SAP. Thank You,Shaneel.
Like (0)
Titto Antony 28-Jun-2015 19:26 (in response to Shan eel)
You can directly consume the web service if it is accessible form the job server machine.
http://scn.sap.com/people/titto.antonyhttp://scn.sap.com/people/shanzohttp://scn.sap.com/people/pan.chenghttp://scn.sap.com/people/mikhail.budilov4http://scn.sap.com/people/titto.antonyhttps://ideas.sap.com/ct/ct_a_view_idea.bix?c=34503CB9-F213-4EF9-8603-E500CB16D712&idea_id={63BBBB2B-3E0B-4444-93E6-F23C7BE977C0}http://scn.sap.com/people/mikhail.budilov4http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-2http://scn.sap.com/people/titto.antonyhttp://scn.sap.com/community/data-services/blog/tags#/?tags=sap_bodshttp://scn.sap.com/community/data-services/blog/tags#/?tags=soap_webservicehttp://scn.sap.com/community/data-services/blog/tags#/?tags=sap_bods_webservicehttp://scn.sap.com/community/data-services/blog/tags#/?tags=website_accesshttp://scn.sap.com/community/data-services/blog/tags#/?tags=access_webservicehttp://scn.sap.com/community/data-services/blog/tags#/?tags=restful_webservicehttp://scn.sap.com/community/data-services/blog/tags#/?tags=user_defined_transformhttp://scn.sap.com/community/data-services/blog/tags#/?tags=data_quaityhttp://scn.sap.com/community/data-services/blog/tags#/?tags=bodshttp://scn.sap.com/community/data-services/blog/tags#/?tags=webservicehttp://scn.sap.com/community/data-services/blog/tags#/?tags=pythonhttp://scn.sap.com/community/data-services/blog/tags#/?tags=resthttp://scn.sap.com/community/data-services/blog/tags#/?tags=professional_serviceshttp://scn.sap.com/community/data-services/blog/tags#/?tags=business_intelligencehttp://scn.sap.com/community/data-services/blog/tags#/?tags=sap_businessobjects_business_intelligence_platform_4.0http://scn.sap.com/servlet/JiveServlet/showImage/38-84780-215321/14.jpghttps://twitter.com/intent/tweet?hashtags=scn&original_referer=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F05%2F10%2Fuse-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1&ref_src=twsrc%5Etfw&text=Use%20of%20User-Defined%20Transform%20in%20Data%20Service%204.X%20for%20Accessing%20Web...&tw_p=tweetbutton&url=http%3A%2F%2Fscn.sap.com%2Fcommunity%2Fdata-services%2Fblog%2F2013%2F05%2F10%2Fuse-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1&via=SAPCommNet
8/17/2019 Use of User-Defined Transform in Data Service 14...pdf
7/7
5/9/2016 Use of User-Defined Transform in Data Service 4... | SCN
http://scn.sap.com/community/data-services/blog/2013/05/10/use-of-user-defined-transform-in-data-service-4x-for-accessing-web-service-part-1 7/7
Follow SCNSite Index Contact Us SAP Help PortalPrivacy Terms of Use Legal Disclosur e Copyright
http://www.sap.com/corporate-en/our-company/legal/copyright/index.epxhttp://www.sap.com/corporate-en/our-company/legal/impressum.epxhttps://accounts.sap.com/ui/public/viewTextResource?scenario=SCN&spId=504efd8ee4b0555c3c17b94e&resourceType=RESOURCE_TERMS_OF_USE&version=1&spDisplayName=SAP%20Community%20Network&locale=enhttps://accounts.sap.com/ui/public/viewTextResource?scenario=SCN&spId=504efd8ee4b0555c3c17b94e&resourceType=RESOURCE_PRIVACYPOLICY&version=1&spDisplayName=SAP%20Community%20Networkhttp://help.sap.com/http://scn.sap.com/docs/DOC-18476http://scn.sap.com/docs/DOC-19361http://spr.ly/SCNgoogleplushttp://bit.ly/SCNyouThttp://bit.ly/SCNFBhttp://bit.ly/SCNTwR