Naming a file in the adapter module

Hi All,
I have written an adapter module that is used in a receiver mail adapter. In my module I am renaming the attachment name to "abc.cpi". The problem is I am getting the output from the adapter as abc.cpi.xml. I tried changing the content type in the adapter module to text/plain that gave me an output as abc.cpi.txt. How can I get only abc.cpi as the name of the attachment using this module?
Thanks
Abinash

Hi,
This might be help you
http://help.sap.com/saphelp_nw04/helpdata/en/cd/5af7c0c994e24fb0d0088443513de2/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cd/5af7c0c994e24fb0d0088443513de2/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
Regards
Agasthuri Doss

Similar Messages

  • Retrieving the file name in the adapter module in the sender file adapter

    hi,
    i need to retrieve the file name, in the adapter module. This module is placed in the sender file channel.
    After the file adapter has picked up the file from the file directory, the file is placed in the archived directory.Custom adapter mofule is place in the file shanel. i need to retrieve the file name of the file in the adapter module. Is it possible to retrieve the file name?
    Also is it possible to retrieve the archive directory path in module?
    Regards,
    Meenkashi

    Hi Meenakshi,
    I guess you are looking for this
    /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
    Regards
    Suraj

  • 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.

  • Dummy XML not getting generated from empty file by J2EE adapter module

    Hi All,
    i know when XI gets an empty input text file, it does not generate a send message for it in sender communication channel.
    in my scenario, if i get a file with data, i have to generate an XML message for it using file content conversion - this i have done...........
    but if i get an empty text file, then i have to generate a dummy XML send message for it for my BPM.......
    So i made a J2EE adapter module to generate dummy xml for empty file.....<b>when i give a file with data in it, then my adapter module is called..... but when i give an empty file, then my adapter module is not called</b>.........
    <b><i>Can anybody suggest why the module processor is not invoking my customer-adapter module when an empty file is given.............but the module processor is invoking my customer-adapter module when a file with data is given</i>.</b>
    Thanks,
    Rajeev Gupta

    Hi Amit,
    Below is the code of process method which i used:
    <i>public ModuleData process(ModuleContext moduleContext,
      ModuleData inputModuleData)
        throws ModuleException
    Object obj;
    Message msg_audit;
    AuditMessageKey amk;
    try
    File f = new File("/components/XITEMP/sample/PWC/check.txt");
    PrintStream ps;
    if (f.canWrite())
    FileOutputStream fos =new FileOutputStream(f);
    ps = new PrintStream(fos);  
    ps.println("Testing");
    ps.close();
    fos.close(); 
    else
      f = new File("/components/XITEMP/sample/PWC/check4.txt");
      if (f.exists() ==false)
      f.createNewFile();
    obj = inputModuleData.getPrincipalData();
    if (obj!=null)
    msg_audit = (Message)obj;
    amk = new AuditMessageKey(msg_audit.getMessageId(),AuditDirection.OUTBOUND);
    Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"FileCheck: Module called");
    else
      String str = new String();
    String str1 = new String();     
                  str1="<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
                 str1+="<ns:MT_PWC_RECORD xmlns:ns=\"urn://PWC_SR3_01/PWC/Customer\">";
             str1+="<RECORD_SET>";     
                 str1+="<RECORD>";
             str1+="<RECORD_DATA>BLANK_FILE</RECORD_DATA>";
             str1+="</RECORD>";
             str1+="</RECORD_SET>";
             str1+="</ns:MT_PWC_RECORD>";     
    str=str1; 
    inputModuleData.setPrincipalData(str);
    catch(Exception e)
    try
    File f = new File("/components/XITEMP/sample/PWC/check.txt");
    PrintStream ps;
    if (f.canWrite())
      FileOutputStream fos =new FileOutputStream(f);
      ps = new PrintStream(fos);  
      ps.println(e.toString());
      ps.close();
      fos.close(); 
    catch(Exception ex)
    return inputModuleData;
       }</i>
    in the above methood, i  used file operations at start just to see whether the module is getting invoked or not...so when i give a data file, then the file operations are performed and messages are written in audit log.........but when i give an empty file, then the file operations are not performed - meaning the module is not getting invoked........
    Thanks,
    Rajeev Gupta

  • Getting Hashcode of a file in an Adapter Module

    Hi all
    Does anybody know to dynamically get the hashcode of a file in an Adapter Module.

    Hi Michal
    contentToString()
              String serialization for logging purposes.
    getPrincipalData()
              Retrieves the current principle data, usually the message
    getSupplementalData(String name)
              Gets one supplement data value.
    getSupplementalDataNames()
              Returns the names of all currently existing supplement data.
    setPrincipalData(Object principalData)
              Sets the principle data that represents usually the message to be processed.
    setSupplementalData(String name, Object supplementalData)
              Sets a supplement data for the rest of the module chain
    this all methods I can see. Can u please elaborate a bit

  • Value mapping in the adapter module

    Hi all...
    There was been alot of writing about value mapping in many different ways.
    But I have not been able to find help about doing the lookup in the adapter module.
    Has anyone tried this?
    Regards Peter

    Hi,
    In this case you can perfrom a RFC Lookup, but, from an Adapter Module, you would need to use the concept of JRA to do the same.
    Amol Joshi has described how he called the Alerts RFC from the adapter module in these blogs and you can apply the same logic for your case as well to trigger the RFC from your module, get the data and then do the needful.
    /people/amol.joshi2/blog/2006/11/27/alerts-from-adapter-modules--the-jra-way
    /people/amol.joshi2/blog/2006/11/28/alerts-from-adapter-modules--the-jra-way-part-ii
    Regards
    Bhavesh

  • Please help with "Error writing the project file. The specified module could not be found." error.

    I am a student.  I've been trying to install and use Visual Studio 2013 Professional for three weeks now and I cannot get it to work.  I am now two weeks behind in my Visual Basic class.  I've installed, uninstalled, ran the repair option... 
    I've tried everything I know how to do.  I just spent 45 minutes on the phone with Microsoft, was transferred four times and finally told I will have to use the forums to find an answer.  I'm almost completely out of patience with this.
    I got the software through the Dream Spark program as a student.  I installed it with the web installer and it appeared to install fine.  When I try to create a new project, I get the error:  "Error writing the project file.  The
    specified module could not be found."
    When I exit the application, I also get:  "The automatically saved settings file 'c:\users\user\documents\visual studio 2013\Settings\CurrentSettings-2015-02-02.vssettings' is not available for write.  You can change this file on the 'Import
    and Export Settings' Tools Options page."
    Please tell me you can help.

    Hi,
    could you please try the points mentioned here:
    http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#VS_IDE_unexpected_problems to eliminate the possible cause of your issue?
    Please update the result in the forum after you try the method above!
    Best Wishes!
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
    href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

  • How to auto insert a number array with size of 20 into a named excel file with the positon is from A1 TO A20?i use lv6.1

    can you give me a example vi for it ?thanks a lot!
    how to auto insert a number array with size of 20 into a named excel file  with the positon is from A1 TO A20?i use lv6.1

    You don't need us to give you an example, as the example already comes with LV. Go to Help>>Find Examples and search for "excel". You will find an example called "write table to XL". You should note that the example doesn't do that exactly, because it writes a 2D array from 2 to N.
    You can modify the example by using only one for loop (instead of nested loops) with a 1D array or by going into the Set Cell Value and modifying it to accept a second cell value for the Cell2 terminal and wiring in a 1D array instead of the single string. If you do modify it, be sure to save it under a different name, so you don't overwrite the original.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • Error while deploying the Adapter Module

    Expets,
    i am getting below error in communication channel:
    Message processing failed. Cause: com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name localejbs/WriteExcelFile, cannot resolve object reference. [Root exception is javax.naming.NamingException: Error occurs while the EJB Object Factory trying to resolve JNDI reference Reference Class Name: Type: clientAppName Content: sap.com/WriteExcelEAR Type: interfaceType Content: local Type: ejb-link Content: WriteExcelFile Type: jndi-name Content: WriteExcelFile Type: local-home Content: com.sap.aii.af.lib.mp.module.ModuleLocalHome Type: local Content: com.sap.aii.af.lib.mp.module.ModuleLocal com.sap.engine.services.ejb3.runtime.impl.refmatcher.EJBResolvingException: Cannot start applicationsap.com/WriteExcelEAR; nested exception is: java.rmi.RemoteException: [ERROR CODE DPL.DS.6125] Error occurred while starting application locally and wait.; nested exception is: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: [ERROR CODE DPL.DS.5035] Application [sap.com/WriteExcelEAR] cannot be started. Reason: it has hard reference to resource [com.sap.xi.repository] with type [library], which is not active on the server. Hint: 1) Is referred resource deployed? 2) Is referred resource able to start? at com.sap.engine.services.ejb3.runtime.impl.DefaultContainerRepository.startApp(DefaultContainerRepository.java:315)
    I am also getting the same warning when i am deploying the adapter.
    Reference list in   application-j2ee-engine.xml   is as follows:
    engine.security.facade
    engine.j2ee14.facade
    com.sap.aii.af.svc.facade
    com.sap.aii.af.ifc.facade
    com.sap.aii.af.lib.facade
    com.sap.base.technology.facade
    com.sap.xi.repository
    Kindly help.
    Edited by: Priyanka Sharma on Jun 18, 2010 4:29 PM

    com.sap.xi.repository reference is not required,, how are you deploying your module on PI server,
    You must be using some external library for excel conversion, if external library is present in your deployed file, you don't need to add com.sap.xi.repository reference.
    Check:
    Is EAR to SDA conversion needed for EJB EAR module
    if you opt to use CECLT tool provided with NWDS 7.1, make sure you import SAP EAR File(it will have External library) on your local system.

  • How to get file name in adapter module

    Hi all
    Is it possible to get the file name in a adapte module? If so how can I achieve this?

    Hi,
    Check below thread. it shows code for file name.
    [Re: Query regarding Adapter Module development]
    -Gouri

  • Duplicate File Handling using Adapter Module

    Hi All
    The Scenario is like this------
    XI is picking a files from FTP location.
    Duplicate files are also getting picked by XI.
    To handle this i have written a module which is finding it out wheather the file is duplicate or not. If the file is not duplicate then it is getting processed.
    Now the problem i am facing is -
    I dont want to process the file if it is found duplicate, then what code i should write.
    What are the ways i can stop the processing of duplicate file. 
    Regards
    Dheeraj Kumar

    Hi
    I have implemented a module in which i can find out wheather the file is duplicate or not. If the file is not duplicate process the file.
    now the problem is --- if file is duplicate then i dont want to process the file.
    How can i achieve this?
    Regards
    Dheeraj Kumar
    Edited by: Dheeraj Kumar on Nov 30, 2009 3:21 PM

  • Addition of a header line to a flat file using Custom Adapter Module?

    Is the header that you want to add to the input file always a constant?
    In that case why go for a module. Directly map the required constants during the mapping to your IDoc.
    My suggestion is to avoid the module

    Hi Shabrish,
    The Header is not a constant field always as the value changes per file adapter so a module will be helpful, and it will be a must to add the Header record as the first line.
    Can you suggest/direct me to some appropriate blogs? Thanks
    Regards,
    Nipun

  • Re-naming audio files in the bin

    I saw another post where a guy said you couldn't re-name audio files.
    I had to try it. He was partially right. it seems like you can't just double click and re-name the files.
    You can do it, it's just really tricky.
    I had the best result when I gave the file one long click then I was able to re-name it.
    It's still buggy, but it can be done. That needs to be fixed. I rename audio files allot.

    I can do it here by normal double clicking, so it's definetly not a Logic 8 Bug.

  • Adapter Module for Sender File Adapter to access a Flat file

    Hi,
    We have a scenario where the source is a flat file.I want to develop an Adapter Module to make a small change to every line in the Flat file.
    Now how do we read a flat file in the Adapter Module?Coz the flat file will be converted to XML file by the Standard Adapter Module of the File adapter.
    Please help me out with this.
    Thank you,
    Anu.

    Hi Anu,
    If you are not using Content Conversion option Standard Adapter Module does not convert the Flat file to XML .
    You can directly access the payload as it is in flat file in the Adapter Module and make changes.
    Use the Standard classes ModuleData & moduleContext to fetch the Payload.
    chk this :
    Customized Sender Adapter Module
    XI: Read data from PDF file in Sender Adapter
    regards
    Ganga

  • 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

Maybe you are looking for