Skip to Content

Document Objective: Objective of this document is to providing information about that “SFSF SOAP Channel supports for UDF based Lookups”.

This document provides an example on implementation of SFSF lookup UDF in PI Enterprise Service Repository.

Connectivity add on 1.0
Patch Lastest sca files :PICOASUF and PIADAPTERS.sca
Entity Type: SOAP
Entity Name: User
Operation Type Query
LookUp Query Select id from User where externalId in (<dynamicValues>)

Brief about Technical Scenario:

For each person_id_external Lookup Query will bring back the id from SFSF User Entity.

E.g. Input <external-Id > 346 and Output < id > would be USR-22.

Step I. Include following packages.

2.PNG

Step II. add UDF with following paramters.

/wp-content/uploads/2014/10/3_566355.png

Step III. UDF Code.

AbstractTrace trace = container.getTrace();

String Var_Username =””;

for (int inlen = 0; inlen < Var_ExternalID.length; inlen++)

{

Var_Username = Var_Username+”,”+”‘”+Var_ExternalID[inlen]+”‘”;

}

Var_Username = Var_Username.substring(1,Var_Username.length());

try

  {

Payload SOAPOutPayload = null;

String SysName =””;

String BuisnessSysName =””;

BuisnessSysName = “SUCCESS_FACTORS_DEV”;

Channel channel = LookupService.getChannel( BuisnessSysName,”Common_SF_SFAPI_Receiver”);

SystemAccessor accessor = LookupService.getSystemAccessor(channel);

String SOAPxml =”<?xml version=\”1.0\” encoding=\”UTF-8\”?><ns0:query
xmlns:ns0=\”urn:sfobject.sfapi.successfactors.com\”><ns0:queryString>Select id,externalId from User where externalId in ( “+Var_Username+”)</ns0:queryString></ns0:query>”;

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

XmlPayload payload = LookupService.getXmlPayload(inputStream);

SOAPOutPayload = accessor.call(payload);

InputStream inp = SOAPOutPayload.getContent();

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(inp);

document.getDocumentElement().normalize();

NodeList list = document.getElementsByTagName(“id”);

NodeList Elist = document.getElementsByTagName(“externalId”);

for (int temp =0; temp < list.getLength(); temp++)

{

Node node = list.item(temp);

Node Enode = Elist.item(temp);

if (node != null)

{

node = node.getFirstChild();

Enode = Enode.getFirstChild();

if (node != null)

{

result.addValue(node.getNodeValue()+”||”+Enode.getNodeValue());

}

}

}

}

catch (Exception e)

{

trace.addWarning(“Error” + e);

  result.addValue(e);

}

Step IV: Communication Channel.

/wp-content/uploads/2014/10/9_566419.png

Step V : Testing and UDF Execution

4.PNG

5.PNG

/wp-content/uploads/2014/10/6_566361.png

Request Message to Successfactors

/wp-content/uploads/2014/10/7_566417.png

Response back from Successfactors

/wp-content/uploads/2014/10/8_566418.png

Please do write back your comments and Queries. 

To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Ambrish Mishra

    Hi Prabhat,

    Nice Blog!

    I am looking to fetch Job function for a set of Job codes from Success Factors. I have posted a query https://answers.sap.com/questions/323345/look-up-in-success-factors-from-sap-po-graphical-m.html as well. I think the UDF way you suggested can help achieve this. Not sure if the Select will retrieve the Job functions in sequence from the Job Codes passed as SELECT JOB_FUNCTION from FO_JOBCODE where JOBCODE IN (multiple values of Job codes).

    Hope I was able to explain the requirement.

    thanks

    Ambrish

    (0) 
  2. Ambrish Mishra

    Hi Prabhat,

    Just to update you… It gave me an error when I tried to the query “SELECT JOB_FUNCTION from FO_JOBCODE where externalCode IN (multiple values of Job codes)”

    externalCode is Jobcode in FO_JOBCODE.

    The error message in SF says “Query failure! Error: IN for externalCode field is not supported”

    any ideas on how to overcome this ?

    thanks

    Ambrish

     

     

     

    (0) 

Leave a Reply