UDF or Adapter?

XI Geeks,
we have a scenario IDOC to file.
can create file at OS level using UDF with no Receiver  & Sender agreements.
when UDF can serve the purpose of an adapter what else we need,just need configuration part in identifying the right UDF thorugh reciever and interface determination.
my question is in what way UDF can command over Adapter  performance factor for the above scenario.
Thanks & Regards,
Rama Krishna

HI Rama,
Please can you be more clarified about usag of your UDFs to download or upload the file.
Adapters are used to communicate with FTP server. PRobably with UDFs you may have restricted only to NFS protocol.
You have not required sender and receiver agreement coz, you have downloaded or uploaded the fiel on XI server only and its in XML format.
But for any conversions youhave to go for File adapter.
Even from the security perceptive (FTPS/SFTP) you have to go for adapters.
Thanks
swarup

Similar Messages

  • Java Mapping (not UDF) and Adapter-Specific Message Attributes

    Hello everybody,
    is it possible to create an Adapter-Specific Message Attributes in a java Mapping?
    I found in the SAP Help that the API com.sap.aii.mapping.api.DynamicConfiguration allows only to read, change or delete the attributes.
    best regards.
    Adnane Elgoute

    Hi,
    try the follwoing code
    import com.sap.aii.mapping.api.*;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.HashMap;
    import java.util.Map;
    public class JavaProgram
        implements StreamTransformation
        public JavaProgram()
        public void setParameter(Map map)
            param = map;
            if(param == null)
                param = new HashMap();
        public void execute(InputStream inputstream, OutputStream outputstream)
            try
                DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get("DynamicConfiguration");
                DynamicConfigurationKey dynamicconfigurationkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
                String s = dynamicconfiguration.get(dynamicconfigurationkey);
             //Your logic
            catch(Throwable throwable)
                throwable.printStackTrace();
        private Map param;

  • File to File with no mapping (different filename)

    I have a requirement to change the name of the filename in a file-to-file scenario.  The prefix of the file will stay the same, but the target file needs to have a date format replace main part of the file.  The date format is also specific YYYYMM.  Below are the two examples of the source and target filenames.  We are not doing a message mapping with this scenario.
    Source: CA_MONTHLY_REPORT.txt    Target: CA_200901_01.txt
    Source: US_MONTHLY_REPORT.txt    Target: US_200901_01.txt
    The date needs to be calculated off a date function for current month and year.
    Is this possible to do?
    Thanks
    Skip Ford

    With mapping (UDF) it is easy. But I guess you're not allowed to use mapping, you would need to introduce adapter module.
    I think with the standard configuration, you can not archive it. You have to use either UDF or adapter module.
    Jayson

  • Missing Message Attributes: URL/HTTP Destination

    Hello,
    following scenario:
    There is a sync. interface between SAP PI ante the Paypal API within the HTTP adapter calling a dynamic URL.
    The dynamic URL is created as mentioned in this blog: http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/7264. [original link is broken]
    Also the HTTP adapter is configured as described (Adapter Specific Message Attributes and URL are flagged).
    Following error occours when testing the call:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIAdapter</SAP:Category>
      <SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_MISSING_URL</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>Dynamic Header - Missing Message Attributes: URL/HTTP Destination</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Is there sth. special I have to consider in the HTTP Adapter?
    Thanks in advance,
    André

    Hi Michal,
    I´m passing the URL to the attribut "TargetURL" by using a UDF in my mapping.
    In the adapter I have flagged "URL".
    So the value of TargetURL set in mapping shoul be used as destination in the adapter.
    Please have a look onto my UDF used in MM:
    http://img408.imageshack.us/i/udf.jpg/
    Adapter settings:
    http://img691.imageshack.us/i/adaptersetting1.jpg/
    http://img339.imageshack.us/i/adaptersetting2.jpg/
    How can I check that the TargetURL is successfully set as a dynamic parameter?
    Thanks,
    André

  • SOAP lookups from withing message mapping

    Hi
       We are doing a call to a webservice from within a udf in a message mapping using the SOAP API described in one of the blogs in SDN. We are using a soap receiver communication channel to make this webservice call -
    We see activity on the communication channel monitoring - indicating that there is a call going out and a response coming back from the webservice. But there are no details shown on the payload in communication channel monitoring. We do not see this webservice lookup as a message on the adapter engine either ?
    Is there any place from within XI runtime environment we can get a hold of the message going out to webservice call and the return from webservice ?  We are facing problems in the webservice not doing the required action desired and hence this question on visibility of the call to the webservice.
    Thanks in advance for your time.

    My udf is basically makes a call to the webserservice lookup method ( line - CallCentralMonitoring.LogToCentralMonitoring( "IN130.10", "COMPLETED"); ) - the definition of CallCentralMonitoring class is given below after the udf
    UDF
    String adapter = "RECEIVE_FusionDBLookUpRequest";
    Channel channel = null;
    boolean retry = false;
    int noOfRetries = 0;
    String sqlQuery = new String("");
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    String parameterValue = new String("");
    MappingTrace trace = container.getTrace();
    // Build the Query String
    //sqlQuery = "select * from CTL_BusinessRules with (nolock) where parameter_key = '" + parameterKey + "'";
    sqlQuery = "exec uspCTL_GetBusinessRule '" + parameterKey + "'";
    do
         try
              //trace.addInfo( "SQL query is: " + sqlQuery);
              // Determine a channel, as created in the Configuration
              channel = LookupService.getChannel(businessService,adapter);
              // Get a system accessor for the channel. As the call is being made to a DB, a DatabaseAccessor is obtained.
              accessor = LookupService.getDataBaseAccessor(channel);
              //trace.addInfo( "Successfully obtained the system accessor..." );
              // Execute Query and get the values in resultset
              resultSet = accessor.execute(sqlQuery);
              Iterator rows = resultSet.getRows();
              //trace.addInfo( "Executed query successfully..." );
              while( rows.hasNext() )
                   Map rowMap = (Map)rows.next();
                   parameterValue =  rowMap.get("CHARACTER_VALUE").toString();
                   //trace.addInfo( "Parameter Value is: " + parameterValue );
              retry = false;
              CallCentralMonitoring.LogToCentralMonitoring( "IN130.10", "COMPLETED");
              return parameterValue;
         catch( Exception ex )
              //trace.addInfo( ex.toString() );
              if ( noOfRetries < 3 )
                   retry = true;
                   noOfRetries++;
              else
                   retry = false;
                   CallCentralMonitoring.LogToCentralMonitoring( "SD152.01", "Error");
                   ExceptionThrower.fire( "Database connectivity error: " + ex.toString() );
         finally
              try
                   if ( accessor != null ) accessor.close();
              catch( Exception e )
                   ExceptionThrower.fire("Error closing accesor: " + e.getMessage() );
                   //return e.getMessage();
    } while( retry );
    return null;
    Class CallCentralMonitoring
    package com.xxxxx.xi.mapping.udf;
    import java.io.ByteArrayInputStream;
    import java.io.InputStream;
    import com.sap.aii.mapping.lookup.Channel;
    import com.sap.aii.mapping.lookup.LookupException;
    import com.sap.aii.mapping.lookup.LookupService;
    import com.sap.aii.mapping.lookup.Payload;
    import com.sap.aii.mapping.lookup.SystemAccessor;
    import com.sap.aii.mapping.lookup.XmlPayload;
    public class CallCentralMonitoring {
         public static void LogToCentralMonitoring (String MON_EISLDCTLID, String MON_MsgStatus)  {
              String soapXML = new String("");
              /* Pass the Business System and Communication Channel as  input to the getChannel().
              /* BS_SOAPLOOKUP – Business System*CC_Webservice_SOAP_CURRENCY_CONVERTOR – Receiver SOAP Adapter */
              Channel channel = null;
              try {
                   channel = LookupService.getChannel( "EI_CentralMonitoringServives", "Receive_SOAP_TrackingServiceWS" );
              } catch (LookupException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              SystemAccessor accessor = null;
              try {
                   accessor = LookupService.getSystemAccessor(channel);
              } catch (LookupException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              /* Construct the SOAP Request Message using the InputParameters */          
              soapXML = "<LogToCentralMonitoring xmlns=\"http://xxxxx.EI.CentralMonitoring\"> <loggingData> <MON_EISLDCTLID>"
               + MON_EISLDCTLID
               + "</MON_EISLDCTLID><MON_ProgramID>"
               + MON_EISLDCTLID
               + "</MON_ProgramID><MON_ProcessID>"
               + MON_EISLDCTLID
               + "</MON_ProcessID><MON_ClientAlert>"
               + "N"
               + "</MON_ClientAlert><MON_MsgStartTimeStamp>"
               + "03/30/2007 10:00:00"
               + "</MON_MsgStartTimeStamp><MON_MsgEndTimeStamp>"
               + "03/30/2007 10:00:01"
               + "</MON_MsgEndTimeStamp><MON_MsgStatus>"
               + MON_MsgStatus
               + "</MON_MsgStatus><MON_MsgStatusDescription>"
               + MON_MsgStatus
               + "</MON_MsgStatusDescription> </loggingData> </LogToCentralMonitoring>";
              InputStream inputStream = new ByteArrayInputStream(soapXML.getBytes());
              XmlPayload payload = LookupService.getXmlPayload(inputStream);
              Payload soapOutPayload = null;
              /The SOAP call is made here and the response obtained is in the soapOutPayload./
              try {
                   soapOutPayload = accessor.call(payload);
              } catch (LookupException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         }//end LogToCentralMonitoring
    }//end class

  • How to add YYMMDD format date to the file name

    Hi,
    I need genrate the file with date suffixed to its name in YYMMDD format. The add time stamp is adding it till YYYMMDD-HHMMSSS.
    How can I change this format to the required one? Any suggessions.
    Thanks.
    Sri

    hi,
    you can create the whole filename (whatever you need)
    in the mapping (in a UDF) using adapter specific message attributes
    there are many blogs describing how to do that Dynamic Configuration of Some Communication Channel Parameters using Message Mapping
    Regards,
    Michal Krawczyk

  • Serialize IDOCs PI to SAP Backend

    HI,
    I need to serialize IDocs thats PI send to a sap backend system.
    rigth now we have one CC with max connection = 1 but it is not enough.
    but something is not clear at all for me.
    I need to send IDocs with QoS EOIO so, i asume that checking the parameter "Queue Processing" in the IDoc Receiver Channel the IDocs will sen them to SAP in EOIO, but that means --> One queue will be defined(in backend) for each IDoc that use this Channel?.
    If i set this functionality could i increase the parameter max connection to 10( for example) and the channel should know which queue was defined for each IDoc in the backend or it is not possible and I am thinking crazy things.
    Is it possible also to configure the transaction IDXQUEUE in SAP Backend?
    Best Regards.

    Searching for othar alternatives y found that is possible to change the QoS or the Queue id values in a Messager Mapping.
    Change Queue name in Message mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/6e/ff0bf75772457b863ef5d99bc92404/frameset.htm
    but as i can see, there is not possible to access the variables QUEUE_ID and QUALITY_OF_SERVICE since those are ReliableMessaging's variables(help.sap link above)
    so i can access all Main's variables like SENDER_SERVICE, MESSAGE_ID, etc etc)
    How can i get access to this ReliableMessaging's variables from UDF or Adapter Module?
    In the thread above someone mentions that was not able to modify those values in a UDF but in a Adapter Module (i asume using the same code below) what could be the difference accessing frmo UDF o Adapter Module?
    UDF Code
    java.util.Map map;
    DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey qos = DynamicConfigurationKey.create("http://sap.com/xi/XI/System","QUALITY_OF_SERVICE");
    conf.put(qos,"EOIO");
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System","QUEUE_ID");
    conf.put(key,queueName);
    return "";

  • Tools to Learn Java!

    Hi,
    Can anybody mention some freeware tools which we can download to learn core Java for UDF and adapter modules.
    I tried searching the forum and its quite confusing which one to download,.
    Regards
    Krish

    Hi,
    First you download eclipse from http://www.eclipse.org/ or NWDS from http://www.sdn.sap.com/irj/scn/downloads?rid=/library/uuid/d04ac7ef-0fe7-2c10-efb1-d27b38d730b3.
    You can refer any e-book or e-material to start from the begining if you are very new to java.
    For SAP related APIs in java, you can refer - http://help.sap.com/javadocs/pi/SP3/xpi/index.html. Here you will find all APIs which are used for any Java Development in PI.

  • Error in while calling a Soap Adapter using the UDF

    hi,
    i am trying to make a call to Soap Adapter using a UDF.
    The code of the UDF is as follows :
    InputStream isPayloadStream = null;
    AbstractTrace trace= container.getTrace();
    String sService="Business Component";
    String sChannelName="Soap Channel(Sender)";
    SystemAccessor accessor=null;
    trace.addInfo("entered UDF");
    StringBuffer sb = new StringBuffer(" ");
    trace.addInfo("creating the reference file");
    sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
    sb.append("<ns0:MT_123082_UDF xmlns:ns0=\"http//infosys.com/pi/projects/png/n1\">\n");
    sb.append("<INTERCHANGECONTRLNOS>" + var1 + "</INTERCHANGECONTRLNOS>");
    sb.append("<PGPARTNERID>"var2"</PGPARTNERID>""\n""</ns0:MT_123082_UDF>");
    trace.addInfo("trigerring the SOAP channel ");
    try{
    Channel channel = LookupService.getChannel(sService,sChannelName);
    accessor = LookupService.getSystemAccessor(channel);
    isPayloadStream = new ByteArrayInputStream((sb.toString()).getBytes());
    trace.addInfo("creating the xml payload ");
    XmlPayload payload = LookupService.getXmlPayload(isPayloadStream);
    Payload result=accessor.call(payload);
    catch (Exception e){
    trace.addInfo(e.getMessage());
    finally{
    if ( accessor !=null) {
    accessor.close();
    return " ";
    The above code is throwing an error while end to end testing.
    the scenario is such,while graphical mapping a UDF will be used, which will create an Xml payload, and send this payload to another SOAP to file scenario.
    The error in the sxmb_moni is:  "Error when calling an adapter by using the communication channel CC_123085_UDF_SOAP_OUT (Party: , Service: BC_123082_REMADV_D96A, Object ID: fa9c6ee15efc30c68ec34b08034d87d1) XI AF API call failed. Module exception: 'failed to set up the channel fa9c6ee15efc30c68ec34b08034d87d1'. Cause Exception: 'Channel stopped by administrative task.'."
    Please can anyone suggest how this error can be rectified.
    regards,
    Meenakshi

    Hi,
    i have checked the communication channel and the XML. The following error occurs everytime i try to run the scenario.
    Error:
    Error when calling an adapter by using the communication channel CC_123082_UDFRECEIVER_SOAP_IN (Party: , Service: BC_123082_REMADV_D96A, Object ID: 2a895589066d30d4b2686e9d3a8d4c8d) XI AF API call failed. Module exception: 'SOAP Error'. Cause Exception: 'SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 400 Bad Request'
    Please let me know how this error can be resolved.
    Regards,
    Meenakshi

  • UDF to get the filename for File Sender Adapter

    Hi,
    I had an requirement to get the  the Filename and map to the  target payload.
    I had configured the File Sender Adapter settings in the ID
    This is the following UDF i got from SDN.
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName;
    But when iam using this UDF iam getting an error
    RuntimeException in Message-Mapping transformation: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._MM_ORDER_CRS_OB_SAP_PROXY_IB_ method Filename$[com.sap.aii.mappingtool.tf3.rt.Context@54e154e1]
    Please help me in correcting the error.
    Thanks
    Srinivas

    Hi Jayson,
    actually, in the interface mapping, it doesn't give exception.
    The DynamicConfiguration is a constant retrieved from the container object, so it will never be returned as null (given that the container object was instantiated).
    Just the retrieved value will be null (since it was not previously set), but no exception occurs.
    In the message mapping, the container object is never instantiated, and that's the reason for the NullPointerException.
    Regards,
    Henrique.

  • Is it possible to call mail adapter in a UDF

    Hi,
    In my mapping if I find that, a field length is more than 50 I need to mail this field in the body of a mail. Can I call the receiver mail adapter in a UDF similar to RFC/JDBC adapter?
    Thanks.

    Is your scenario contains mapping apart from this?
    If not then you can use mailadapter message type provided by SAP.
    i dont think you have mapping other than as you want to pass this directly to content right?
    Its possible to access body in UDF.
    /people/samuel.chandrasekaran2/blog/2008/10/06/xi-mail-adapter-dynamically-building-attachment-and-message-body-content-using-a-simple-udf
    Rajesh

  • Same file name from sender to receiver file adapter with out using UDF

    Hi All,
    I am working on FILE TO FILE. My requirement is same file name from sender to receiver file adapter. Is it possible to do using only Adapter Specific message properties?  i mean with out using UDF.
    Thanks
    Karthik

    Hi,
    >>>Is it possible to do using only Adapter Specific message properties?
    yes
    just enable Adapter Specific message properties in sender and receiver channel for file name
    and you're done
    Regards,
    Michal Krawczyk

  • XI Alerts from UDF using file adapter.

    I need to send alerts from XI message mapping. I have the file ---> file scenario but don't want he stop the process if any failures in the mapping. If I find any failures, I need to catch the those failures and send as alerts/email report. As per the link /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function,  I am not sure whether  I can use LookupService for file adapter or not. Can anyone give me some idea on how to send the alerts from UDF using he file adapter ?

    Try this...
    public String Mail_Test(String input,Container container){
          // Recipient's email ID needs to be mentioned.
          String to = "<Recipient mail ID>";
            // Sender's email ID needs to be mentioned
          String from = "<Sender mail ID>";
           // Assuming you are sending email from localhost
           String host = "<Hostname of the SMTP server>";
           // Get system properties
           Properties properties = System.getProperties();
          // Setup mail server
          properties.setProperty("mail.smtp.host", host);
          // Get the default Session object.
          Session session = Session.getDefaultInstance(properties);
           try{
                 // Create a default MimeMessage object.
                MimeMessage message = new MimeMessage(session);
                 // Set From: header field of the header.
                 message.setFrom(new InternetAddress(from));
                 // Set To: header field of the header.
                 message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
                 // Set Subject: header field
                 message.setSubject("Check the problem dude...");
                 // Now set the actual message
                 message.setText("You did blunder correct that...");
                 // Send message
                 Transport.send(message);
                 System.out.println("Sent message successfully....");
          catch (MessagingException mex) {
                mex.printStackTrace();
                throw new RuntimeException(mex.getMessage());
          return input;

  • Get File Name in UDF from file adapter sender

    Hi,
    I've looking for this solution, but I couldn't find any usefull information.
    I want to obtain the name of the file, sended by the file adapter.. and later use it in the mapping logic.
    I've readed about sustitution... any help?
    Thanks.

    HI Stortoni,
    Take a look at these blogs:
    http://wiki.sdn.sap.com/wiki/display/XI/CombiningthreedifferentaspectsofPIinoneshot
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    /people/sap.user72/blog/2005/07/15/copy-a-file-with-same-filename-using-xi
    Regards,
    ---Satish

  • FileName in Sender File Adapter Module

    Hi Folks,
    In my sender file adapter have written a module to read the picked file name. The protocol used is NFS.
    Notice that the file name read in the module has the absolute path, including the directory path. E.g The file name xyz has to be picked from source directory
    XIServer\Outbound. In the module when I retrieve the file name, it comes up as
    XIServer\Outbound\xyz. Is this expected behaviour?
    I was expecting just the file name<xyz> to be retrieved.
    Thanks,
    Anand

    HI,
    Create an UDF and write this code.
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key =
    DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName;
    in Adapter u will have Adapter specific parameters check the file name check box.
    Using this UDF u will get the file name at target side.
    Regards,
    Phani.

Maybe you are looking for

  • How to set up multiple hard drives for video editing?

    I have recently purchase a new custom built PC for video editing with Premiere. I have 3 seperate HDD's as I read on one of the forums that I should set up the hard drives as follows: one for OS/programs one for media one for pagefile/scratch/rendors

  • In NEED of a new battery, but I do need help.

    I have the old macbook Pro, 15-inch, the all silver one, not the one with the black keys/border. Anyways, I know I need a new battery because when I take it off the charger, it dies within 30+ seconds. I was just wondering which battery I should get.

  • Email a 10 minute movie

    What's the best settings I should use to email a 10 minute standard def video? Thanks.

  • My Z10 not working at all....

    Hi all.........I bought BB Z10 4 months ago,,,,now i have a problem with my Z10 not working at all.''i can't put power on at all...no led indication glow ,,,,i tried to connect wit BB LINK software but it's can't connect with BB link....any one can h

  • Multithreaded client: which listener to use?

    I've got a client program that needs to talk to a server. Instead of building in all the RMI and server-aware stuff into the client, I'm making a layer between then, called ClientHookup. This way, we can write alternate front-ends, and just make sure