cancel
Showing results for 
Search instead for 
Did you mean: 

Sample application XI in java

Former Member
0 Kudos
63

Hi All,

Can anyone send sample programs in XI.

jsp-> controller-> database

how much scope of the java we are going to use in XI.

Thank you

with best regards

Jeevan Roy

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

java is extensively used in XI .... for

1 .creating mapping program ( SAX and DOM Parser are used).

2. Creating user defined function in mapping.

3. for creating custom logging framework in XI.

4. for creating adapter modules.

5. for creating lookup programs in mapping..

Ranjeet.

Former Member
0 Kudos

Thanks alot Ranjeet.

3. for creating custom logging framework in XI.

(Can you explain what is logging framework in xi. which like a struts framework.)

4. for creating adapter modules.

(how can we create adapter modules. can you explain in java terminalogy)

5. for creating lookup programs in mapping..

(is it like a search mechanism in java )

prabhu_s2
Active Contributor
0 Kudos

<b>4. for creating adapter modules.<b>

when u want some opertation to be performed at adapter level u create module and export at the CC level.

<b>5. for creating lookup programs in mapping..

(is it like a search mechanism in java )</b>

u have material number and plant and based on this u need to map the description field in the target. here u wud gofor lookup which are of database lookup and rfc lookup. here u would make a call to the DB and get the description and pass the value to the target fields. this opertaion is carried in the user defined function in MM

Former Member
0 Kudos

Can you anyone send some sample program in XI

for creating adapter modules.

for creating lookup programs in mapping..

Thank you.

With best regards,

Jeevan

prabhu_s2
Active Contributor
0 Kudos

u can search in this forum...lots of materials avaiable on lookups and module creation

Former Member
0 Kudos

a sample program for adapter module: this has the main process function...

-


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;

}

-


for creating adapter module refer to

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac2...

Former Member
0 Kudos

Thank you ranjeet

prabhu_s2
Active Contributor
0 Kudos

<b>how much scope of the java we are going to use in XI.</b>

depends. u use java for UDF and if req u can use it for creating mapping program which is then imported to IR and used in IM. Creation of mapping program also has alternative to be done in abap and xslt. and also used in modules and creation of customized adapters

Message was edited by:

Prabhu S