Adapter Module Processing

I have a file to file scenario. The incoming file contains Employee Details and I need to validate each record and need to reject them if they are invalid as per the business rules.
For this I know I need to create the Adapter Module Processing.
I am following the below mentioned document.
https://websmp209.sap-ag.de/~sapdownload/011000358700003237612005E/HowToCreateAdapterModules.pdf
I dont have an NWDS installed, but I want to develop my java program in Eclipse? Whether it is OK to do it in Eclipse? Once I develop my Java program what exactly I need to do? How to create a Jar file in Eclipse? How to import that in XI?
Thanks.
[email protected]

Hi Jenni,
This topic has been already discussed in the below thread:-
Creating Adapter Modules
In general, I will explain how to create .JAR file:-
Creating a .JAR file is easy. Go to the directory where your classes are stored and type :-
jar -cf myfile.jar *.class
(jar is the command to run the jar utility. -cf are options, where c create arhive and f specify archive file name)
Now, if you have an existing JAR file, and want to extract it, you'd type:-
jar -xf myfile.jar
Also go thro' this link for step by step procedure on simple Module Processing:-
https://websmp201.sap-ag.de/~sapdownload/011000358700003237612005E/HowToCreateAdapterModules.pdf
I hope this provides you a solution.
Regards.
Praveen

