Java code to add message to existing payload
Hi,
See the below links may be useful...
Sender mail adapter - PayloadSwapBean - Step by step -/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step
SAPconnect - The Interface in the R/3 System for E-Mail/Fax Systems -
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4b4fa090-0201-0010-d3b7-b233296d95ff
Also you can use the alert management and configure the scot and use the sender spicific , mail address in user by su01, and finally raise an alert from payload .
Alerts with variables from the messages payload (XI) - UPDATED - /people/michal.krawczyk2/blog/2005/03/13/alerts-with-variables-from-the-messages-payload-xi--updated
Triggering XI Alerts from a User Defined Function - /people/bhavesh.kantilal/blog/2006/07/25/triggering-xi-alerts-from-a-user-defined-function
Regards
Chilla
Dude,
an attachment is like another payload in the same message (which has a main payload). It is not like your scenario.
You don't need a custom module at all for that. Just go for message mapping.
And if you do want to implement a full XML Digital Signature compliant signature field (as described in http://www.w3.org/TR/xmldsig-core/), refer to the Digital Signatures and Document Encryption API:
http://help.sap.com/saphelp_nw04s/helpdata/en/4f/65c3b32107964996a56e4165077e24/frameset.htm
In this case you'll need a java mapping or a custom module (java mapping is way easier, tho) to perform the signature, as described in the example:
http://help.sap.com/saphelp_nw04s/helpdata/en/a4/d0201854fb6a4cb9545892b49d4851/frameset.htm
Regards,
Henrique.
Similar Messages
-
How to get the java code of the message mapping
how to get the java code of the message mapping,
I mean to ask how to get the background java code of the message mapping(graphical mapping).
And where to view it?Hi Satya,
The JAVA code for graphical msg mapping is in below folder:
\usr\sap\<SID>\<DVEBMGS10>\j2ee\cluster\server0\temp\classpath_resolver
Here all the mapping jars are there in this folder.
Just decompile these jars and you can see the code.
Thanks,
Rajeev Gupta
Message was edited by:
RAJEEV GUPTA -
How to view the java code of the message mapping,
Hi Experts,
<b>how to view the java code of the message mapping,</b>
how to get the background java code of the message mapping(graphical mapping).
And where to view it?Hi sowmya,
Open any Message mapping in IR. Press <b>CtrlShift0(zero)</b> to open a new menu.
There you will find an option "Is Java Source Code Available?"
There will be an export button nearby. Use it to get the code.
Open it in a zip , you will see the hide java code.
The JAVA code for graphical msg mapping is in below folder:
\usr\sap\<SID>\<DVEBMGS10>\j2ee\cluster\server0\temp\classpath_resolver
Here all the mapping jars are there in this folder.
Just decompile these jars and you can see the code. -
Error in java code for removing messages from a Topic
Trying to write a code using oracle.jms package to remove messages from Topic. I have a similar code with javax.jms package for removing messages from Queue and it is working well. Whereas i have written this new code for removing messages from topic using oracle.jms package as methods like CreateBrowser and CreateTopicReceiver for topic are provided in oracle package only and can't be used from javax.jms package.
Error i am getting is JMS-126: Invalid Topic specified at
receiverTopic = (Topic) ctx.lookup(((String)receiverProps.get( "Q_NAME")).trim() );
System.out.println ("receiverTopic is[" + receiverTopic + "]");
MBeanHome home = (MBeanHome) Helper.getAdminMBeanHome("username","pwd","url:port");
((AQjmsSession)topicSession).grantSystemPrivilege("MANAGE_ANY", "SA", true);
for(Iterator i = home.getMBeansByType("JMSTopic").iterator();i.hasNext(); )
WebLogicMBean wmb = (WebLogicMBean)i.next();
System.out.println("topic name found: " + wmb.getName());
topicBrowser = ((AQjmsSession) topicSession).createBrowser(receiverTopic, "Edin");topic handle which i am receiving in receiverTopic is same as what i am expecting but still it says Invalid topic specified on createBrowser method. Anyone who can help me to write this type of code, please reply. If anyone has ready code for this situation, please reply with the same as i am working on a prodcution system and we are in serious situation to resolve this problem.Hi,
I am afraid this is impossible. You need to find another solution like a filtering queue. Your messages can be sent to a queue that is monitored by let say a MDB. This MDB will maintain a map of title and only forward once a given title/message to your topic.
Hope it helps.
Arnaud
www.arjuna.com -
Monitor message in adapter engine through java code
Hi all,
I need to write a java code to monitor message using message ID in adapter engine.
Is it possible to write such a code?
If yes, then please provide information regarding to that.Hi,
Check these threads
Retrieving a message id
Re: How to extract XI-header fields from XI-message in JAVA?
Thanks! -
Required Java Code for Validation
Hello Everybody
I need a java Code To validate the value exist in system
For an user Defined Function.
System A value Need to Compare in System B.
IF the value exist in System B Then need to sent to System C.
early answer would be great
Regds
RajHI,
Lookup has to be use in this case.
Steps to be done:
1) Get the value from the file and pass that value to R3 system using JAVA lookup.
2) In R3 end under the function module write a code which checked the PO with the PO which is present in R3.
3) Return the value of the comparision to UDF and then pouplate the value in IDOC.
I hope this is what u want.
Lookup links are below:
Some use cases:
Look up material number from table MARA.
Look up cost center budget.
Look up employee information.
Look up unit-of-measure (UOM) information from table t006a.
Lookup for raising an alert.
There are two ways in which we can do lookup:
Call lookup method from GUI mapping.
Call lookup method from XSLT mapping.
Lookup method from GUI mapping can be called using any of the following ways.
RFC lookup using JCO (without communication channel)
/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
RFC lookup with communication channel.
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
Lookup using JDBC adapter.
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
/people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
CSV file lookup.
/people/sundararamaprasad.subbaraman/blog/2005/12/09/making-csv-file-lookup-possible-in-sap-xi
Call lookup method from GUI mapping: Use this for ur scenario:
The steps are as follows:
Develop and test ABAP function module.
Develop and test Java method within Integration Repository/message mapping tool.
Check this weblogs with some screenshots on how to achieve this:
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
/people/sravya.talanki2/blog/2005/12/21/use-this-crazy-piece-for-any-rfc-mapping-lookups
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
/people/sap.user72/blog/2005/12/06/optimizing-lookups-in-xi
/people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
Thnx
Chirag -
How to modify an existing xml file from java code.
Hi
I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
For example if xml file(studlist.xml) is as below:
<?xml version="1.0" encoding="UTF-8"?>
<StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
<Student>
<Name>ram</Name>
<Age>27</Age>
</Student>
<Student>
<Name>sham</Name>
<Age>26</Age>
</Student>
</StudentList>
Now suppose i have set name to victor using student.setName,
and set age to 20 using setAge from javacode,
the new xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
<Student>
<Name>ram</Name>
<Age>27</Age>
</Student>
<Student>
<Name>sham</Name>
<Age>26</Age>
</Student>
</StudentList>
<Student>
<Name>victor</Name>
<Age>20</Age>
</Student>
As observed this is not a valid xml file.But how can i modify without any errors?I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
// gets the root element of the specified file (code not shown)
Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
// write a new student element
Element student = document.createElement("Student"); // creates the new student
rootElement.appendChild(student); // ***appends it to the root element***
Element name = document.createElement("Name"); // creates the name element
name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
student.appendChild(name); // appends the name to the student
Element age= document.createElement("Age"); // creates the age element
age.appendChild(document.createTextNode("26")); // adds the age text to the age element
student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM -
JNI Calling Java code when attaching to existing JVM
I've got an Active/X that runs within IE, and also makes JNI calls (via the Invocation API) to Java code. Running within IE means there's already a JVM around, so I attach to it using JNI_GetCreatedJavaVMs
This is fine. The problem is that I can't use the JNI findClass() to locate my Java classes, because I have no control over the classpath that the JVM is using to locate classes. The only solution I can think of so far is to either add my classes as part of the JVM, OR find out the classpath of the existing JVM (using System.getProperty("java.class.path") and copy my classes into that directory.
Both solutions look ugly - anyone know of a cleaner way ?
Mark.Toby, thanks for the reply.
You're welcome.
I notice from elsewhere on this forum, you're clearly a JNI expert.
I've been known to work with it a little from time to time. =)
My code has to work with JDK 1.1 so URLClassLoader is out. Writing my own classloader is fine, but how do I load it in the first place ? Is there something in JNI I've missed ?
Possibly. Using DefineClass() you can load a class into the virtual machine, given it's byte-code. Now here's the tricky part. First, write your ClassLoader. It will be easiest if it doesn't rely on any other classes other than what is core to the JRE. Once you compile that classloader, you then need to include the bytecode as a resource in your executable/dll. Then, at runtime, you can load that resource, and use DefineClass to class-load it. Once you've class-loaded it, you can use NewObject, GetMethodID, CallXXXMethod, etc... to do the other class loading you need to do.
Trust me, this really isn't as hard as it might sound.
God bless,
-Toby Reyelts
As always, I recommend you check out the free, open-source JNI toolkit, Jace, at http://jace.reyelts.com/jace. -
Unable to select multiple with holding tax codes.
This entry already exists in the following tables '' (ACPR) (ODBC -2035) [Message 131-183]Hi,
Actually this is an application error in 2007 A and there is no version/PL to fix this issue.
Refer SAP note 1260874 - Cannot add a new BP with ITW tax code
Thanks & Regards,
Nagarajan -
Updating an existing xml file using java code
hi friends,
I have simple problem, I have an existing xml file and I want to update some of the values in the file.
can any one send me the java code for that.
bye.
-harishorg.w3c.dom.Document d = parseXmlFile("D:/www/Detailcache/detail.xml", false);
public static Document parseXmlFile(String filename, boolean validating) {
try {
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(validating);
// Create the builder and parse the file
Document doc = factory.newDocumentBuilder().parse(new File(filename));
return doc;
} catch (Exception e) {
System.out.println("ERROR-->");e.printStackTrace();
return null;
look at .. for more related examples
http://javaalmanac.com/egs/javax.xml.parsers/BasicDom.html?l=rel -
Add numberconverter to inputtext by java code
my page is dynamically created by java code.
how can i add a numberconverter to an inputtext by code?
HtmlInputText intext = new HtmlInputText();
NumberConverter ncnv =new NumberConverter();
ncnv.setCurrencyCode("");
ncnv.setGroupingUsed(true);
ncnv.setMaxIntegerDigits(11);
ncnv.setType("currency");
.Use setConverter().
-
PackageDoc: how to add package Comments in Java code?
There is a PackageDoc.commentText() that (should) return package comments. This would be great because i want to write package related comments. But where in the java code do i have to add this text? i tried adding javadoc over a apckage declaration:
* Test package comment.
package de.dlib;But PackageDoc.commentText() for this package returns nothing...Each package can have its own documentation comment, contained in its own "source" file, that the Javadoc tool will merge into the package summary page that it generates. You typically include in this comment any documentation that applies to the entire package.
To create a package comment file, you must name it package.html and place it in the package directory in the source tree along with the .java files. The Javadoc tool will automatically look for this filename in this location. Notice that the filename is identical for all packages.
For more info:
http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html#packagecomment
-Doug Kramer -
How can i add more statements in java code dynamically...
I have a (business works) BW process in TIBCO which has many activities including �java code�. In java code activity I have some if statements like
if (Country.equals("USA�))
Country code = 1
else if(Country.equals("GERMANY�))
Country code = 49
the above information is coming from database. now my project is deployed and running. In future, if they add more countries in database how I can include them dynamically without changing my BW process java code activity and redeploying again. Is there any solution?
Please advice.You won't reconfigure the Java application without redeploying. This is one of the reasons that including data in the code is bad.
If you created a file which contained data like this:
Canada <tab> 1
USA <tab> 12
Germany <tab> 6
Then your program could read the file into a map. The map could be used to lookup the country code based on the name.
In the future, you could change the file to:
Canada <tab> 1
USA <tab> 12
Germany <tab> 6
France <tab> 17
China <tab> 2
And the program wouldn't need to be changed. You would just need to send out the new country file. -
OpenScript/How to add .jar file to Java Code in relative path
Hi all,
I want to add a .jar file which can be executed separately (like "java -jar A.jar") to my recorded Java Code.I've read this wiki http://everest2.us.oracle.com/wiki/Generic_JAR_Project about how to add a .jar file to "Assets", however, I cannot figure out how to use the .jarr file in Java code,I mean , how to get this .jar file like the method the databank added in "Assets"?
Things I did are as followed:
1.Execute my .jar file in OpenScript Java code with absolute path like this:
String cmd = "C:\Users\A.jar";
Runtime.getRuntime().exec(cmd);
This does work, but must set a absolute path in Java code like "C:\User\A.jar" ,which is not the workaround I want (I need my scripts can be run on other machines).
2.Try to get its current path with following codes:
File directory = new File(".");
String currentPath=directory.getCanonicalPath();
However,though this can get its absolute path (which is the the project path) in Eclipse like "C:\Users\Workspace\testProject", this only gets "C:\OracleATS\openScript" in OpenScript.
I thought to copy my .jar file to the project path , got its current path in java code first,then can know the path of .jar file, but this workaround failed because of the above reason.
I notice that in the "Assets" there are "Databanks","Object Libraries","JAR Files","Scripts". Since the databanks and scripts that added to "Databanks" and "Scripts" can be got or run in Java Code like:
*getDatabank("DatabankName").getNextDatabankRecord(); String data = eval("{{db.DatabankName.data}}");*
*or getScript("ScriptName").run();*
*Is there a method to get and run the jar file added to "Assets\JAR Files" like the above?*
Thank you very much!
Regards,
AngyoungHi DM,
Thanks for your reply!
I've found a workaround,which is calling OpenScript's APIs ,such as this.getScriptPackage().getRepository() and this.getScriptPackage().getWorkspace(),etc to locate the .jar file.
And this workaround can still work even though the script is run on other machine.
Sorry to reply you so late!
Regards,
Angyoung -
Can't add formatted code to forum message
The new message editor is nice, except for the fact that it destroys formatting of code blocks! In the old editor, we could use the
tags to maintain formatting, but the new editor has no such tag. Also, the HTML tag <pre> ... </pre> is not supported.
Since a lot of messages are code-related, and users include blocks of code in questions or replies, it would be a good idea to return the notion of pre-formatted blocks of text, so that the following example is averted:
<u>Example</u>
<b>
function myFunction(int x)
if(x < 2)
println("x < 2");
else if(x > 2 && x < 4)
println("x is between 2 and 4");
else
println("x > 4");
</b>
Horrible!
WalterHi Walter,
please read this post [here|Forum Upgrade - Some Details;. The old Java code filter is buggy and caused trouble due to infinite loops. Therefore we had to shut it down.
Anyway, as you can read in my first post, a new markup should be used: Just put two {code} around your code, and it will look like this:
System.out.println("Hallo");
Regards,
Michael
Maybe you are looking for
-
[email protected]
-
Howdy i installed the appropriate driver and did as per demand on wiki, but i still cant seem to activate wifi. fn+F2 is the required buttons to push. This does nothing To be fair, atm there is no wifi around, but it should be possible to activate it
-
Reason of rejection field in sales order
Hi All, For a sales order when we create subsequent document i.e delivery...etc the reason for rejection field at item level gets Grayed out and the function module BAPI_SALESORDER_CHANGE is not updating it and returining the message " Field 'ABGR
-
HOW TO USE ATTRIBUTE VALUE IN FOX FORMULA LOOP
HI, IAM SUMMING UP AMOUNT BASED ON BELOW COMBINATION AND THROWING MESSAGE IF AMOUNT IS EXCEEDING OPENPO VALUE....AND IS WORKING FINE...NOW I HAVE A ENHANCE MENT THAT I HAVE TO USE ATTRIBUTE PROFIT CENTER VALUE IN THE LOOP. I HAVE DECLARED THIS --- PC
-
Still Life project going horribly wrong. Please help!
First let me say that I am new to this board. I've been reading here and searching to see if I could find my answer, but after doing this, reading booklets and searching the internet, I still can't wrap my mind around what I need to do and what I'm