Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Custom Action - SDK -error

Based on the "Developing Custom Action in in SAP MII 12.1" i encountered error while running the action block in BLS. In Link Editor I assign 2 values in Inputs and Output to a tracer. When I execute this BLS, I receive following error

[ERROR] [Tracer_0] Link ('Tracer_0.Message' [Assign] from "SimpleAction_0.Output") execution threw an exception. Exception: Invalid variable: SimpleAction_0.Output [Unknown variable: SimpleAction_0.Output

[ERROR] [Tracer_0] Action: Runtime threw an exception. Exception: [Invalid variable: SimpleAction_0.Output Unknown variable: SimpleAction_0.Output

The code is exactly like in the document

package customactions;
import*; // Needed for the VariantDataTypes and
// VariantData types.
import*; // This is the main SDK for custom actions.
* This is a simple action construct used to show how to use some of the basic
* MII 12.1 Custom Action constructs.
public class SimpleActions {
* To ensure the parameters are always named the same, it is good practice to
* create a static final string with the parameters name. This also make it
* easy to use across actions.
private static final String PARAM_OUTPUT = "Output";
* Describes a simple action that adds two numbers together.
* @param instance This is the action instance. This is the main interface
* from the action code back into the transaction engine. Most
* users will only need to set their variables through this
* interface, though much more powerful operations are also
* available.
* @param in1 This is an input into the action. The type is detected by the
* transaction engine and automatically cast to the correct value.
* @param in2 This is a second input.
* @throws InvalidVariableException This exception is
@Action(name = "AddTwoNumbers") // This annotation tells the engine that this
// is an action available to execute.
@Outputs(names = { PARAM_OUTPUT },
types = { VariantDataTypes.INTEGER }) // This annotation tells
// the engine that one
// integer output called
// 'Output' is going to be
// returned.
public static void addTwoNumbers(
IActionInstance instance, // Besides the basic types, the
// IActionInstance interface is the only
// other type allowed to be defined in
// parameter list of a custom action.
@Input(name = "Input1") int in1, // @Input annotations are used to
// indicate the user modifiable
// inputs to this action.
@Input(name = "Input2") int in2)
throws InvalidVariableException { // Exceptions can be thrown directly from
// the actions without causing critical
// execution failures. These exceptions
// will be caught and logged by the engine
// and will cause the Success flag to be
// set to false.
// The following code describes how to set an actions output.
try {
	instance.setActionResult(PARAM_OUTPUT, in1 + in2);
} catch (DataConversionException e) {
	// TODO Auto-generated catch block

the catalog is

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

Is there anything I might have done wrong?


you have to change compiler settings to version 1.5

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question