on 08-09-2007 5:37 AM
Hi ,
Can any one suggest me where to use adapter modules ?Any real time instance? Any use full material in this regard ?
Thanks and Regards
Mahesh.
i think you have all the document for adapter module... Here is a sample example of code...that we had developed...
basically all you logic will b implemented in process method...
where you read the payload... convert it into appropriate format and
then you implement you business logic of the payload...
in the end you set the payload so that standard module of xi can red the payload and do the further processing.....
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;
try
{
XMLPayload xmlpayload = msg.getDocument();
String messageStr = xmlpayload.getText();
String inputStr = null;
String tags[] = new String[2];
String values[] = new String[2];
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 ;
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);
n = xmldoc.createTextNode(values);
e.appendChild(n);
root.appendChild(e);
}
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);
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;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi !!
did you checkd this Adapter and Module Development:
http://help.sap.com/saphelp_nw04/helpdata/en/8b/895e407aa4c44ce10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/96/f04142099eb76be10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/3d/8d5e407aa4c44ce10000000a1550b0/content.htm
How to create modules -
Pls rewards if useful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Go through the following links....
/people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter
/people/sap.user72/blog/2005/07/15/copy-a-file-with-same-filename-using-xi
How to Guide: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f013e82c-e56e-2910-c3ae-c602a67b...
regards,
vasanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<i>Can any one suggest me where to use adapter modules ?</i>
To enhance the functionality provided by the existing adapters
<i>Any real time instance?</i>
For conversion of EDI files (EDIFACT and ANSI X12), u may write a module for file adapter which may convert the EDI files to xml files.
<i>Any use full material in this regard ?</i>
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
helpful one::
/people/michal.krawczyk2/blog/2006/10/09/xi-dynamic-configuration-in-adapter-modules--one-step-further
Regards,
Pratibha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
We use adapter module when we want to enhance the existing adapter.
Regards,
S.RamNarender
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.