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

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Accessing a file in Imported Archive from Adapter module

    Hi,
    I am designing a module for File/FTP and Mail adapters. Is it possible to retrieve data from a CSV or TXT file uploaded in the Imported Archive from the Java code in the module? If this is possible, do I use the same approach as accessing the CSV data from the mapping using a UDF? If this is not possible, can you suggest other ways were I can access a CSV or TXT configuration file from an adapter module?
    I would like to avoid using Module key, Parameter name and Parameter value as I would like to make the adapter module generic and the data I will be reading might be too much to be specified in this location. However, I would use the Module key, Parameter name and Parameter value to specify the CSV or TXT filename which the adapter module will be using.
    Thanks in advance for any help that you can provide.
    Regards,
    Elbert

    Imported archives are part of mapping flow and adapter modules are more part of routing. Therefore I don't think imported archive could  be made accessible anywhere outside mapping.
    but my CSV or TXT file would be updated regularly by the developer.
    So were you planning to import this file again and again under imported archive? This doesn't seems to be a good solution when you think about changin Design part in Production environment. It would be better to give access to certain folder to developer to put the file there and access it using some code. You may refer this
    /people/sundararamaprasad.subbaraman/blog/2005/12/09/making-csv-file-lookup-possible-in-sap-xi
    Regards,
    Prateek

  • 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

  • Error in Adapter module on decentral Adapter engine

    Hi,
    I have configured a scenario file to file for picking a xml file and then converting it to corresponding edifact file,using an adapter module at the receiver side.The adapter module is getting executed but i am getting this error
    Message processing failed. Cause: java.lang.ClassCastException: class Xml_To_Edi.XML2EdifactLocalHomeImpl0_0 can not be casted to ModuleLocalHome or SModuleLocalHome
    Can you all tell what is this error and how to rectify it.
    regards,
    ujjwal kumar

    Hi Ujjawal,
    Do the following steps...
    1.created EJB of type StatelessSession Bean
    2.Dont uncheck generate default interfaces
    3. Fininsh.
    Later in ejb-jar.xml file, modify Home,Remote,Local,LocalHome entries.
    and for more info
    I refered a blog ,in that its given as:
    You need references to connector.jar file which has the classes required at compile time and runtime
    Compile time :
    From the context menu of the EJB project , follow the path Properties -> Java Build Path -> Libraries.
    Click on Add variable and select TSSAP_JAVAX_HOME and click on Extend and select connector.jar from the list displayed.
    Run time :
    Navigate to the application-j2ee-engine.xml in your EAR project.
    Select References on the General tab and click on Add.
    Select Select library/interface/service as shown in the snapshot and select j2eeca as in the next snapshot.
    Check this blog:
    /people/amol.joshi2/blog/2006/11/28/alerts-from-adapter-modules--the-jra-way-part-ii
    see the comments in the blog who faced same error.may this helps or gives an idea
    Searched lot for this,dont forget to reward points
    Regards
    Pragathi.
    Edited by: Pragathi on May 23, 2008 5:15 AM

  • Adapter moduler in file adapter receiver - get Target Directory from param

    Hi everybody,
    We are in PI 7.1
    I need in an adapter module (file adapter receiver) to access to the Target Directory comming from parameters
    I foound the code in a weblog
    /people/sap.user72/blog/2005/07/15/copy-a-file-with-same-filename-using-xi
    Here is the code I found
    public ModuleData process(
              ModuleContext moduleContext,
              ModuleData inputModuleData)
              throws ModuleException {
              Object obj = null;
              Message msg = null;
              try {
                   Channel ch = new Channel(moduleContext.getChannelID());
                   obj = inputModuleData.getPrincipalData();
                   msg = (Message) obj;
                   XMLPayload xmlpayload = msg.getDocument();
                   String path = ch.getValueAsString("file.targetDir");
                   if (!path.endsWith("
    ") && !path.endsWith("/"))                    
                             if(path.indexOf("
    ")!=-1)
                                  path+="
                             else
                                  path += "/";
                   if (xmlpayload != null) {
                        convert(xmlpayload.getContent(), path);
                   inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {}
              return null;
         private void convert(byte[] bs, String path) throws Exception {
              String bs_out = new String(bs);
              String filename =
                   bs_out.substring(
                        bs_out.indexOf("<FileName>") + 10,
                        bs_out.lastIndexOf("</FileName>"));
              bs_out =
                   bs_out.substring(
                        bs_out.indexOf("<Base64>") + 8,
                        bs_out.lastIndexOf("</Base64>"));
              byte bb[] = com.sap.aii.utilxi.base64.api.Base64.decode(bs_out);
              File f1 = new File(path + filename);
              FileOutputStream fos = new FileOutputStream(f1);
              fos.write(bb);
              fos.close();
    The object Channel come s from the package import com.sap.aii.af.service.cpa.Channel;
    The jar is in the build path (com.sap.aii.af.service.cpa.jar);
    When I write in NWDS
    Channel ch = new Channel(moduleContext.getChannelID());
    NDWS gives me an error "Cannot instantiate the type Channel".
    Can somebody help me about that, please?
    Does that code dosn't work in pi 7.1?
    Thanks in Advance for your help.
    Best Regards.
    E. Koralewski
    Edited by: Eric Koralewski on Feb 3, 2011 1:40 PM

    > When I write in NWDS
    > Channel ch = new Channel(moduleContext.getChannelID());
    > NDWS gives me an error "Cannot instantiate the type Channel".
    it should be:
    Channel ch = (Channel) LookupManager.getInstance().getCPAObject(CPAObjectType.CHANNEL, moduleContext.getChannelID());
    (taken from sample module ConvertCRLFfromToLF)
    http://help.sap.com/javadocs/pi/pi711sp03/index.html?com/sap/aii/af/service/cpa/Channel.html
    Edited by: Stefan Grube on Feb 3, 2011 2:02 PM

  • 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

  • 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 to enhance File adapter

    Hey guys
    i need a small clarification regarding adapter modules.
    is it possible via adapter modules to enhance the File adapter to such an extent that it can deliver files to two separate systems in separate landscapes.
    i know i can design one more receiver determination and can also use Run OS command options,but modules in general give better performance compared to others so just wan't to explore a little bit more about them.
    Thanx
    Aamir

    Hey Aamir,
    yeah, they do take a lot of resources, but that's how XI was built to work.
    What you're trying to do is a workaround and may not get support from SAP.
    If I have understood right, you still wanna maintain the endpoint connection data in the communication channels but want to acces them directly without going through the technical routing pipeline, is that so?
    If that's it, I'm sorry but I cannot help you any further.
    The only way I know of accessing adapters without going throught technical routing is by using lookup API (RFC, JDBC, Soap) but it is not intended for endpoint scenarios (insert, update etc), mainly for simple read (lookups).
    If maintaining the connection data outside adapters is not a concern, you could try to create the connections directly in Java code, inside java proxies.
    Regards,
    Henrique.

Maybe you are looking for

  • Delivery allocated to CO-PA

    Hello gururs, I want to allocate the delivery of a sales order to CO-PA. I have introduce the P&L account in PAFI structure. When I go t see the posting document i can see that in the P&L account appears the CO-PA object but the profitability analysi

  • RFC Sender Channel Issue : STFC_CONNECTION

    Hi All, There has been an issue with the RFC sender channels. When SAP triggers the data, we see an error in the RFC sender channel as below Error in processing caused by: com.sap.aii.af.rfc.afcommunication.RfcAFWException: senderAgreement not found:

  • Selection screen :data retrieval

    how to pass the contents of each individual input fieldfrom the selection screen to the ABAP program.My selection screen is SELECTION-SCREEN BEGIN OF BLOCK ID WITH FRAME TITLE TEXT-001.    SELECT-OPTIONS:                     EBELN  FOR EKKO-EBELN NO

  • I have adobe reader 9.3 am having issues please help

    when trying to print get X an internal error occured then pop up saying internet explorer has stopped working tried to uninstall adobe reader could not do that...times out and stops installing can anyone give advice

  • Big ploblems in zen micro

    I just got my zen last week. it seems good in every aspect, but the bad signal quality of FM Radio annoyed me a lot, the speed of loading is slower than expected(i've used ipod before and it's quick), and the battery life can't compare with my former