cancel
Showing results for 
Search instead for 
Did you mean: 

Interface Controller context model attribute error

Former Member
0 Kudos

I am trying to create a controller interface as such: I created a DC that goes out and retrieves SAP ID using a RFC call. My controller context is bound to a RFC model. I'd like to expose the SAP ID that comes back from that call within a model attribute to other components. I try to create a model node and corresponding model attribute within the Interface Controller, setting the isInputElement = true. However, as soon as I do this I get a number of compile errors:

"The context model node has not been bound to a model class", "The context model attribute has not been bound to a model property".

Are you not allowed to map model nodes to an interface?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Karla,

I think you need to expose your model class as a Public Part to other dc's. Then you should not get these errors.

Regards,

Shubham

Former Member
0 Kudos

I don't really want to expose the entire model - just an interface into the information that I have retrieved. If I expose the model as the public part, then whatever DC that uses it will have to contain the logic to retrieve what I want. I was hoping to contain that logic within a DC and use it in multiple places, which is why I am trying to expose it via an interface.

In the meantime, I found a work-around. I made a public method in my interface to retrieve the information I need.

Former Member
0 Kudos

Karla,

First, set isInputElement to false. Think again, you are exposint "result" outside but not collecting "input" from outer component.

Next, calculated attributes to the rescue here.

Say, in component controller you have 1..1 / 0..1 model node <i>SapIdQuery_Input</i> with 1..1/0..1 child <i>SapIdQuery_Output</i> that holds <i>System_Id</i> attribute, type <i>string</i>.

Now create in component controller context (right below root node) attribute <i>System_Id</i> of type <i>string</i>, set read-only to true and calculated to true. Switch to source editor and write the following for generated attribute "getter":


if (wdContext.currentSapIdQuery_InputElement() != null &&
    wdContext.currentSapIdQuery_OutputElement() != null)
  return (String)wdContext
    .currentSapIdQuery_OutputElement()
      .getAttributeValue("System_Id");
else
  return null;

Now add controller usage (of component controller) in interface controller and map attribute in interface controller to calculated attribute in component controller.

If you expirienced problems with mapping, try to create calculated attribute in 1..1 subnode of root context node.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Answers (0)