Java Class Mapping Program in BPM process

I have a scenario where I'm receiving an IDOC I then use a JAVA mapping program in my first transformation step.  Immediately following I have a switch step but there is not data in from the mapping program.
1) Receive Step
2) Transformation IDOC to Table using Java class
3) Switch step based on Table field value
Problem is there is no values in the table. 
This java class was not developed within NetWeaver but was used in our old process. We simply imported the jar file for accessing our existing java classes.  Is there something else we need to do to utilize our java modules within the BPM process?

Hi,
You must to have in the java class:
- You java have to be like:
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import java.util.HashMap;
import com.sap.aii.mapping.api. AbstractTrace;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
public class JavaMapping implements StreamTransformation {
   private Map           param = null;
   private AbstractTrace  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 {
         trace = (AbstractTrace)param.get(
                   StreamTransformationConstants.MAPPING_TRACE );
         trace.addInfo(‘...’);
         String receiverName = (String)param.get(
                   StreamTransformationConstants.RECEIVER_NAME);
The method execute take the InputStream with the XML source. The out (OutputStream) have to be an XML like the IDOC structure.
Regards.

Similar Messages

  • Performance of jdbc mapping lookup vs BPM Process

    Hello fellow consultants,
    I have project on AEX upcoming and now I`m deciding the strategy.
    I have to implement few processes for which I will use BPM. But inside these processes I have few jdbc calls for logging to the oracle db.
    Regarding the performance - what is better approach?
    make these jdbc calls as a jdbc lookup in mapping
    perform it as a regular part of bpm process
    Thank you for suggestions
    VB

    Hi VB,
    I have a different opinion than Fouad although I can understand his point, but for me, lookUps are rarely good and well implemented and it should be used in a very specific, required and critical scenarios. This is because this lookUp connection is not manageable, out of monitoring stuff and I don't think in the mapping step is the correct moment to open a JDBC connection with partner all of sudden.
    My Idea is more for the point number 2, where you have everything well explicit step by step, opening the connection being manageable, with monitoring even though it may bring one or two steps more to your BPM but I'm more concerned at this moment to follow the best practice of integration and thinking in Performance I don't think there will be a gain that would justify the JDBC Lookup.
    Regards,
    Diego 

  • How to trigger a JAVA class when replication is processed?

    Hi,
    How I can trigger a JAVA class when a replication is processed?
    Also I want to get the payload involved in that process.
    Is there any way to do this?
    Please post your suggestions on this...
    Regards,
    Shankar .A

    If you are interested in building your own payload format, check the ContentBuilder interface.
    If you want to get notified, when a replication is triggered, check the Sling event tab in the Felix console (http://localhost:4502/system/console/events). You can register your event OSGI event listener and process that information. See http://sling.apache.org/documentation/tutorials-how-tos/how-to-manage-events-in-sling.html for some more information and samples.
    Jörg

  • Split in Mapping Program

    Hai,
    is it possible to use different Mapping programs in one process? For example I use Idoctype ACC_GL_POSTING01 to book some values from 3rd party into R3.
    So now I have to make a different mapping in according to the booking code coming from 3rd party.
    So what you guys think is the best way to solute this?
    Because I don't want to make large If-statements in one mapping program - if their is any better way!
    THX Matt
    Message was edited by: Matthias Boettger

    Hi Matthias,
    sure:)
    you can insert a switch step
    (which will take into consideration the bookig code)
    and on the basis of this create branches with different interface mappings (so different mapping programs)
    but you have to do it in BPM (integration process)
    Regards,
    michal
    Message was edited by: Michal Krawczyk

  • Mapping inside/outside BPM

    Hi All,
    I would like to know the flow when  mapping is inside BPM and when it is outside BPM.
    And also about the configuration steps in either cases.
    Thanks,
    Vishal

    Hi,
    Try to avoid using transformation step in BPM, executing mapping program in business process engine not advisable.
    Try to execute the mapping program in Interface determination level, in this case mapping will execute in Integration engine.
    Flow :
    Sender Communication Channel pick ups the message and send it to Adapter engine ,from there internal XI adapter will take the message from AE and send it IE,when you use BPM ,BPE engine come in to picture to execute/process the message, if you use Transformation step , then mapping program will be executed in Business Process Engine.
    After execution of mapping program in BPEN then message will be send to IE, from there to AE.
    Outbound service Interface---sender abstract interface-receiver abstract interfaceinbound interface (some times).
    AE-IEBPEIEAE
    Regards,
    Raj

  • Calling java class from jsp page

    Dear Friends.
    I wrote jsp page and java class.
    Am calling java class from jsp page. after processing result,
    I have to refresh jsp page from java class.
    processing time may take 5 minutes or 1 minute etc. that depends on user.
    Can It be possible ? if possible , How ?

    Ok, I get a very strange error now:
    org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
    What is this??? Anyone?

  • Template for documenting Java classes

    Could anyone suggest a website that provides a template for the correct format for documenting Java classes, and programs?
    I have been told there is one on the Java website, but after hours of searching it I could not find the specific page for the template.
    Thanks for the help!!!!!

    I assume u want to use the javadoc tool:
    http://java.sun.com/j2se/javadoc/
    http://java.sun.com/j2se/javadoc/writingdoccomments/index.html

  • PDE-UJ1001, while trying to import java classes.

    Hi,
    When I try to import java classes into forms using the java
    importer, I get an error stating PDE-UJ1001-Failed to create
    JVM. I tried installing a patch in Developer 2000(Path 4a). But
    still it doesnt work. Could anybody guide me in this?
    Thanks,
    Karthick.

    am getting similar error - my dba has suggested that oracle developer uses the jvm from ie4 but i'm sure that cant be true as i thought the jvm was built in.
    could somebody out there clarify this or inform me whats missing..
    error
    from dev 6i forms builder (6.0.8.11.3) on 8i (8.1.7.2.0) when trying to select option 'import java classes' from program menu returns error 'PDE-UJ1001 Failed to create the JVM.'
    regards and thanks in anticipation....
    vin ferguson

  • Problem When Import Java Class -compilation error

    Hi all
    I made a java class that has methods to return Screen width and Height .
    package tarek;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    public class Screen
    Dimension dim ;
    public Screen()
    dim = Toolkit.getDefaultToolkit().getScreenSize();
    public double getWidth()
    double w = dim.getWidth();
    return w;
    public double getHeight()
    double h=dim.getHeight();
    return h;
    I made the jar file " screen.jar" and make it ready to use in form builder
    I opened form builder and make import java class (From program>import java class>choose the class anc click import)
    The class now imported successfully and the PL/SQL package body is:
    PACKAGE Screen /* tarek.Screen */ IS
    -- DO NOT EDIT THIS FILE - it is machine generated!
    -- Constructor for signature ()V
    FUNCTION new RETURN ORA_JAVA.JOBJECT;
    -- Method: getHeight ()D
    FUNCTION getHeight(
    obj ORA_JAVA.JOBJECT) RETURN NUMBER;
    -- Method: getWidth ()D
    FUNCTION getWidth(
    obj ORA_JAVA.JOBJECT) RETURN NUMBER;
    END;
    Now I made a button on the form and i WRITE THIS CODE TO INVOKE THE CLASS on when_button_pressed
    DECLARE
         vScreen_Class ORA_JAVA.JOBJECT;     
    BEGIN
         vScreen_Class := SCREEN.NEW;
    END;
    My problem is I have compilation error
    error 306 AT LINE 5 , COLUMN 25
    wrong number or types of argument in call to "NEW"
    I do not know what is the reason of this compilation error?
    Is it because the method in java return "double datatype" while in oracle return "number datatype"
    Please help
    Edited by: [email protected] on Dec 28, 2009 10:24 AM

    Sarah, I ca not move my thread to JDeveloper because it is not java issue. The problem is with my PL/SQL code and the way I make Import Java class to forms Builder. The Java code is OK.
    Andreas Thank you so much for replying. In fact I made a full compile "Ctrl+Alt+K". but still error
    The following is the package Body
    PACKAGE BODY Screen IS
    -- DO NOT EDIT THIS FILE - it is machine generated!
    args JNI.ARGLIST;
    -- Constructor for signature ()V
    FUNCTION new RETURN ORA_JAVA.JOBJECT IS
    BEGIN
    args := NULL;
    RETURN (JNI.NEW_OBJECT('tarek/Screen', '()V', args));
    END;
    -- Method: getHeight ()D
    FUNCTION getHeight(
    obj ORA_JAVA.JOBJECT) RETURN NUMBER IS
    BEGIN
    args := NULL;
    RETURN JNI.CALL_DOUBLE_METHOD(FALSE, obj, 'tarek/Screen', 'getHeight', '()D', args);
    END;
    -- Method: getWidth ()D
    FUNCTION getWidth(
    obj ORA_JAVA.JOBJECT) RETURN NUMBER IS
    BEGIN
    args := NULL;
    RETURN JNI.CALL_DOUBLE_METHOD(FALSE, obj, 'tarek/Screen', 'getWidth', '()D', args);
    END;
    BEGIN
    NULL;
    END;
    ---------------------------------------------------------------------------------

  • Global Container in Java Class of Interface Mapping

    I have written a Java Class that implements the StreamTransformation interface for use in an Interface Mapping. I would like to cache information read from a file between message processing calls of this mapping.
    It appears that maybe the GlobalContainer object can be used to perform this caching. How do I access the GlobalContainer object from a class that implements StreamTransformation?
    The examples all show container.getGlobalContainer() method call to get access to this object. However container is not a variable in this interface. Any ideas on how to do this?
    Thanks,
    Jay

    Hi Jay,
    if you want to link data from different messages you must use BPM, you cannot do this with GlobalContainer because it is instantiated at the begin of the mapping and is flushed at the end of the mapping (e.g. graphical mapping).
    2 files for the same scenario will use 2 different instances of the same message mapping program and they will not share the container.
    The container is shared inside the same instance of the mapping program.
    So it is shared for example between two UDF in the same mapping
    So if you are using Java mapping you do not need to use the global container, you can use an Object to store data, but keep in mind that all this data will be lost at the end of the mapping.
    Hope it helps,
    Kind Regards,
    Sergio

  • Error in Java Mapping program

    Hi friends,
    I am tryin java mapping for first time.. and created one java program using link https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field
    But when I am compiling it using JAVAC, I am getting following error message that
    package com.sap.aii.mapping.api does not exist . How can I solve this error.
    Complete error is as follows:
    C:j2sdk1.4.2_16-x64 in>javac PayloadToXMLField.java
    PayloadToXMLField.java:1: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformation;
                                   ^
    PayloadToXMLField.java:2: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.AbstractTrace;
                                   ^
    PayloadToXMLField.java:3: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformationConstants;
                                   ^
    PayloadToXMLField.java:8: cannot resolve symbol
    symbol  : class StreamTransformation
    location: class PayloadToXMLField
    public class PayloadToXMLField implements StreamTransformation {
                                              ^
    PayloadToXMLField.java:16: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class PayloadToXMLField
        AbstractTrace trace;
        ^
    PayloadToXMLField.java:27: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class PayloadToXMLField
                (AbstractTrace) param.get(
                 ^
    PayloadToXMLField.java:28: cannot resolve symbol
    symbol  : variable StreamTransformationConstants
    location: class PayloadToXMLField
                    StreamTransformationConstants.MAPPING_TRACE);
                    ^
    PayloadToXMLField.java:43: cannot resolve symbol
    symbol  : variable outputPayload
    location: class PayloadToXMLField
            outputPayload =
            ^
    PayloadToXMLField.java:50: cannot resolve symbol
    symbol  : variable outputPayload
    location: class PayloadToXMLField
                out.write(outputPayload.getBytes());
                          ^
    9 errors
    Thanks,
    Brijesh Soni

    thanks , it is done now..
    the program is compiled properly and class file is generated.
    but m gettin error in mapping.
    in IR i created two message type  with data type as string.
    and i had imported the class file and java program using Imported archives.
    now in interface mapping mapping program i had selected type as Java Class.and name of java program.
    but when i tested it, it is giving error as Linkage error occurred when loading class zip/PayloadToXMLField
    Please suggest, M i doing some thing wrong?is any thing missing?
    Program tht i had used in java
    from link (https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field):
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import java.util.Map;
    import java.io.*;
    public class PayloadToXMLField implements StreamTransformation {
        String strXML = new String();
        String outputPayload = new String();
         //Declare the XML tag for your XML message
         String StartXMLTag = "<Payload>";
         String EndXMLTag = "</Payload>";
        AbstractTrace trace;
        private Map param = null;
        public void setParameter(Map param) {
            this.param = param;
        public void execute(InputStream in, OutputStream out) {
            trace =
                (AbstractTrace) param.get(
                    StreamTransformationConstants.MAPPING_TRACE);
            trace.addInfo("Process Started");
            try {
                StringBuffer strbuffer = new StringBuffer();
                byte[] b = new byte[4096];
                for (int n;(n = in.read(b)) != -1;) {
                    strbuffer.append(new String(b, 0, n));
                strXML = strbuffer.toString();
            } catch (Exception e) {
                System.out.println("Exception Occurred");
            outputPayload =
                "<?xml version="1.0" encoding="UTF-8"?>"
                   + StartXMLTag
                   + strXML
                   + EndXMLTag;
            try {
                out.write(outputPayload.getBytes());
                   trace.addInfo("Process Completed");;
            } catch (Exception e) {
                trace.addInfo("Process Terminated: Error in writing out payload");;
    and detailed trace of error is:
    11:34:21 Start of test
    LinkageError at JavaMapping.load(): Could not load class: zip/PayloadToXMLField
    java.lang.NoClassDefFoundError: zip/PayloadToXMLField (wrong name: PayloadToXMLField) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.lang.ClassLoader.defineClass(ClassLoader.java:448) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.load(RepJavaMapping.java:136) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:50) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.transform(MapServiceRemoteObjectImpl0_0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    11:34:21 End of test

  • Java Program in MDM to call a standard java class

    Hi All,
    In MDM- GDS, (Global Data Synchronization), we have a scenario where, once we register the Items , it will be transported to a Data Pool called 1SYNC through SAP PI.
    There is a standard Java PRoxy(Kind of java Class) in MDM, which will be triggered once we register the Item in MDM-GDS.
    That Java Proxy will send the Item INfo as a XML message to PI.
    So we would like to know whether its possible to automate this process.
    Like,Writing a new Java Program which will check all the new items and trigger the Java Proxy and send these items as XML Messages to PI.
    I m new to MDM. So it would be really helpful, If i could get some inputs on this. Like, is it possible in MDM. If so, how?

    Aarthi,
    you can acheive this from MDM itself, and need not to write any Java proxy.
    you may consider following logic.
    Create a field with the Name Status and Initilize it with Value "new". Now define syndicaiton Map to syndicate records which holds value "new" in the status field.  define a workflow with syndication step, using maps defined earlier. After syndication step, execute an assignment to change Status field value from "New" to "Syndicated".
    Revert back if any question.
    ~ Shiv

  • Batch file from java class fails to copy from mapped drive

    I've some problem for a bacth file which XCOPY several files from folder to folder. If the source folder is a mapped network drive and I run the batch it works.
    But it fails with this error "Invalid drive specification" if I run it from within the java class. Everything is correct from the BATCH point of view as it works when I run it directly.
    I use Process p = Runtime.getRuntime().exec(command);where command is: "cmd /c C:\\just_for_test.bat".
    The batch file is:
    XCOPY /E G:\tmp\CD0005_Multi\*.* C:\Temp
    RD /S /Q G:\tmp\CD0005_Multi
    EXIT
    where G: is the mapped drive.
    Any ideas?
    Thanks.

    I used a batch-file to copy the specified files that looked like this in the end:
    net use s: \\192.168.200.7\e$ <passw> /USER:administrator
    s:
    COPY "S:\Temp\xxx.txt" "C:\Temp\xxx.txt"
    c:
    net use s: /deleteWhat happens is that i make a new mapped-connection to the harddrive
    and ending it after the copying-process is finished... Simple thingie.
    But, if you still want to copy the files through your program, do this:
    net use s: \\192.168.200.7\e$ <passw> /USER:administrator
    s:
    java myProgram
    c:
    net use s: /delete

  • XSLT Mapping with Java class not working in Integration Repository

    Hi,
    I have an XSLT mapping program with Java enhancement and I was able to successfully tested it in Stylus Studio. However, when I imported the Java class and the xslt program in Enterprise Service Builder and tested it, my program does not compile.
    Here is the error message: "Transformer Configuration Exception occurred when loading XSLT mapping_temp.xsl; details: Could not compile stylesheet".
    My java program is in a zip file containing SOAPHeaderHandler.java and SOAPHeaderhandler.class. My Java has a package com.nga.xslt.
    Here is the declaration of my Java class in the XSLT: xmlns:javamap="java:com.nga.xslt.SOAPHeaderHandler"
    It seems that it could not read the java class. Can you please advice what is wrong?

    Hi ,
    select XMLTOOLKIT option in Operation mapping and execute it.
    I am not sure we can call java program in XSLT Program,but alternative is copy the code and use it in XSLT mapping it self,that means your XSLT program will become with JAVA extensions.
    then in Operation mapping level select SAPXMLTOOL kit option and execute it. i hope it will work. if it is not working then you have deploy some JAXP files on server,because the way execution of XSLT Mpaping program got changed,like when eve you executing XSLT with extnasions( if you are not using XMLTOOL kit option) then you have to use latest version of JAXP.JDK files.
    Regards,
    Raj

  • How can I call a java class from within my program?

    I was wondering if there's a platform independent way to call a java class from my program.

    Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.

Maybe you are looking for