RFC Lookup Tranport to QA and PROD

hi,
I have used Sravya's code to lookup for a Ztable within SRM with some customizations. Its a nice blog very helpful.
Question is all the connection parameters to the SRM box are coded in the UDF.
Now if i have to transport this to QA and PROD do i have to change the mapping in the QA and PROD or is there any other alternative?
Thanks,
Tiru

Hi,
there is another blog, that explains how to use properties files. This could be an option to put your parameters into a properties file so you just jave to adjust the properties file and not the mapping.
/people/sap.user72/blog/2006/06/07/property-file-a-smart-use-in-xi-context
An alternative is also to use the SAP Mapping Lookup API, where you would write an RFC that encapsulates the SQL call to the table and call the RFC from within the mapping. In the mapping you will just need to give an RFC communication channel which you can name the same way in each system, so you do not need to do any adjustments at all.
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples/xi mapping lookups rfc api.pdf
Regards
Christine

Similar Messages

  • Value Mapping Replication Vs RFC Lookup API Usage Pros and Cons

    Hi Ananth,
       Looking at the options you have, Value Mapping Replication might be a better option, because, by going the second route, you are just trying to simulate how a Value mapping replication works in reality.
    But, when the VMR framework is readily available, why do we need to simulate it by using Java code?
    Moreover, the java code approach will be triggered as many times and the number of messages that are triggered VS the number of times the VMR tables in the Java Runtime gets updated only when there is an entry that is added/modified in the SAP side (Which i feel is less frequent than the frequency of the messages being sent through XI).
    Regards,
    Ravi Kanth Talagana

    Hi,
    There are more issues you need to consider here:
    1) Is this static data or will it change often (the lookup data);
    2) Wether it is a good approach to keep it in middle system? if so who takes the ownership of managing it i.e. update, delete etc from time to time
    3) The tables don't seem small to me for value mapping
    I am not a big expert but i am off the opinion going RFC way as it will keep loose-coupling in place.
    However your issue for not using graphical RFC is not true though, you can pass all your line items as a single object which means only making ONE single call to ECC and then get the return the same way. Think along the lines of internal table as an object
    regards,

  • How to avoid hardcoding in RFC Lookup and JDBC Lookup during transport...

    Hi All,
      We have RFC and JDBC Lookups in some of our scenarios(JDBC to RFC synch)....Now problem is during transport of design objects, we have to change the business system and channel name manually in UDF in target environment....as it wont change although we define the target group in SLD.....we want to avoid this hardcoding.....one idea is we can use a business service inspite of business system and assign the comm channel to it.....this business service will be generic for all environment(dev,qua and prod)...and hence we dnt hav to hardcode....pls let me knw how to achieve or its possible or not....
    waiting for ur inputs....
    Regds,
    Pinangshuk.

    Hi,
    For RFC lookup you might be doing hardcoding for Business system and RFC channel name.
    Options are
    1) Create value mapping for Business system. So you can maintain it in Directory part.
    2) Keep the RFC channel name same for all system (Development, Quality, Production)
        The details of channel can be changed in the Directory part of the respective system

  • RFC lookup with context values importing and exporting

    Hi,
    Input parameters for my RFC Lookup:
             one simple field: Occurrence 1
             one table type: Occurrence N
    I am getting table values from RFC Lookup
    and I need to repeat all values in the target structure.
    I am not able to capture the all values in the mapping: Help needed.
    Ramesh

    Hi Ramesh,
    If you want to use the first output to be repeated in all your mapping, try using the UseOneAsMany tool in the Message Mapping.
    HTH
    Regards,
    Juan

  • Graphical message mapping examples for JDBC and RFC lookup

    hi, can any body provide me graphical message mapping examples for the "JDBC Lookup" function and "RFC Lookup" function?
    I'm now studying the graphical message mapping and want to try those 2 functions. thank you.
    I expect the examples to be simple enoung, not need to set up much.

    >
    Madhu_1980 wrote:
    > can u check this link:
    >
    > PI 7.0 & 7.1 Mapping - Blogs,Articles,Wiki,Code Samples and Videos Collections https://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=79955426  
    >
    > it contains a link : SAP PI 7.1 Mapping Enhancements Series: Graphical Support for JDBC and RFC Lookups /people/jin.shin/blog/2008/02/15/sap-pi-71-mapping-enhancements-series-graphical-support-for-jdbc-and-rfc-lookups
    May be I'm too foolish to follow those links, I got issues of each links.
    What I really want is an example from step0
    Swarup:
    Refer the Lookup document - Easy Lookup in Process Integration 7.1
    https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/20befc9a-aa72-2b10-ae9b-b0988791d457
    The first step is "Create an RFC Enabled Function Module for look up", but where can I create the function module? Should I use ESB, IB? or use transaction 'SE11' ?
    Kulkarni:
    Very good links for RFC lookup with 7.0/3.0
    https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/70d90a91-3cf4-2a10-d189-bfd37d9c3231&overridelayout=true
    At page6 "PI Development/Configuration", it saies "You are on the design maintenance screen in the Integration Builder.Expand the subnodes for the software component version for which you want to import interfaces".
    What is "design maintenance screen" ? My IB version is: Service Pack:08 Release:NW07_08_REL.
    When I open IB, it display a screen titled with "Configuration: Intergation Builder", I did not find "software component version" node on the left tree.
    Madhu_1980 :
    it contains a link : SAP PI 7.1 Mapping Enhancements Series: Graphical Support for JDBC and RFC Lookups /people/jin.shin/blog/2008/02/15/sap-pi-71-mapping-enhancements-series-graphical-support-for-jdbc-and-rfc-lookups
    The Prerequisites state:
    The JDBC channel to be used for the lookup must be configured and activated in the Integration Directory.
    The definition of the table used for the lookup must already be imported into the ES Repository as an external definition
    But I don't know how to create a JDBC channel and define the table.

  • RFC Lookup API error in PI 7.1?

    Hi Guys,
    The RFC lookup which has been developed in PI 7.0 using the lookup API is unable to find the CC defined in the directory for a business system. after upgrading to PI 7.1. We are getting the error as below. This look up works perfectly fine in Dev(PI 7.1) and QA(PI 7.1) but in Prod(PI 7.1). We are on PI 7.1 EHP1 SP03.
    Errorcom.sap.aii.mapping.lookup.LookupException: Plain exception:Error when calling an adapter by using the communication channel In_RFC_SAPLookUp (Party: , Service: Test, Object ID: 74e5e47336133351bebcb8c6a6bc68c8) The channel with object ID 74e5e47336133351bebcb8c6a6bc68c8 could not be found in the Integration Server Java Cache. Check if the channel exists in the Integration Builder Directory and execute a refresh of the Java Cach.
    We did the cache refresh and also restarted the prod server but the error still persists. We have tried connecting to the prod receiver sap system from QA and the lookup works perfectly fine. We dont understand why it dosent work in prod.
    any help or suggestions would be really appreciated.
    Thanks,
    Srini

    Hi Rajesh,
    The CC has the correct business system. We have also tried even by creating a new cc and it always says it cannot find the defined cc from the RFC lookup. We are passing this value as a constant value to the RFC lookup.
    I could not understand why it is not finding only this CC? Is this something that RFC lookup is unable to find the CC?
    any help would be appreciated
    Thanks,
    Srini

  • RFC lookup error

    Hi all,
    I am doing an RFC lookup to increment counter. I am facing a problem.
    I followed the code written by Michael. https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    My udf is as shown below: -
    String content = "";
    MappingTrace importanttrace;
    importanttrace = container.getTrace();
    java.util.Map param = container.getTransformationParameters();
    String MSGID = (String) param.get (StreamTransformationConstants.MESSAGE_ID);
    // filling the string with our RFC-XML (with values)
    String m="<?xml version="1.0" encoding="UTF-8"?><ns0:_-GLB_-ZGT_RFBIBL00_COUNTER xmlns:ns0="urn:sap-com:document:sap:rfc:functions"><IM_V_FILENAME>CA10.NCH.FCIPAY04</IM_V_FILENAME><IM_V_MSGID>"MSGID"</IM_V_MSGID><IM_V_WRNO>DEVWR0001725</IM_V_WRNO></ns0:_-GLB_-ZGT_RFBIBL00_COUNTER>";
    importanttrace.addWarning("Input value is  "+m);
    RfcAccessor accessor = null;
    ByteArrayOutputStream out = null;
    try
    // 1. Determine a channel (Business system, Communication channel)
    Channel channel = LookupService.getChannel(receiverBS,"CC_RFC_RCV_AMS_R3F_DEVWR001725");
    // 2. Get a RFC accessor for a channel.
    accessor = LookupService.getRfcAccessor(channel);
    // 3. Create a xml input stream representing the function module request message.
    InputStream inputStream = new ByteArrayInputStream(m.getBytes());
    // 4. Create xml payload
    XmlPayload payload = LookupService.getXmlPayload(inputStream);
    // 5. Execute lookup.
    Payload result = accessor.call(payload);
    InputStream in = result.getContent();
    out = new ByteArrayOutputStream(1024);
    byte[] buffer = new byte[1024];
    for (int read = in.read(buffer); read > 0; read = in.read(buffer)) {
    out.write(buffer, 0, read);
    content = out.toString();
    catch(LookupException e)
    importanttrace.addWarning("Error while lookup " + e.getMessage() );
    catch(IOException e)
    importanttrace.addWarning("Error " + e.getMessage() );
    finally
    if (out!=null) {
    try {
    out.close();
    } catch (IOException e) {
    importanttrace.addWarning("Error while closing stream " + e.getMessage() );
    // 7. close the accessor in order to free resources.
    if (accessor!=null) {
    try {
    accessor.close();
    } catch (LookupException e) {
    importanttrace.addWarning("Error while closing accessor " + e.getMessage() );
    //returning the result u2013 RFC-XML.response
    if ((content.substring(143,150)).equals("NOENTRY"))
    ExceptionThrower.generate("INVALID INPUT DEVWR NUMBER OR ID" );
    return "Nothing";
    else
    return (content.substring(143,155));
    The problem i am facing is that, i am not able to pass the IM_V_MSGID parameter to the function module.
    The other 2 parameters i can pass. that is IM_V_FILENAME and IM_V_WRNO.
    i am able to extract the message ID using
    java.util.Map param = container.getTransformationParameters();
    String MSGID = (String) param.get (StreamTransformationConstants.MESSAGE_ID);
    and displayed it in SXI_MONITOR trace also using importanttrace.addWarning("Input value is  "+m);
    i got the correct MSGID in the trace.But the problem is that this value is not getting passed to the FM. Cos the table is supposed to increment the counter whenever the MSGID value changes.
    I tried hardcoding the MSGID value to 'abc' or '123' like values but the same thing happended. The counter will not increment. The FM is working perfectly when i run it and change the MSGID values manually.
    Thanks
    Pratichi

    Hi,
    We have done this by creating an FM in XI ABAP stack:
    FUNCTION Z_ZBXI_GET_PRE_MSG_ID.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_CURRMSGID) TYPE  CHAR40
    *"  EXPORTING
    *"     VALUE(E_PREMSGID) TYPE  CHAR40
    DATA: lv_currmsgid type SXMSPMAST-MSGGUID,
          lv_parentmsgid LIKE SXMSPMAST-PARENTMSG,
          lv_premsgid LIKE SXMSPMAST-MSGGUID.
    lv_currmsgid = i_currmsgid.
    select single PARENTMSG from SXMSPMAST into lv_parentmsgid where MSGGUID = lv_currmsgid.
    e_premsgid = lv_parentmsgid.
    ENDFUNCTION.
    You need to call this FM through RFC lookup UDF in your mapping.
    Let me know if it works for you.
    Regards,
    Shweta

  • Problem in RFC Lookup

    Hi,
    I am performing RFC lookup using Communication Channel.
    I have used a function called "Z_MATERIAL_DETAILS".
    Input to this function is "MATERIALID" and Output of the function is "MATNR".
    I am using the following code in my UDF for performing lookup::
    //write your code here
    final String CHANNEL_NAME = "CC_RFC_LookUp",
                   VALNOTFOUND = "VALUE_NOT_FOUND",
                   SAPRFCNS = "urn:sap-com:document:sap:rfc:functions",
                   TAG_FM = "Z_MATERIAL_DETAILS",
    //               TAG_QTB = "QUERY_TABLE",
                   TAG_QFL = "UOMCODE"; //UOMCODE
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              DocumentBuilder builder = null;
              factory.setNamespaceAware(false);
              factory.setValidating(false);
              try {
                   builder = factory.newDocumentBuilder();
              } catch (Exception e) {
              //     trace.addWarning("Error creating DocumentBuilder - " + e.getMessage());
                   result.addValue(e.toString());
              Document docReq = null;
              try {
                   // Building up RFC Request Document
                   docReq = builder.newDocument();
                   Node root = docReq.appendChild(docReq.createElementNS(SAPRFCNS, TAG_FM));
                   root.appendChild(docReq.createElement(TAG_QFL)).appendChild(docReq.createTextNode(resultFieldName[0]));
              } catch (Exception e) {
              //     trace.addWarning("Error while building RFC Request  - " + e);
                   result.addValue(e.toString());
         //     trace.addInfo("RFC Request XML: " + docReq.toString());
              // Lookup
              Payload result1 = null;
              try {
                   Channel channel = LookupService.getChannel("EC1CLNT800", "CC_RFC_LookUp");
                   RfcAccessor accessor = LookupService.getRfcAccessor(channel);
                   InputStream is = new ByteArrayInputStream(docReq.toString().getBytes());
                   XmlPayload payload = LookupService.getXmlPayload(is);
                   result1 = accessor.call(payload);
              } catch (LookupException e) {
              //     trace.addWarning("Error during lookup - " + e);
                   result.addValue(e.toString());
              // Parsing RFC Response Document
              Document docRsp = null;
              try {
                   docRsp = builder.parse(result1.getContent());
              } catch (Exception e) {
              //     trace.addWarning("Error when parsing RFC Response - " + e.getMessage());
                   result.addValue(e.toString());
              //trace.addInfo("RFC Response XML: " + docRsp.toString());
              String res = "";
              try {
                   res = docRsp.getElementsByTagName("UOMTEXT").item(0).getFirstChild().getNodeValue();
              } catch (Exception e) {
              //     trace.addWarning("Result value not found in DOM - " + e.getMessage());
                   result.addValue(e.toString()+VALNOTFOUND);
              result.addValue(res);
    Code in Z_MATERIAL_DETAILS ::
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(UOMCODE) LIKE  MARA-MFRPN OPTIONAL
    *"  EXPORTING
    *"     VALUE(UOMTEXT) LIKE  MARA-MATNR
    *"  EXCEPTIONS
    *"      val_not_found
    <b>select single matnr from mara into uomtext where mfrpn = uomcode.</b>
    if sy-subrc <> 0.
    raise val_not_found.
    endif.
    ENDFUNCTION.
    <b>When i send three material ids the function module will access the R/3 system thrice which will give rise to PERFORMANCE ISSUE.
    So,is there any way to send all the materialids at one time to Function module and similarly receive all the MATNR from Function at once,so that we need to access R/3 system only once.</b>

    HI,
    Check this link for passing table parameter in JCO call.
    http://www.sapdevelopment.co.uk/java/jco/jco_callfunc.htm
    Following is the code for retrieving table parameter in JCO call to function BAPI_PO_CREATE.
    JCO.Table return_tab = function.getTablesParameterList().getTable("RETURN");
    if (return_tab.getNumRows()) > 0 {
    // Output the error messages
      return_tab.firstRow();
      do {
        System.out.println(return_tab.getString("MESSAGE");
      while (return_tab.nextRow());
    } else {
      String PO_NUM = function.getExportParametersList().getString("PURCHASEORDER");
      System.out.println("Purchase order " + PO_NUM + " created");
    Thanks and Regards,
    Sandeep Maurya.

  • RFC Lookup in XSLT Mapping

    Hi,
    I am trying to do RFC Lookup in XSLT.
    I got this excellent mapping tool here at sdn:
    RFC Lookup by Thorsten Nordholm Søbirk
    But I am having problems when I uses this in a multi-record mapping. (many-to one) with lookup for every element.
    Has anyone done IDOC with XSLT and RFC lookup (PI 7.11) ?  Can you share the XSLT or experience?
    Thx for sharing

    Hi @ Fariah Ali
    here is the mapping:
    Inbound: IDOC HRMD_A07  (from ALE replication)
    We only want to have Infotypes IT0001, IT0002, IT0050
    Outbound:
    <?xml version="1.0" encoding="utf-8"?>
    <mt_I004_Time_Stammdaten>
        <Datensatz>
              <PersNr>PERSNR</PersNr>
              <Name>ENAME</Name>
              <Eintrittsdatum>BEGDA</Eintrittsdatum>
              Austrittsdatum>ENDDA</Austrittsdatum>
             <BeschArt/>
             <Gueltigkeitsdatum/>
       </Datensatz>
    </mt_I004_Time_Stammdaten>
    thx holger

  • XSLT Mapping : RFC Lookup using java helper class

    Hi All,
    I am doing RFC Lookup in xslt mapping using java helper class. I have found blog for the same (http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14) However this blog is very advanced.
    Can anybody help me with step by step approach for the same?
    My basic questions are not answered in the blog as:
    1) where to add the jar file of the java class used in xslt mapping.
    I have added zip file of XSLT mapping in imported archived and using that in mapping.
    Thanks in advace.
    Regards,
    Rohan

    Hi,
    Can u please have look at this in detail , u can easily point out yourself the problem...
    http://help.sap.com/saphelp_nw04/helpdata/en/55/7ef3003fc411d6b1f700508b5d5211/content.htm
    Please observe the line,
    xmlns:javamap="java:com.company.group.MappingClass
    in XSLT mapping..
    The packagename of class and class name and XSLT namespace should be matching...
    Babu
    Edited by: hlbabu123 on Sep 29, 2010 6:04 PM

  • RFC Lookup mapping error in PI 7.1

    Hi Experts,
    I´m getting mapping error when executing interface SOAP -> WS (SAP ECC) . The message mapping call RFC Lookup to SAP ECC.
    When test the message mapping in Integration Builder the interface calls communication channel by RFC Lookup and works fine.
    That interface was imported from QAS environment and was working fine, but in PRD it doesn´t works.
    I checked the Interface Determination and the parameter is filled correctly with communication channel. The same communication channel was used on message mapping test.
    The Interface Determination in SXI_CACHE has no value assigned to parameter in PRD environment, otherwise, the same interface determination in SXI_CACHE in QAS environment there is value (CC ID).
    The problem persists after Cache Refresh in SXI_CACHE and CPA Cache.
    Can anyone help me ?
    Thanks in advance,
    Regis Ferrato
    Bellow the trace of error ocurred:

    Hi Regis,
    Please check my reply in your other thread:
    Re: RFC Lookup error cache in PI 7.1
    Regards,
    ---Satish

  • Exception Handling in RFC lookup

    Hi Experts,
    I have a query in RFC Lookup function working with PI 7.1,  file to Idoc scenario.
    I am using Enhance Receiver Determination to find the dynamic recivers.Here we have used a Functional Module which gives an output according to the the input parameter (which comes from input file). thus i have used RFC lookup to the remote system to fetch this info from FM.
    Problem -
    When the remote system is down or if the RFC lookup attemped & exceptions raised for some reason (RFC user authority has been changed & it was not able to perform the intended Job at remote system) , the message stuck in queue and block the several other messages from another interfaces which belongs to teh same queue.
    Queries-
    This is not allowed in production as it affects other services.
    1>how can we handle the RFC lookup exception (in case of remote system is down or if the RFC lookup exception)
    2>how can we perform Local lookup at PI box rather then remote lookup (the FM fetches the data from remote system)
    3>Is Value mapping is relevant in this case raher the RFC lookup ? I am not sure as the values are dynamic & selected as per the FM's output.
    Please provide your valuable insight .
    Thanks in advance !
    -Jyoti

    Hi Jyoti,
    Answer for your 3 question.
    1. RFC lookup will get execute on R/3 so if R/3 is down there no way that your RFC lookup will work as expected.
    2. So if R/3 is down or RFC not able to get receiver system due to some problem.. then in that case.
              On your Receiver determination at bottom
              Configure  u201Cif no receiver found proceed as followingu201D
               In this you can have 3 option.
                        a. Error message u2013 if you select this the transaction will end with error message in SXMB_MONI
                        b. Ignore: if you select this execution will get ignored and there will not be any entry in SXMB_MONI
                        c. Select the following receiver. You can select this and can configured default receiver system in case if RFC not able to determine receiver then interface will get route to receiver system configured here.
    3. As you mentioned values are dynamic  then Value mapping doesnu2019t make any sense here. RFCl ookup is the right option and above are few other option in case you RFC lookup flailed.
    Thanks,
    Bhupesh

  • Java Error in RFC Lookup in XSLT Mapping usinf Java helper class

    Hi All,
    I am doing RFC Lookup in XSLT Mapping using Java Helper class.
    The Lookup works fine when called one RFC at a time However my requirement is I want to do 2 Lookups.
    Both Lookups works when done individually however when I call both lookups in one mapping I get following error "javax.xml.transform.TransformerException: DOMSource whose Node is null."
    Following is the code I have written in XSLT for the lookup:
         <xsl:template name="Lookup_1">
              <xsl:param name="STDPN"/>
                   <rfc:RFC_READ_TABLE>
                        <QUERY_TABLE>KNA1</QUERY_TABLE>
                        <OPTIONS><item><TEXT>
                                  <xsl:value-of select="$STDPN"/>
                             </TEXT></item>
                        </OPTIONS>
                        <FIELDS>
                             <item>
                                  <FIELDNAME>KUNNR</FIELDNAME>
                             </item>
                        </FIELDS>
                   </rfc:RFC_READ_TABLE>
              </xsl:variable>
              <xsl:variable name="response" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request, 'BS_D, 'cc_RfcLookup', $inputparam)"/>
              <xsl:element name="STDPN">
                   <xsl:value-of select="$response//DATA/item/WA"/>
              </xsl:element>
         </xsl:template>
         <xsl:template name="Lookup_2">
              <xsl:param name="BELNR"/>
                   <xsl:variable name="Query">AGMNT = '<xsl:value-of select="$BELNR"/>'</xsl:variable>
                   <xsl:variable name="request1">
                        <rfc:RFC_READ_TABLE>
                             <QUERY_TABLE>ZTABLE</QUERY_TABLE>
                             <OPTIONS><item><TEXT>
                                  <xsl:value-of select="$Query"/>
                                  </TEXT></item>
                             </OPTIONS>
                             <FIELDS>
                                  <item>
                                       <FIELDNAME>KUNAG</FIELDNAME>
                                  </item>
                             </FIELDS>
                        </rfc:RFC_READ_TABLE>
                   </xsl:variable>
                   <xsl:variable name="response1" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request1, 'BS_D','cc_RfcLookup', $inputparam)"/>
                   <xsl:element name="BELNR">
                        <xsl:value-of select="$response1//DATA/item/WA"/>
                   </xsl:element>
         </xsl:template>
    My Question: Am I doing anything wrong? Or Is it possible to call multiple lookups in one XSLT?
    Thanks and Regards,
    Atul

    Hi Atul,
    I had the same problem like you had.
    The main Problem is that with the example code the request variable is created as NodeList object. In XSLT a variable is somekind of a constant and can't be changed. As the request object is empty after the first request the programm fails at the following line:
    Source source = new DOMSource(request.item(0));
    So I've created a workaround for this problem.
    In the call of the template I've put the request as a parameter object at the template call:
    <xsl:with-param name="req">
    <rfc:PLM_EXPLORE_BILL_OF_MATERIAL xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
      <APPLICATION>Z001</APPLICATION>
      <FLAG_NEW_EXPLOSION>X</FLAG_NEW_EXPLOSION>
      <MATERIALNUMBER><xsl:value-of select="value"/></MATERIALNUMBER>
      <PLANT>FSD0</PLANT>
      <VALIDFROM><xsl:value-of select="//Recordset/Row[name='DTM-031']/value"/></VALIDFROM>
      <BOMITEM_DATA/>
    </rfc:PLM_EXPLORE_BILL_OF_MATERIAL>
    </xsl:with-param>
    With this change the request will be provided as a String object and not as a NodeList object.
    Afterwards the RfcLookup.java has to be changed to the following:
    package com.franke.mappings;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import java.io.StringWriter;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.lookup.Channel;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.lookup.RfcAccessor;
    import com.sap.aii.mapping.lookup.LookupService;
    import com.sap.aii.mapping.lookup.XmlPayload;
    * @author Thorsten Nordholm Søbirk, AppliCon A/S
    * Helper class for using the XI Lookup API with XSLT mappings for calling RFCs.
    * The class is generic in that it can be used to call any remote-enabled
    * function module in R/3. Generation of the XML request document and parsing of
    * the XML response is left to the stylesheet, where this can be done in a very
    * natural manner.
    * TD:
    * Changed the class that request is sent as String, because of IndexOutOfBound-exception
    * When sending multiple requests in one XSLT mapping.
    public class RfcLookup {
         * Execute RFC lookup.
         * @param request RFC request - TD: changed to String
         * @param service name of service
         * @param channelName name of communication channel
         * @param inputParam mapping parameters
         * @return Node containing RFC response
         public static Node execute( String request,
                 String service,
                 String channelName,
                 Map inputParam)
              AbstractTrace trace = (AbstractTrace) inputParam.get(StreamTransformationConstants.MAPPING_TRACE);
              Node responseNode = null;
              try {
                  // Get channel and accessor
                  Channel channel = LookupService.getChannel(service, channelName);
                  RfcAccessor accessor = LookupService.getRfcAccessor(channel);
                   // Serialise request NodeList - TD: Not needed anymore as request is String
                   /*TransformerFactory factory = TransformerFactory.newInstance();
                   Transformer transformer = factory.newTransformer();
                   Source source = new DOMSource(request.item(0));
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   StreamResult streamResult = new StreamResult(baos);
                   transformer.transform(source, streamResult);*/
                    // TD: Add xml header and remove linefeeds for the request string
                    request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+request.replaceAll("[\r\n]+", ""); 
                    // TD: Get byte Array from request String to send afterwards
                    byte[] requestBytes = request.getBytes();
                   // TD: Not used anymore as request is String
                    //byte[] requestBytes = baos.toByteArray();
                    trace.addDebugMessage("RFC Request: " + new String(requestBytes));
                    // Create input stream representing the function module request message
                    InputStream inputStream = new ByteArrayInputStream(requestBytes);
                    // Create XmlPayload
                    XmlPayload requestPayload =LookupService.getXmlPayload(inputStream);
                    // Execute lookup
                    XmlPayload responsePayload = accessor.call(requestPayload);
                    InputStream responseStream = responsePayload.getContent();
                    TeeInputStream tee = new TeeInputStream(responseStream);
                    // Create DOM tree for response
                    DocumentBuilder docBuilder =DocumentBuilderFactory.newInstance().newDocumentBuilder();
                    Document document = docBuilder.parse(tee);
                    trace.addDebugMessage("RFC Response: " + tee.getStringContent());
                    responseNode = document.getFirstChild();
              } catch (Throwable t) {
                   StringWriter sw = new StringWriter();
                   t.printStackTrace(new PrintWriter(sw));
                   trace.addWarning(sw.toString());
              return responseNode;
         * Helper class which collects stream input while reading.
         static class TeeInputStream extends InputStream {
               private ByteArrayOutputStream baos;
               private InputStream wrappedInputStream;
               TeeInputStream(InputStream inputStream) {
                    baos = new ByteArrayOutputStream();
                    wrappedInputStream = inputStream;
               * @return stream content as String
               String getStringContent() {
                    return baos.toString();
              /* (non-Javadoc)
              * @see java.io.InputStream#read()
              public int read() throws IOException {
                   int r = wrappedInputStream.read();
                   baos.write(r);
                   return r;
    Then you need to compile and upload this class and it should work.
    I hope that this helps you.
    Best regards
    Till

  • Java RFC lookup from XSLT mapping

    I tried to implement a generic Java RFC Lookup class to be called as a Java extension from my XSLT mapping. I found the How-To-Guide "Easy RFC lookup from XSLT mappings using a Java helper class" ([Easy RFC lookup pdf site|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14?quicklink=index&overridelayout=true]) and tailored the source code to my XSLT program.  I am getting the error "Variable '$inputparam' has not been bound to a value".  Can anyone tell me what I am missing?  I am not familiar with java at all, and only moderately familiar with XSLT.

    > I am getting the error "Variable '$inputparam' has not been bound to a value". Can anyone tell me what I am missing?
    At runtime the variable does not get value.  You need to assign value to the variable inputparam. Just curious why dont use the RFC lookup graphical  which is very easy and no need to handle java programming. You need to configure just reciever RFC communication channel.

  • PI 7.1 EHP1 RFC Lookup- Issue

    Friends,
    I'm seeing one strange issue in RFC Lookup behavior in my PI 7.1 EHP1 . Please give me some ideas for the same
    Please see the below image for what I have done and what I'm seeing in the display queue.
    http://www.flickr.com/photos/8764045@N06/4642237515/sizes/o/
    To make it more simple - When I click on the Display queue on RFC lookup, I can see some 20 values with context changed. I removed my context and passed it to the UDF. When I check the input length in the UDF it's always giving 1, even though the display queue gives me 20 values.
    Any ideas?
    -Raj.

    Stefan/Sarvesh,
    Thanks for your replies . Please see the below snapshots for complete picture.
    UDF code & Properties -http://www.flickr.com/photos/8764045@N06/4643880555/sizes/o/
    RFC Lookup Properties -http://www.flickr.com/photos/8764045@N06/4643880541/sizes/o/
    Display Queues on UDF and RFC Lookup -http://www.flickr.com/photos/8764045@N06/4643883271/sizes/o/
    I truly appreciate all your help on this.
    -Raj.

Maybe you are looking for