cancel
Showing results for 
Search instead for 
Did you mean: 

Java Mapping. Pls help

Former Member
0 Kudos

Hi,

Question:

1. What is java mapping.

2. How I use java mapping/UDF in message mapping

for my below scenario

In my Request XML there are 2 fields.

In my Response XML there are 2 fields.

Field 1 of Request XML needs to be mapped directly to

Field 1 of Response XML.

Field 2 needs to be passed as paramter to java class and

java class will be give response that will be mapped to

Field 2 of Response XML.

Pls advice . It is urgent.

Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member556603
Active Contributor
0 Kudos

Hi Rac,

Java mapping can be used when you have complex mapping structures.

We can do most of the times for our requirements through Graphical mapping.

When the structures are very complex to build you can go for SAX (Simple API for XML) or DOM (Document Object Model) parsers.

Message mapping internally generates DOM parser.

Java Mapping in XI

https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rn...

SAP Network Blog: Implementing a Java Mapping in SAP PI

/people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi

Java Mapping (SAP Library - Partner Connectivity Kit)

http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm

SAP Network Blog: XI Java Mapping Helper (DOM)

/people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom

SAP Network Blog: Testing and Debugging Java Mapping

/people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio

Binary Conversion in XI - Java Mapping - Code Gallery - Wiki

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/binary%2bconversion%2bin%2bxi%2b-%2bjava...

SAP Network Blog: "JAVA MAPPING", an alternate way of reading a CSV file

/people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file

Thanks,

Satya Kumar.

Reward points if it is useful..

Former Member
0 Kudos

Hi ,

My question is can Java Class that is used in Java Mapping be converted into a Method and can be used in User Defined Function of Messsage Mapping?

It means now instead of passing parameter to java class I will

pass parameters to User Defined Function and will get result back and map it to response structure.

Can this be done?

Thanks

Former Member
0 Kudos

Hi,

yes it's possible.

Please have a look here:

http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/frameset.htm

It says:

> You can use your Java programs from imported archives in user-defined functions if the Java programs are located in the same, or an underlying software component version as the message mapping.

Regards

Patrick

Former Member
0 Kudos

Yes Rac.

You can achieve it just by UDF itself. You don't need to go for Java mapping for this requirement.

Regards

Bhanu

Intelligroup.

Former Member
0 Kudos

Hi Bhanu,

So my scenario will be :

Request XML --- there are 2 fields.

Response XML --- there are 2 fields.

Field 1 of Request XML needs to be mapped directly to

Field 1 of Response XML.

Field 2 needs to be passed as paramter to User Defined Function.

Now this function will open Socket Connection and get response from Socket. Then socket response will be mapped to Field 2 of Response XML.

Am I corrcet?

Regards

ravi_raman2
Active Contributor
0 Kudos

Yes, that sounds fine....make sure your return is of the correct expected type...

Regards

Ravi Raman

Former Member
0 Kudos

Yes Rac.

Field 1: you can direclty map it.

Field 2: give the source field to UDF and map the output from UDF to target field. And write your respective logic in UDF. That way of solution for your requirement.

Regards

Bhanu

Intelligroup.

Former Member
0 Kudos

Hi Bhanu/ Ravi

Thanks a lot!!!

Please let me know one more thing.

If suppose I need to use Java Class(Java Mapping).

I need to map first field of request xml directly to first field of response xml.

And 2nd field of request xml needs to send as parameter

to Java Class and response of Java Class to 2nd field of

response xml.

Can you pls describe me in deatil how to do it .

I will be available again in 1 hour. Pls advice.

Regards

Former Member
0 Kudos

Hi Rac,

If you go for Java Mapping, you don't use Message Mapping. I hope you know it. In Interface Mapping, you are going to chose the mapping type as Java. So, as you are expecting it is not possible for applying java mapping only for specific fields in source structure.

Java Mapping will take entire source structure and do the transformations (as defined in program), and generates an output strucure, which will be your target structure.

Hope you understand that applying java mapping only for Field 2 is not possible; instead you need to apply program for entire source.

Regards

Bhanu

Intelligroup.