cancel
Showing results for 
Search instead for 
Did you mean: 

Message Handling for RFC Inputs

Former Member
0 Kudos
60

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Regarding Exception at wdDoInit():

If "Number" is mapped, You can't use any methods of <i>ISimpleTypeModifiable</i> from the View.

Former Member
0 Kudos

Thanks Kranthi,

I thought as much.

Do you have any suggestions on how to make it work with mapped data from Bapi calls?

Thanks

Former Member
0 Kudos

Instead of referencing the attribute from View Context, Access from the Component context.

Suppose that "Number" of View context is mapped to "CompNumber" of Component Controller.

Instead of

wdContext.getNodeInfo().getAttribute("Number")

use:

wdThis.wdGet<ComponentName>Controller()
.wdGetContext().getNodeInfo().getAttribute("CompNumber")

Answers (0)