cancel
Showing results for 
Search instead for 
Did you mean: 

Problem creating Custom Action block in MII 12.1

Former Member
0 Kudos

Hello All,

I downloaded the MII SDK from the MII server (v 12.1.4)

when trying to create a simple custom action I get an error message from eclipse when I try to set the result:

Unhandled exception type DataConversionException

The code is copy pasted from the pdf on 12.1 custom action development on sdn

package test;
import com.sap.lhcommon.common.*;
import com.sap.xmii.bls.sdk.*;

public class SimpleAction {

private static final String PARAM_OUTPUT = "Output";
@Action(name = "AddTwoNumbers") 
@Outputs(names = { PARAM_OUTPUT },types = { VariantDataTypes.INTEGER }) 

public static void addTwoNumbers(
IActionInstance instance, 
@Input(name = "Input1") int in1, 
@Input(name = "Input2") int in2)
	throws InvalidVariableException{
		instance.setActionResult(PARAM_OUTPUT, in1 + in2);
	}
}

The imports are correctly loaded in eclipse

If I add the neccesary import (import com.sap.lhcommon.exceptions.DataConversionException;) and add the DataConversionException to the throw statement I can compile the jar (and after adding the catalog.xml) upload the action block in MII without error.

when I create a transawtion however I get a fatal error. also no inputs or outputs (besides the standard 3) are to be seen int he link editor.

The catalog.XML is:

<?xml version="1.0" encoding="utf-8"?>
<ComponentCatalog>
  <Category Name="Custom" Description="Custom">
    <Component Type="Action" Name="SimpleAction"
    Description="" Label="SimpleAction"
    ClassName="test.SimpleAction"
    AssemblyName="SimpleAction.jar" Dependencies=""
    HelpFileName="" />
  </Category>
</ComponentCatalog>

Any clue on where the problem may be? Is it the code? something else like MII buffering the old failed custom action blocks?

Thanks,

Willem

Edited by: Willem van Lammeren on Jan 28, 2011 1:40 PM

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

William,

There's probably a couple of things going on here...

1) The method declaration should look like this with just a generic Exception

public static void addTwoNumbers(
IActionInstance instance, 
@Input(name = "Input1") int in1, 
@Input(name = "Input2") int in2)
	throws Exception

2) The action name in the class definition of AddTwoNumbers defined in this line of code:

@Action(name = "AddTwoNumbers")

Needs to match the catalog.xml category entry for the action, where Name="SimpleAction" should be Name="AddTwoNumbers":

<Category Name="Custom" Description="Custom">
    <Component Type="Action" Name="SimpleAction"
    Description="" Label="SimpleAction"
    ClassName="test.SimpleAction"
    AssemblyName="SimpleAction.jar" Dependencies=""
    HelpFileName="" />
  </Category>

For additional information as to why the action doesn't load you can set the Java WebStart environment to open up the Java Console; instructions can be found here:

[http://hale.homeip.net/javabook/jaws/javawebstartconsole.htm|http://hale.homeip.net/javabook/jaws/javawebstartconsole.htm]

Hope this helps,

Sam

Answers (2)

Answers (2)

Former Member
0 Kudos

finally found the time to change the action and it worked as a charm!

Former Member
0 Kudos

Thanks, I will try it out!