Skip to Content
0
Former Member
Nov 29, 2005 at 06:24 PM

Message Handling for RFC Inputs

20 Views

Hi,

I am trying to invoke my message handling functions for validation checks against inputs that are going to be passed to RFC. In the 'Defining message' tutorial a Value Attribute is created in the 'Context' and a Simple DataType. In my model I have a Model Node which has context mapping. What do I have to replace in the code:

public void checkMandatory(java.lang.String fieldName) {

  IWDMessageManager messageMgr = 
    this.wdComponentAPI.getMessageManager();
  Object attributeValue = 
    this.wdContext.currentContextElement().getAttributeValue(fieldName);
  IWDAttributeInfo attributeInfo = 
    this.wdContext.getNodeInfo().getAttribute(fieldName);
  if (attributeValue instanceof String) {
    if (((String) attributeValue).length() == 0) {
      String fieldLabel =
          this.wdContext.getNodeInfo().getAttribute(fieldName)
              .getSimpleType().getFieldLabel();
      messageMgr.reportContextAttributeMessage(
        this.wdContext.currentContextElement(),
        attributeInfo,
        IMessageSimpleErrors.MISSING_INPUT,
        new Object[] { fieldLabel },
        true);
    }
  }
}

to make it work with my model? As the above throws the following exception for me:

<b>ContextException: NodeElement(SearchNCRView.0): unknown attribute Number</b>

where Number is the name of the context mapped element under Model Node.

Also the following code also throws an exception for me:

public void wdDoInit()
{
   wdContext.getNodeInfo().getAttribute("Number")
       .getModifiableSimpleType().setFieldLabel("NCR Number");
}

Can anyone please help?

KG