Similar Messages

  • Set a variable in Adapter Module and read it during message mapping

    Hi guys,
    is there any way, how I could set some variable and store its value during the adapter module processing and read back this value in message mapping and use it? Without using a database or files.. I mean, some j2ee storage or something like that..
    Thanks for your help,
    Olian

    Hi guys,
    thanks for your answers..  just a clarification, what the problem is.
    I need to validate a message in the adapter module, if it's digital signature is valid. If it is, I need to send back to the sender a return code (message) OK, otherwise ERROR. I can't modify the message (or dynamic configuration) as I'm using a WSS in the sender channel. The system doesn't allow me to change anything in the message, so I can't find out in the mapping what the validation result was. I then tried to do the validation directly in the message mapping, but I have some issues there with libraries or what, because the validation code, which works in the adapter module, doesn't work in the mapping java class. So my final thought was maybe I could validate the message in the adapter module and pass the result to the message mapping and then create an appropriate return message (in the mapping). However, I see no way of passing a value there. I'm stuck and have no Idea how to resolve the problem. Any hints guys?
    Thanks a lot for your help!
    Olian

  • Module processing inside Sender File Adapter

    Hello,
    I am trying to analyze whether I can create a specialized module inside Sender File Adapter. As of right now, the Sender File Adapter and Receiver as well, assume endSeparator character in the end of each record. For files that do not have this field, it is just on continuous string, I assumed I can create an
         adapter module
         call it BEFORE data in the file is being converted to XML format
         Insert 'nl' character (since the record length is fixed)
         Call regular adapter processing (converting to/from XML)
        However, creating any module inside Sender File Adapter, the payload of the main document is already in XML format. Is there anyway to avoid it?
       Thanks for your help,
             Dmitriy Mindich

    It is not possible with the standard functionality.
    So maintain the sender file adapter with no conversion, but in the module tab enter following modules:
    1. Your module
    2. The conversion module (*)
    3. The standard module.
    (*) for details look here:
    Look here:
    http://service.sap.com/nw-howtoguides
    -> Exchange Infrastructure
    -> How To Use the Content Conversion Module in JMS Adapter
    Regards
    Stefan

  • Empty file to process in customer J2EE adapter module

    Hi All,
    if i give an empty text file to a sender communication channel, then no message is generated by XI.
    i want to generate a dummy XML if empty file is given.
    so is it possible to make a customer-specific J2EE adapter module - then deploy it - then if in sender comm channel this adapter module is written before SAPAdapter module, then should XI generate a dummy XML for this empty file.
    i am asking this because i developed a J2EE adapter module, then deployed it, then tried to invoke it  from sender comm channel but this J2EE adapter module is not getting invoked - this i can tell because i have written the following lines only in Java class process method:
    <i>Message msg_audit = (Message)inputModuleData.getPrincipalData();
    AuditMessageKey amk = new AuditMessageKey(msg_audit.getMessageId(),AuditDirection.OUTBOUND);
    Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"FileCheck: Module called");
                                                 return inputModuleData;</i>
    but still in the audit log only 3 messages of entire file content converted to XML format, empty doc so no sending of message and deleting of empty file are coming.
    <b>Can anybody suggest whether is it possible to process an empty text file to generate a dummy XML in sender communication channel in XI.</b>
    Thanks,
    Rajeev Gupta

    Hi All,
    When i write this code:
    try
                                                                obj = inputModuleData.getPrincipalData();                                                  
                                                                msg_audit = (Message)obj;
                                                                amk = new AuditMessageKey(msg_audit.getMessageId(),AuditDirection.OUTBOUND);
                                                                Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"FileCheck: Module called");
                                       <i>File f = new File("/components/XITEMP/sample/PWC/check.txt");                                                            
                                                                          if (f.canWrite())
                                                                                         PrintStream ps;
                                                                                         FileOutputStream fos =new FileOutputStream(f);
                                                                                         File f1 = new File("/components/XITEMP/sample/PWC/check1.txt");
                                                                                         ps = new PrintStream(fos);
                                                                                         if (f1.exists()==false)
                                                                                              f1.createNewFile();                                                                    
                                                                                         ps.println("Testing");
                                                                                         ps.close();
                                                                                         fos.close();                                                            
                                                                               else
                                                                                    File f2 = new File("/components/XITEMP/sample/PWC/check2.txt");          
                                                                                    if (f2.exists()==false)
                                                                                              f2.createNewFile();                                                                    
                                                                               }               </i>                                        
    it works fine......it creates the file check1.txt
    but when i place the italiced code in this format:
         try
                                                                obj = inputModuleData.getPrincipalData();                                                  
                                                                msg_audit = (Message)obj;
                                                                amk = new AuditMessageKey(msg_audit.getMessageId(),AuditDirection.OUTBOUND);
                                                                Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"FileCheck: Module called");
                                                           catch (Exception e)
                                                                     try
                                                                          File f = new File("/components/XITEMP/sample/PWC/check.txt");                                                            
                                                                          if (f.canWrite())
                                                                                         PrintStream ps;
                                                                                         FileOutputStream fos =new FileOutputStream(f);
                                                                                         File f1 = new File("/components/XITEMP/sample/PWC/check1.txt");
                                                                                         ps = new PrintStream(fos);
                                                                                         if (f1.exists()==false)
                                                                                              f1.createNewFile();                                                                    
                                                                                         ps.println("Testing");
                                                                                         ps.close();
                                                                                         fos.close();                                                            
                                                                               else
                                                                                    File f2 = new File("/components/XITEMP/sample/PWC/check2.txt");          
                                                                                    if (f2.exists()==false)
                                                                                              f2.createNewFile();                                                                    
                                                                     catch(Exception ex)
    it doesnot create the file check1.txt......
    Can anybody suggest why in the exception block this italiced code is not working........means it is working in try block of try{}catch{} block.......but it is not working in catch block of try{}catch{try{}catch{}}
    Thanks,
    Rajeev Gupta

  • Adapter Module to terminate module chain processing PI7.1 (File Adapter)

    Hi All,
    I have a file in a FTP location that needs to be picked up ONLY after a trigger file is found.
    I have tried 2 ways using OS commands and BPM but both do not suit my need .
    I have now decided to write a java adapter module. This is in PI 7.1.
    Folder :          \public\cwc
    File to be picked up : abc.txt
    Trigger file :              abc.trg
    Polling Interval :         60 secs
    1. Module checks for abc.trg in the folder \public\cwc
    2. If found, do nothing and process normally
    3. If not found, write an error to the log and stop the module chain (callsapadapter) from processing further. The abc.txt file should not be picked up.
    Is this possible ? Any code snippets? What command will stop or timeout the communication channel processing?

    Hi,
    What you can do is :
    1. If found then send the regular xml file from the adapter module.
    2. if it is not found then alter the message so that the log xml file appear as the output of the module.
    3.in the IR make a data type such that its is having both i.e. either the regular xml or the log fields in two seperate messages (optional)
    e.g.
    <File>   ... 1. .1
    --<RegularFile> .. 0..1
    --<logfile>  .. 0..1
    Dont think of stopping the process by calling some modules.Instead let the process complete by letting the mapping split.
    If the Regularxml comes ,then route it to the regular folder , but if the log comes then let the other message go to the log folder.
    Regards
    Progirl

  • Adapter Module: How to see if Msg is Request or Response in Sync process?

    Hi all,
    I have created an adapter module. It works fine, in my case on NW07.
    This module is called twice in a synchronous processing as described in
    http://help.sap.com/saphelp_nw2004s/helpdata/en/a4/31d940f52f7e7fe10000000a1550b0/content.htm
    and additionally with more details here
    http://help.sap.com/saphelp_nw2004s/helpdata/en/a4/f13341771b4c0de10000000a1550b0/frameset.htm
    In a synchronous scenario one can see that modules are called in a special sequence twice. First for the request, second for the response.
    My question:
    A: How can I tell the Module Processor to call my Module only once?
    or
    B: How can I check within the module wether my message is a request or a response. this way offers the posibility to skip handling based on rules eg. req/resp.
    Kindest regards Joerg Hopmann

    Hi all,
    I have to add, that in normal cases an adapter module is called only once, I know, but I have my adapter module in the JMS-Adapter inserted.
    And while using the feature of the Reply-Queue one can use the JMS-Adapter for synchronous processing. And in this specal case my module is called twice. Independent of the position within the list of modules.
    Regards Joerg Hopmann

  • Cleanly stop a process in an  XI adapter module

    Hi,
    I have a java adapter module that decides whether the process should carry on or not.
    When I want to stop the process I throw an UnsupportedOperationException that is reported in Runtime Workbench -> system monitoring.
    Are there any other means to stop the process (other exception....) from an adapter module?
    Thanks
    Yann

    Hi,
    I have a java adapter module that decides whether the process should carry on or not.
    When I want to stop the process I throw an UnsupportedOperationException that is reported in Runtime Workbench -> system monitoring.
    Are there any other means to stop the process (other exception....) from an adapter module?
    Thanks
    Yann

  • Adapter Module Filename in File Receiver Channel

    Hi All,
    is it possible to set the Filename in File Receiver Adapter from Adapter Module?
    I know that it is possible to read the data      
    Channel ch = new Channel(moduleContext.getChannelID());
    path = ch.getValueAsString("file.targetDir");
    I Need to set the filename in Adapter Module, using of Payload is not possible because Payload is not xml.
    Dynamic Parameters in Message Header is not possible because it is an multi mapping process an i need dynamic Filename for each Part
    payload after mapping is like
    MainDocument
    SubMainDocument
    MainDocument
    SubMainDocument
    i need special Name for each SubMainDocument in FileReceiverAdapter
    regards
    ralf

    Hello Stefan,
    interface mapping is an mapping  like this:
    outbound_interface => Inbound_Interface1
                                 => Inbound_Interface2
                                => Inbound_Interface3
    in sxmb_moni this looks like this
    Soap_Header
    Soap_Body
    Payloads
         =>MainDocument ( application/xml )
        => SubMainDocument ( text/xml )
         =>MainDocument ( application/xml )
        => SubMainDocument ( text/xml )
    First SubMainElement is routing to FileReceiverAdapeter A   where Filename has to be like "NameA%nr%"
    second SubMainElement is routing to FileReceiverAdapeter B   where Filename has to be like "NameB%nr%" 
    %nr% is som value from the Payload.
    Payload is not xml  because using of Conversion Argent!!
    I Think there is only one Dynamic in Header for all subelements, i have test it!
    ralf

  • Dynamic configuration required in sender file - Adapter Module

    Hi Everybody,
    I am developing an Adapter Module in the file adapter (sender) using Adapter Specific Message Attributes.
    I am using Dynamic configuration inside the Module Process method in the adapter module.
    We are getting an error saying Dynamic Configuration cannot be resolved.
    Can anybody tell me the package to be used.
    Thanks,
    Zabiulla

    You can access the dynamic configuration in adapter module like this:
    Message msg = (Message) inputModuleData.getPrincipalData();
    String fileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File", "FileName");
    You do not need any addition library besides the adapter module API.
    Hope that helps
    Stefan

  • ModuleData.getPrincipalData returns null in the adapter module development

    Hi gurus,
    i am doing a test on the adapter module development following an article written by William Li:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0ac06cf-6ee2-2c10-df98-e17430ca5949?QuickLink=index&overridelayout=true
    my problem is after the EJB has been deployed, it seems that the return of inputModuleData.getPrincipalData() is always null which makes the program can not get the xml payload from the framework.
    the main process of the example has been simplified like this:
         public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
              Object           obj = null;
              try {
              obj = inputModuleData.getPrincipalData();
              Message     msg1 = (Message) obj;          
                    XMLPayload xmlpayload = msg1.getDocument();}          
              catch (Exception e) {
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;
    after deployed, i get the following error in the adapter monitor of RWB: (my JNDI is testtest)
    17.02.2012 17:13:44.643 Information Send binary file  "test8.xml" from FTP server "10.18.48.150:/encrypt_test/", size 206 bytes with QoS EO
    17.02.2012 17:13:44.644 Information MP: processing local module localejbs/CallSapAdapter
    17.02.2012 17:13:44.644 Information Application attempting to send an XI message asynchronously using connection File_http://sap.com/xi/XI/System
    17.02.2012 17:13:44.645 Information Trying to put the message into the send queue
    17.02.2012 17:13:44.648 Information MP: processing local module localejbs/testtest
    17.02.2012 17:13:44.648 Error MP: exception caught with cause java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.Message.getDocument() of an object loaded from local variable 'msg1'
    whereas if the code has been changed like this:
         public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException {
              Object           obj = null;
              try {
                   obj = inputModuleData.getPrincipalData();
                   Message     msg1 = (Message) obj;     
                   if (obj != null )
                        XMLPayload xmlpayload = msg1.getDocument();
              catch (Exception e) {
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;
    the file can be read by the file adapter.
    i just quite confused that why the return of the getPrincipalData() is null? where is the problem? thanks
    Edited by: Stephen Xue on Feb 17, 2012 5:22 AM

    I'm gonna reply to myself here. I changed the processing sequence of the adapter modules in the  in the FileSender channel so that my module comes first then CallSapAdapter. Then getPrincipalData() contains the message.
    Hope this helps someone else.

  • How to access Payload in XI Adapter Module

    Hello,
    I have to enhance a adapter module in xi very urgently. Target is to access a node of the XML payload and retrieve the corresponding value.
    This is how my document looks like:
    <mt_test>
         <element1>
              <…> </…>
         </element1>
         <element2>
              <LOG_NO>4711 </LOG_NO>
         <element2>
    </mt_test>
    I need now access the element <LOG_NO>. This can only appear one time in the whole xml document. My code that I did so far (inside the process method) to retrieve this element is like this:
    XMLPayload xmlpayload = msg.getDocument();
         DocumentBuilderFactory factory = null;     
         factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         Document document = builder.parse ((InputStream)xmlpayload.getInputStream());
         Element rootNode = document.getDocumentElement();
    <…and now I have no clue anymore…:-/…>
    May you give me an example how to access the node <LOG_NO> and save the corresponding value in a String variable?
    I would be really thankful.
    Greetings and thanks in advance,
    Tobias

    Hi,
    >>>found no solution with PI Standard Import to support FTP inside the Adapter Module
    why would you? file adapter supports FTP - so you don't need it
    >>>In order to use FTP library, is there any standard library available or supported by SUN.
    you can use any java ftp client available on google
    Regards,
    Michal Krawczyk

  • Adapter Module Receiver File Adapter

    Hi All,
    I am getting file name in the Mapping in my target structure in a field FILENAME and i want to use this field to create a file at the target with the name as the value in FILENAME.
    I have to develop this by using Adapter Module.
    Note : This can be done by Variable Substitution and Dynamic Configuration UDF.But i want to implement the same by using adapter module.
    Can somebody help me out in getting the FILENAME from mapping inside the module process method of module.
    Thanks,
    Zabi

    Try this..
    private Map param;
    DynamicConfiguration conf = (DynamicConfiguration) param.get(
    StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String Filename = conf.get(KEY_FILENAME);[/code]
    Thanks
    Sebin

  • Adapter Module (Reading Excel File)

    Hi Guys,
    I followed the Webblog : Read Excel instead of XML through FileAdapter
    For File Adapter Module Development , for reading Excel Sheet.
    Deployment all went fine and when i used in my configuration , file is getting picked up but the xml content is not getting displyed , it says not well formated.Below error is shown in the CC Monitor
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'http://pxxxxx:50xxx/mdt/messagecontentservlet?att...
    My coding in nwds
              xmldata =   "<?xmlversion="1.0"encoding="UTF-8"?>
                             + "<ns:"+wb.getSheet(0).getCell(0, 0).getContents() +"xmlns:ns=""
                             + wb.getSheet(0).getCell(1, 0).getContents() + "">"
                             + "<Name>"+ wb.getSheet(0).getCell(1, 2).getContents()
                             + "</Name>" +"</ns:" wb.getSheet(0).getCell(0, 0).getContents()">";
    Kindly suggest if any
    srini
    Edited by: Venkateswarlu Srinivas on Jul 4, 2008 2:47 PM

    try removing the \n you have added in the string

  • Adapter module that dumps file to XI file directory

    I am given a task to find a way of backing up files the simpliest way. Currently, our config is in a scenario where there are 2 receiver, the receiving system (SAP) and the file backup (File adapter). I would want to reduce the config requirements by eliminating the file backup objects. And I am thinking of doing this by creating an adapter module to be included in the sender adapter.
    Another idea I could think of is the adapter module calls upon the file comm channel to do the file backup.
    The purpose of this research is to reduce object transport time and the mistakes the transport guys are doing on the file comm ch reconfiguration.
    To those who have experiences with adapter module development, is this idea feasible?

    Hi Jai,
    Thanks for your reply. That is the 2nd option I have in case the 1st one isnt possible.
    To further elaborate,
    Current config:
    we have two AS2 comm channels (sender and receiver) managing the connection with our external partners.
    File comm channels to backup the files we send and receive.
    The problem:
    We are having problems with the transport guys as they often make mistake on reconfiguring the file comm channel during transport.
    Requirements:
    Reduce object creation and tranport time.
    Solution proposal 1:
    The idea is to remove all existing objects related to file back up and have all the file back ups done by the adapter module. And this adapter module would become part of the as2 comm channels module processes.
    Hope this clarifies things more.

  • Adapter Module Migration in PI 7.1

    Hi,
    I have migrated some code for Adapter Module from PI 7.0 to PI 7.1. I have deployed the SDA file on the server and it was successful. But in the communication channel monitoring i am getting below exception.
    Message processing failed. Cause: javax.ejb.TransactionRolledbackLocalException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBTransactionRolledbackException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.Demo.JMSadapterModuleBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.Demo.JMSadapterModuleBean@63120b10 for bean sap.com/DemoJMSEARxml|DemoJMSEJB.jarxml|JMSadapterModuleBean; nested exception is: java.lang.NullPointerException
    could you please advise me what could be the problem?
    Please help me out here.
    Best Regards,
    Prasad Babu.

    Hi Prasad,
    please refer to the last paragraph of the CSS note -
    [#1004000 PI 7.1 Adapter/Module Development: API Changes since SP0|http://service.sap.com/sap/support/notes/1004000]
    i.e.,
    "MIGRATION NOTES
    API: NetWeaver04 XI 3.0/7.0 any SP; Documentation: XI 3.0/7.0 any SP
    XI 3.0/7.0 adapter and module implementations cannot be deployed in XI
    7.1. The source code must be adjusted first. Please use the API cross
    reference attached here. Further information can be found in the SAP
    NetWeaver PI  7.1 manual."
    Regards
      Kenny

Maybe you are looking for

  • Where did my music go.

    My computer crashed. I replaced the hadrdrive. I logged back into iTunes and behold all my music listings were there, however, there is an exclamation point prior to each song. And when I go to play the song a dialog box says it cannot play the song

  • Various language description for GL accounts

    Dea r Experts, I need to maintian several languages (DE/ZH/PT/IT/EN/SK so on) for nearly1000 gl accounts as my client is using same GL accounts for different company codes. can any one please let me know any option is available to maintain languages

  • Start tiles ( all of them ) do not work

    I clicked at Start > Insider Hub > it blinked for a second and sent me back to desktop. Same applied to all tiles. The all apps shortcuts  at the left do work.

  • Process in QM for Calibration of guage & destructive material testing

    hello all, can somebody help for sequence of process and setting required in QM  to - send the Gauges for Calibration to out sidevendor and receive back. - To send the material outside for (destructive)testing and receive the material back and book i

  • Problem in Threading

    Hai to all of you, I am new to Threads Programming, we are developing a module in which the file is uploaded by the customer and we are sending that data to it client in form of SMS. Here all are working perfectly. But there is also a assumptions tha