Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Hello Experts,

I have read many blog posts for performing the REST Look up using Java mapping but I felt it would be helpful if we can achieve REST look up using UDF. Hence I have tried blogging one of the scenario where I have used REST Look up using UDF.


Scenario: We have a scenario where a field 'Code' value has to be checked in the target system for its existence.  Based on its existence I have to pass the value "True" if it exits else I have to pass "False" in my UDF.


Step1: Create a receiver communication channel for your look up using REST adapter.

Communication Channel : CC_LookupChannel_REST

Create a Message type to receive your response message through the lookup channel and assign the message type in the Element name and its namespace respectively.

Step2: Create your Message mapping as required and pass the required source fields to the UDF as inputs. In my case I have passed a value ID and Bussiness Component and Lookup Channel Names as inputs to the UDF.

Step3: Create the UDF in your message mapping using the below code.

Here I am passing business component and Lookup channels as inputs which are passed using parameterized mapping.


Parameterized Mapping Values:

Following Parameterized values are to be passed from your ICO/IFLOW.

Lookup Channel Name(ChannelName): CC_LookupChannel_REST

Business Component: BC_Target



public void RESTLookup(String[] var1, String[] BusinessComponent, String[] ChannelName, ResultList result, Container container) throws StreamTransformationException{


AbstractTrace trace = container.getTrace();
String floc="";

Channel channel= LookupService.getChannel(BusinessComponent[0],ChannelName[0]);

SystemAccessor accessor = LookupService. getSystemAccessor(channel);

// Look up service xml

String RestXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns2:MT_RESTIN_V01 xmlns:ns2=\"urn:std:restlookup"><Equipment><Code>"+var1[0]+"</Code></Equipment></ns2:MT_RESTIN_V01>";

InputStream inputStream= new ByteArrayInputStream(RestXML.getBytes());

XmlPayload payload = LookupService.getXmlPayload(inputStream);

Payload RESTOutPayload = null;

RESTOutPayload =;

InputStream inps = RESTOutPayload.getContent();

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(inps);

NodeList list = document.getElementsByTagName("Code");
Node node = list.item(0);
if (node != null) {
//result.addValue( "True");
//floc = node.getNodeValue();
node = node.getFirstChild();
if (node != null) {
floc = node.getNodeValue();


}catch (Exception e) {

result.addValue( "True");
result.addValue( "False");



Hope this will be helpful 🙂


Pavan Kumar P

Reference Blog posts:

Labels in this area