cancel
Showing results for 
Search instead for 
Did you mean: 

Java Mapping

Former Member
0 Kudos

Hi All:

I have a scenario where I am want to use Java Mapping.

Input Data :

Fname

Mname

Lname

EmpNo

DOB

Output Data:

Employee (Only one filed with type Sting.)

With the help of Java Mapping I need to concatinate all the input fields and want to assign/map it in filed called Employee (singel target field)

Can any one let me konw what are the basics steps for it?

Thanks & Regards,

Farooq.

View Entire Topic
iaki_vila
Active Contributor
0 Kudos

You can do:

import com.sap.aii.mapping.api.StreamTransformation;

import com.sap.aii.mapping.api.StreamTransformationConstants;

/**/

public class JavaMapping

implements StreamTransformation {

private Map param = null;

private MappingTrace trace = null;

public void setParameter(Map param) {

this.param = param;

if (param == null) {

this.param = new HashMap();

}

}

public void execute(InputStream in, OutputStream out) {

try{

this.trace = (MappingTrace) param.get(

StreamTransformationConstants.MAPPING_TRACE);

//MAKES PROCEDURE TO DO Inputstream to XML Document

//NOW you have an XML -> PROCEDURE TO DO search XML nodes

String prewString = nodeValueA + nodeValueB...

String outString = ("<?xml version="1.0" encoding="UTF-8"?>

" +

"<ns:OUT xmlns:ns10="http://namespace">" +

prewString +

"</ns:OUT>

");

out.write( outString.getBytes());

trace.addInfo("TRACE OK");

}catch (Exception e) {

trace.addInfo("TRACE EXCEPTION:" + e.getMessage());}

// Put this i forgot!

String receiverName = (String) param.get(

StreamTransformationConstants.RECEIVER_NAME);

}

}

null

Message was edited by:

Iñaki Vila (i forgot the final code)

Message was edited by:

Iñaki Vila