Creation of flat data in Adapter Module

Hello,
I'm writing an Adapter Module that supposed to convert XML source to a flat output (similar to StrictXml2PlainBean). But I'm not sure how to set the new flat content to the Message object that I'm getting from ModuleData supplied to process method of module bean. There is a method setDocument but it only accepts XMLPayload when I need TextPayload.
Can someone give the code snippet or refer to some blog where it is explained?
Also is there a source code for StrictXml2PlainBean?
Thanks,
Maxim.

Modules are a means of editing and manipulating the data in between the message entering or leaving  the adapter. So you will receive an XML payload and you HAVE to return and XML playload only to the adapter. If you want to convert it to flat file, you need to use file adapter as your receiver and use fcc parameters to do that.
VJ

Similar Messages

  • How to get the sent date in Adapter Module

    Hi
    How to get Sent Date in Adapter Module. I have used message.getSentTime(). But i am getting in 1179051733406 format is there any way to change this format.
    Is there any other way to get the date when file sending.?
    Is it possible to get Soap Header data Run Time xml file elements (<SAP:Date>) in SXMB_MONI into my Adapter Module.
    Please Help Me
    Best Regards
    Ravi Shankar B

    Is it possible to get Soap Header data Run Time xml file elements (<SAP:Date>) in SXMB_MONI into my Adapter Module.?
    Hi ravi, if you enable Adapter specific Message Attributes in your Adapter CC,(Source File TimeStamp), you can access the same in your ADapter code as a dynamic configuration
    Regards
    krishna

  • 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

  • File adapter modules : Access to file data before content conversion

    I have a file sender channel for which content conversion in applied. The incoming file has data in comma separated values format.
    e.g.
    102366,Amol Joshi,DEPT1
    107752,XYZ PQR,DEPT2
    I want to access the the actual data in the file before content conversion takes place. Is it possible to access this data inside the adaper module? I tried creating an adapter module and put it before CallSAPAdapter,it still gets the XML after content conversion as the input data to the module.
    Any pointers?

    Hi Amol,
    I dont know if it is the right approach.
    But if u r not able to meet ur requirement u can do one work around.
    Use Message Transformation Bean to convert it once again in to CSV (flat file structure) and then proceed with ur module.
    There should be a better way than this.
    Hope we could find a better solution in the forum.
    Regards,
    Sudharshan

  • Dynamic URL creation in Adapter Module

    I have a situation in which I need to create a dynamic URL to send data using an HTTP POST ( using  HTTPS).
    I created an UDF to use Dynamic Configuration, this works fine for the UrlParam in the HTTP CC and the TServerLocation in the SOAP CC.
    My issue is that both variables have the same limitation of 200 chars max, and sometimes the URL is longer than 200 chars (I have to pass more than 20 parameters in the URL). The message mapping with the UDF fails whenever I try to put more than 200 chars in the Dynamic Configuration Variables. Therefore I cannot use Dynamic Configuration.
    I'm now thinking of creating an Adapter Module which creates an URL out of the XML message passed to the adapter, and use this value to overrule the URL defined in the Communication Channel. The URL field in the Communication Channel does not have a  200 chars limitation.
    Does anybody know how to do this? Is it possible to replace the value of the URL field in the Communication Channel with another  value in an Adapter Module?
    I have to pass the data as parameters in the URL, not as Header fields in the message.
    Thanks,
    Andre

    Hello Chris,
    The error is:
    RuntimeException during appliction Java mapping com/sap/xi/tf/_mm_paymentClusterCreate_ Thrown: com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception when processing target-field mapping /ns0:mt_newPaymentClusterData/merchant_name; root message: Exception:[java.lang.IllegalArgumentException: Value is too long (471/200):
    It's even in the SAP Help:
    http://help.sap.com/saphelp_nwpi711/helpdata/en/48/ce299c3a8e5430e10000000a42189b/frameset.htm
    The length of the attribute value is defined by the XI message protocol. Values can be a maximum of 200 characters long. If, for example, you assign longer values in the mapping or adapter modules then this can lead to processing errors at runtime or the values are shortened to 200 characters. This shortening can also lead to a processing error. The processing error that occurs depends on the components that access the attributes.

  • From Where can i download  Jar Files for creation of adapter Module.

    From Where can i download these Jar Files.
    aii_af_mp.jar à the interface Module
    aii_af_ms_api.jar  à Dealing with payload and attachment
    aii_af_trace.jar à Writing Trace
    aii_af_svc.jar à Adapter Services
    aii_af_cpa.jar à Reading Channel Entries
    aii_af_ms_spi.jar
    aii_af_cci.jar 
    for creation of adapter Module.

    As k you basisn team,they will provided it.
    usually these jars files available in server, in usr.repositoy folder,if you have server level access then you can copy it else contact your basis team.
    or you can download it from service market place.
    Regards,
    Raj

  • JMS Adapter module content conversion

    Hi,
    I'm developing a module for the jms adapter(sender). My requirement is to parse the XI message(text) using some XML parsing api and do some formatting, logic etc and to make the jms adapter create a xml file with the processed information. Jms File Content Conversion does not suit our requirement and thats the reason we are trying this option.
    My understanding is: Access the  payload in the "process" method of the local ejb, apply XML parsing using JDOM etc, make a xml which should be the output of the jms adapter. This xml will be the xml with my user defined tag elements after content conversion. Can i form this xml and assign to the inputModuleData? Will the jms adapter use this string to create the xml and send to IS? Are there any other parameters to be set or processes to be done?
    Also in which sequence should I put my adapter module in communication channel.
    ================================================
    My code snippet:
    public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
            throws ModuleException
              Object obj = null; // Handler to get Principle data
              Message msg = null; // Handler to get Message object
            try
                   obj = inputModuleData.getPrincipalData();
                   msg = (Message)obj;
                   AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
                   Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---efore reading payload");
                   try
                        XMLPayload xmlpayload = msg.getDocument();
                        String messageStr = xmlpayload.getText();
                        String inputStr = null;
                        String tags[] = new String[2];
                        String values[] = new String[2];
                        Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---before content conversion");
    String tagvalue1 = messageStr.substring(messageStr.indexOf("BEGIN+"), messageStr.indexOf("'");
    String tagvalue2 = messageStr.substring(messageStr.indexOf("'"), messageStr.lastindexOf("ENDING");
                             tags[0] = "tag1";
                             tags[1] = "tag2";
                             values[0] = tagvalue1 ;
                             values[1] = tagvalue2 ;
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---after content conversion");
                             Document xmldoc = null;
                             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                             DocumentBuilder builder = factory.newDocumentBuilder();
                             DOMImplementation impl = builder.getDOMImplementation();
                             org.w3c.dom.Element e = null;
                             Node n = null;
                             xmldoc = impl.createDocument(null, "MT940", null);
                             org.w3c.dom.Element root = xmldoc.getDocumentElement();
                             for(int i = 0; i < tags.length; i++)
                                  e = xmldoc.createElementNS(null, tags<i>);
                                  n = xmldoc.createTextNode(values<i>);
                                  e.appendChild(n);
                                  root.appendChild(e);
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---before dom creation");
                             DOMSource domSource = new DOMSource(xmldoc);
                             ByteArrayOutputStream myBytes = new ByteArrayOutputStream();
                             Result dest = new StreamResult(myBytes);                         
                             TransformerFactory tf = TransformerFactory.newInstance();
                             Transformer serializer = tf.newTransformer();
                             serializer.setOutputProperty("indent", "yes");
                             serializer.transform(domSource, dest);
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---before setting principal data");
                             byte[] docContent = myBytes.toByteArray();
                             if (docContent != null) {
                             xmlpayload.setContent(docContent);
                             inputModuleData.setPrincipalData(msg);
                             Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"sample: Inside sample Module---after setting principal data");
                   catch(ArrayIndexOutOfBoundsException e)
                        e.printStackTrace();
                   catch(StringIndexOutOfBoundsException e)
                        e.printStackTrace();
                   catch(TransformerException e)
                        e.printStackTrace();
                   catch(Exception e)
                        e.printStackTrace();
            catch(Exception e)
                ModuleException me = new ModuleException(e);
                throw me;
            return inputModuleData;

    This is for sender channel. The doubt in adapter module is in the process block how will I get the main data being read by the jms adapter from the text file.As I am reading text file from websphere MQ, the content of the text file can be obtained thru xmlpayload.getText() or is there any other way.
    obj = inputModuleData.getPrincipalData();
    msg = (Message)obj;
    XMLPayload xmlpayload = msg.getDocument();
    String messageStr = xmlpayload.getText();
    At present I am using my adapter module before call sap adapter, but before sap adapter there are two other modules(toBinary and to Xmb), so shld I place it before both or after both the modules.
    Thanx in advance
    Rachit

  • Adapter Module Vs Function Module

    We are creating a Adapter Module to process an Incoming File. The File contains the Material Master data. But there are many records are invalid due to various reasons. We need to strip the badrecords.
    There are around 650 fields in each record and the condition are very complex to be validated in the XI message mapping. Thats were we decided to go with an Adapter Module.
    But my question here is, can i write a Function Module in XI and send the File to the Function Module to validate them and there by strip the bad records, rather than writing an adapter module?
    Any Suggestions

    Hi Jenni,
    I assume that, you are an ABAPer and you do not want to go for an adapter module creation. My suggession would be -
      Use the file adapter. use FCC and create the XML structure you need. Do not have any validations at this time. Just create the XML. Now you have two options -
      a. Create an ABAP mapping and pass this XML to the ABAP mapping. Implement all of you business validation rules here, and create the target structures only when everything looks good. Here you would have full control over the target message.
      b. If you are more interested in writing a FM. creating a function module (rather server synchronous proxy) then implement the logic here. The output structure of this proxy would be with all the good records. You would need to have BPM in this case.
    I beleive I made some sense.
    VJ

  • Does the 'CallSapAdapter' adapter module perform the FCC?

    Hello,
    I have a scenarion where
    Step 1 - An encrypted file has to be picked by the sender file channel
    Step 2 - It has to be decrypted (we have developed an adapter module for doing this, so no problem with that)
    Step 3 - It has to be FCC'ed (since it is a flat file) before sending it to the Integration Engine.
    To execute these 3 steps sequentially, I have configured the Sender File Channel in the following way
    Setting 1 - I have configured the necessary FCC parameters
    Setting 2 - In the 'AdapterModules' tab, I have placed my custom developed decrypter adapter module first followed by the default 'CallSapAdapter' adapter module.
    My question is, will the above setting suffice for carrying out my steps 1 - 3 in the correct order.
    Basically I need to make sure that FCC is done only after decrypting the file.
    So I need to confirm if FCC is being taken care by the 'CallSapAdapter' module.
    Can anybody help me here plese?

    Hi,
    File adapter will check the FCC function first.So you will get error that time.Because you have encrypted data.So use the "MessageTransformBean"module for FCC.
    Step 1 - An encrypted file has to be picked by the sender file channel
    Step 2 - It has to be decrypted (we have developed an adapter module for doing this, so no problem with that)
    Step 3-MessageTransformBean
    Step 4-'CallSapAdapter' adapter module
    Check the bellow link for "Message Transform Bean".
    [http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
    Regards,
    Prakasu.M

  • 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

  • SAP PI crashes because of Custom Adapter module

    Hi,
    We are facing a strange problem. We have deployed a custom adapter module developed in java which accesses a Hardware Security Module(HSM) and uses the keys in HSM to digitally sign our data. Now, when I use particular methods in this code and deploy it on PI server, the server crashes while testing this out. As soon as I run the channel having this adapter module, PI server becomes unavailable. It restarts on its own after a few minutes.
    One of the reasons I identified to be causing this issue is the signing mechanism used in code. When I used a mechanism that was not supported or not correct, it crashed the server. If i corrected it, it worked fine. I found no other thing in my code causing this behaviour apart from this mechanism. But I am still not able to understand how a single method in a code can cause the whole server to crash. Has anybody here faced such a problem? Any pointers would be appreciated.
    We are using SAP PI 7.31 java only installation.
    Thanks,
    Ravi Desai

    Hi Ravi
    1. To check if it is a memory issue. Once you start the channel, check the memory usage in nwa. Check if the memory is increasing once the channel is started.
    2. Add debug statements to print logs in default traces at as many places as possible. Since your code is not reaching the Catch block, using the debug statement you can reach the line in the code which is causing this issue.
    Regards
    Osman Jabri

  • Error in gettnig logon data for Adapter Engine

    Hi,
    We have Http > XI > RFC Scenario. We are getting 401 unauthorized error in "CALL ADAPTER" section. From the trace its clear that the logon data for the adapter engine (there is no value for USER in trace) is not getting poulated. We fixed this issue last evening....i think by doing full cache refresh, but this problem propped up again today. Yesterday when this issue was fixed the USER has "PIISUSER" in the trace.
    We haven't changed any config settings since yesterday so all the passwords and other config info is same. Not sure what's causing this issue. Below is the trace. Any help will be highly appreciated.
    - <Trace level="1" type="B" name="CL_XMS_PLSRV_IE_ADAPTER-ENTER_PLSRV">
      <Trace level="3" type="T">Channel for adapter engine: RFC</Trace>
    - <Trace level="1" type="B" name="CL_XMS_PLSRV_CALL_XMB-CALL_XMS_HTTP">
      <Trace level="2" type="T">return fresh values from cache</Trace>
      <Trace level="2" type="T">Get logon data for adapter engine (SAI_AE_DETAILS_GET): af.ppi.dac-sapd1</Trace>
      <Trace level="3" type="T">URL = http://dac-sapd1.actv2.com:8007/MessagingSystem/receive/AFW/XI</Trace>
      <Trace level="3" type="T">User =</Trace>
      <Trace level="3" type="T">Cached = X</Trace>
      <Trace level="3" type="T">Creating HTTP-client</Trace>
      <Trace level="3" type="T">HTTP-client: creation finished</Trace>
      <Trace level="3" type="T">Security: Basic authentication</Trace>
      <Trace level="3" type="T">Serializing message object...</Trace>
    <Trace level="3" type="System_Error">HTTP-client: error response= <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Error Report</title> <style> td {font-family : Arial, Tahoma, Helvetica, sans-serif; font-size : 14px;} A:link A:visited A:active </style> </head> <body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" rightmargin="0"> <table width="100%" cellspacing="0" cellpadding="0" border="0" align="left" height="75"> <tr bgcolor="#FFFFFF"> <td align="left" colspan="2" height="48"><font face="Arial, Verdana, Helvetica" size="4" color="#666666"><b>  401 &nbsp Unauthorized</b></font></td> </tr> <tr bgcolor="#3F73A3"> <td height="23" width="84"><img width=1 height=1 border=0 alt=""></td> <td height="23"><img width=1 height=1 border=0 alt=""></td> <td align="right" height="23"><font face="Arial, Verdana, Helvetica" size="2" color="#FFFFFF"><b>SAP J2EE Engine/7.00 </b></font></td> </tr> <tr bgcolor="#9DCDFD"> <td height="4" colspan="3"><img width=1 height=1 border=0 alt=""></td> </tr> </table> <br><br><br><br><br><br> <table width="100%" cellspacing="0" cellpadding="0" border="0" align="left" height="75"> <tr bgcolor="#FFFFFF"> <td align="left" colspan="2" height="48"><font face="Arial, Verdana, Helvetica" size="3" color="#000000"><b>  Authentication did not succeed.</b></font></td> </tr> <tr bgcolor="#FFFFFF"> <td align="left" valign="top" height="48"><font face="Arial, Verdana, Helvetica" size="2" color="#000000"><b>  Details:</b></font></td> <td align="left" valign="top" height="48"><font face="Arial, Verdana, Helvetica" size="3" color="#000000"><pre>  No details available</pre></font></td> </tr> </body> </html></Trace>
      <Trace level="3" type="T">HTTP-client: closing...</Trace>
      <Trace level="3" type="T">HTTP-client: sending http-request...</Trace>
      <Trace level="3" type="T">HTTP-client: request sent</Trace>
      <Trace level="3" type="T">HTTP-client: Receiving http-response...</Trace>
      <Trace level="3" type="T">HTTP-client: response received</Trace>
      <Trace level="3" type="T">HTTP-client: checking status code...</Trace>
      <Trace level="3" type="T">HTTP-client: status code = 401</Trace>

    Hi,
    go to the exchange profile.
    there u need to maintain the password for the XIISUSER.
    I think u need to restart the J2EE Engine for the changes to take effect.
    Regards
    Cornelius

  • Setting the charset from an adapter module

    Hi folks,
    I'm trying to set the charset encoding of a payload using an adapter module (I know there is a TextCodepageConverterBean, but I want to set the charset for a message that hasn't one yet). The problem is probably more clear using an example.
    I output a UTF-8 flat string from my message mapping to the adapter framework (mail adapter in my case). Afterwards I want to convert this UTF-8 string to an ISO-8859 encoding with the TextCodepageConverterBean. But if I set the charset using the setContentType() function of my TextPayload object the information gets cut away. I'm using the format
    setContentType("text/plain;charset=utf-8;name=Test.txt")
    . But everything after the first semicolon is dropped. Setting the charset using the MessageTransformBean works, but I want to avoid this by all means, as I need to set the mime type from the adapter module.
    This is running on NW2004 with SP 16 and the latest patch.
    Any idea, why the MessageTransformBean works and not the setContentType call?

    This bug will be fixed with SP20.
    Regards
    Stefan

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

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

Maybe you are looking for

  • My phone is broken and I have yet to understand how to get iCloud to wipe it clean from my laptop.  Can anyone talk me through it?

    I am trying to wipe my broken iPhone 4 and have signed into iCloud on my laptop, but seem to be going around in circles trying to find a simple option to wipe my phone. It keeps telling me to install iCloud, which I have.  Help!

  • Getting woken up at night

    I was wondering if there is a way for the Black Berry program to send emails only during a certain time period. I'd like to stop them at about 10:00 PM and start back at about 7:00 AM if it can. But still get calls a text messages.

  • [SOLVED] Downgrading Wine versions?

    The game I'm trying to play keeps crashing after several minutes of play. Upon researching the problem, it seems that this is a confirmed problem with Wine version 1.1.38, which is the version currently in the AUR. Downgrading to 1.1.37 supposedly fi

  • Error running program AI_CRM_CPY_PROCTYPE in SOLMAN 7.1

    Hi Gurus. I'm trying to run program AI_CRM_CPY_PROCTYPE  to copy transaction type SMIN to ZMIN in SOLMAN 7.1 SP3. When I choose button "start copy process", the program terminates with error "ASSIGN_BASE_TOO_SHORT". Do I need to change something in t

  • Bw testing

    hi i would go for bw testing ...may i know what  to test,how to test .....and is that of mannual or any other tool