cancel
Showing results for 
Search instead for 
Did you mean: 

cardinality

Former Member
0 Kudos

Dear All

I was adviced to do the follwing:

cardinality of the node with which your input field is bound. It should be 1..n or 1..1

I have changed the cardinality and now I get this message

com.sap.tc.webdynpro.progmodel.context.ContextException: Node(IncidentRFCModelCust.__Tdag__I_Rf02_Ial_Query_Input): cannot fill a ModelNode automatically. Change the cardinality or use a supply function

Regards

sas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Erdem,

If you need to add element values to a Modal node please follow the following SDN link:

Please check the following link also:

Edited by: Aishwarya Sharma on Oct 10, 2008 11:45 AM

Answers (25)

Answers (25)

Former Member
Former Member
0 Kudos

Hi erdem,

Not twice but only once in View Controller. So, that when the view gets instantiated the input fields are also bound to the node.

Also as you said that you fields are coming from RFC and from your previous thread I could guess that you want to take input from the user for data retreival, for that try keeping the cardinality to 0..1

Former Member
0 Kudos

Sharma this code is existing two times in my application.

wdDoInit() CustomController

wdDoInit() View

Do I really need it twice. ?

Regards

sas

Former Member
0 Kudos

Hi erdem,

The code that I provided:

Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();

input.setDestination_From(new Bapisfldst());

input.setDestination_To( new Bapisfldst());

wdContext.nodeBapi_Flight_Getlist_Input().bind(input);

is to be written in wdDoInIt() of your view controller

Former Member
0 Kudos

Hello!

Thank you very much but we have already more than 20 Postings

and the problem is still existing.

The mentioned coding have been already in my custom controllers

coding. This is nothing newly?

Please read my question more carefully

Edited by: erdem sas on Oct 10, 2008 2:54 PM

Former Member
0 Kudos

HI,

or else just try once to do this

1) create a context attribute of Binary type

2) bind the enable property of inputfield UI element to that attribute of Binary type and

3) In WDdoInit() enable the input field UI element by setting the binarycontext attribute true..

wdContext.currentContextElement.set<<attr>>(true);

Regards

Raghu

Former Member
0 Kudos

Hello!

Has this coding to be inserted into Custom Controller's wdDoInit()

or View Controller's wdDoInit() Method.

Or even into both ??????

Bye

erdem

Former Member
0 Kudos

Hi

put it in controller's Doinit() methode

Regards

Khushboo

Former Member
0 Kudos

Hi Erdem,

In a similar application like yours I had a flight list query; in it other then the normal input fields I had to take some other values also as inputs, which were coming disabled after building and deploying the application. I rectified the error by setting the cardinality of input field node as 0..1 and selection node as 1..1 in component controller which changes the cardinality of the mapped node in views also.

My nodes were Destination_From and Destination_To

In wdDoInIt of the view controller where these input elemetns have to be binded to the input UI element I provided the following code:

Bapi_Flight_Getlist_Input--- is the model class

nodeBapi_Flight_Getlist_Input -- is the node coming from RFC mapped with component and view controller

Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();

input.setDestination_From(new Bapisfldst());

input.setDestination_To( new Bapisfldst());

wdContext.nodeBapi_Flight_Getlist_Input().bind(input);

Edited by: Aishwarya Sharma on Oct 10, 2008 4:08 PM

Former Member
0 Kudos

Sharma

You are saying

In wdDoInIt() of your custom controller you first need to set the values and then bind it to the node.

How can I do that. Maybe this is the problem ?

Reagrds

sas

Former Member
0 Kudos

Hi

i think problem shud be wid ur DOInit method

chk it again


/** Hok meothod called to initialize controller. */ public void wdDoInit()
{
//@@begin wdDoInit()
// Create a new element in the Bapi_Flight_Getlist_Input node
Bapi_Flight_Getlist_Input input = new Bapi_Flight_Getlist_Input();
wdContext.nodeBapi_Flight_Getlist_Input().bind(input);
// Create new elements in the Destination_From and Destination_To nodes
 
input.setDestination_From(new Bapisfldst());
input.setDestination_To(new Bapisfldst());
//@@end
}
 

it shud hlp u

Regards

Khushboo

Former Member
0 Kudos

For changing of the cardinality, I klick on the Custom Controller' Context (on the root Node)

choose Properties and change it.

This change takes automatically effect also in the Views Context Node.

Sharma

The model Node

__Tdag__I_Rf02_Ial_Query_Input

has also an Output Node. I have forget to mention.

Output -> Node
 Element	E_Header_Tab
 Element   E_Invpersons_Tab
 Element   E_Return_Tab

Are both your nodes I_Iepva_Selcrit and I_Incident_Selcrit input field element?

Yes. I_Iepva_Selcrit has only one attribute which is binded with my problem input field

You are saying
In wdDoInIt() of your custom controller you first need to set the values and then bind it to the node.

Which values. How can I set them. Aren' they set.

Regards

erdem

Former Member
0 Kudos

Hi,

Is your attribute under Rootnode, then ok or else change the cardinality of that node possessing the your input attribute not the root node.

Regards

Raghu

Former Member
0 Kudos

Hi Erdem,

Your Method Ial_Query_Input( ) executes the bapi...

Where does these bapi value gets stored in which node? Is it node Output?

In wdDoInIt() of your custom controller you first need to set the values and then bind it to the node.

Are both your nodes I_Iepva_Selcrit and I_Incident_Selcrit input field element?

Edited by: Aishwarya Sharma on Oct 10, 2008 1:09 PM

Edited by: Aishwarya Sharma on Oct 10, 2008 1:31 PM

Former Member
0 Kudos

Sharma the input field is binded with ialprepid . See bolow

Here some additional information

CONTEXT CUSTOMCONTROLLER
Cardinality 0 n

Root ModelName in the customController Context
__I_Rf02_Ial_Query_Input
Element 1
	I_Iepva_Selcrit
	- with one Attribute named ialprepid in the Element 1
Element 2
I_Incident_Selcrit
  -many Attributes in this element

Additional there are two flags 
Flag1
Flag2

CONTEXT VIEW

Cardinality 0 n

Root ModelName in the customController Context
__I_Rf02_Ial_Query_Input
Element 1
	I_Iepva_Selcrit
	- with one Attribute named ialprepid in the Element 1
Element 2
I_Incident_Selcrit
  -many Attributes

//CustomController

public void wdDoInit()
 {
   wdContext.node__I_Rf02_Ial_Query_Input().bind(new __I_Rf02_Ial_Query_Input());

	__I_Rf02_Ial_Query_Input input = new __I_Rf02_Ial_Query_Input();
	wdContext.node__Tdag__I_Rf02_Ial_Query_Input().bind(input);

	input.setI_Incident_Selcrit(new __Tdag__Is_Rfc_Iasel());
	
  input.setI_Iepva_Selcrit(new Cciht_Ipeva());
			
 input.setI_Flg_Filterinvolved(true);	

 input.setI_Flg_Orghierarchy(true);
 }

View search Button

public void onActionSearchIncidents(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
     // call function module /I_RF02_IAL_QUERY 
		wdThis.wdGetIncidentRFCModelCustController().Ial_Query_Input();
  }

Method Ial_Query_Input is inside Custom Controller

public void Ial_Query_Input( )
  {
    //@@begin Ial_Query_Input()
    //$$begin Service Controller(609296820)
    IWDMessageManager manager = wdComponentAPI.getMessageManager();
    try
    {
      wdContext.current__I_Rf02_Ial_Query_InputElement().modelObject().execute();
      wdContext.nodeOutput().invalidate();
    }
    catch(WDDynamicRFCExecuteException e)
    {
      manager.reportException(e.getMessage(), false);
    }
    //$$end
    //@@end
  }

Former Member
0 Kudos

Hi sas,

In the above code or context to which context you are changing the cardinality, is it in view/custom if so which node.

Regards

Raghu

Former Member
0 Kudos

hi!

you must not add elements to a Node of cardinality 0..1 or 1..1.

thanks

vishal

former_member192434
Active Contributor
0 Kudos

Your context Node

Former Member
0 Kudos

Hi erdem,

If your input field is mandatory to fetch data from RFC keep the cardinality of you context node to 1..1 and Selection Property also to 1..1.

Edited by: Aishwarya Sharma on Oct 10, 2008 12:29 PM

Former Member
0 Kudos

Sharna

which cardinality is needed for your approach. ?

Currently I have 1.1.

Former Member
0 Kudos

Hi,

Insert the code in wdDoInit() of view controller.

Former Member
0 Kudos

hi!

also make sure that the node you binded has some elements.

Former Member
0 Kudos

Sharma yes it is coming from RFC.

Where must the code be inserted. In which method of

my view Controller ?

Former Member
0 Kudos

Hi,

try the following code in your view controller:

yourInputModelClass input = new yourInputModelClass();

input.set<Model Attribute Mapped to Input Field>(new Bapi<type());

wdContext.nodeModelNode().bind(input);

Is your Model node coming from an RFC?

former_member192434
Active Contributor
0 Kudos

Hi

Assuming you model node is something like this

request model node

input parameter for the input field

Now, create a value attribute in your Custom Controller named input

map this to the view by providing a link between your view and controller

Bind this input attribute to your input field.

Now, when you are executing your RFC just before that set this input parmeter

<model name> model = new <model name>();

<request model node> request = new <request model node>(model);

wdContext.node<request model node>().bind(request);

request.set<attribute>(wdContext.currentContextElement().getInput());

Now execute your RFC.

Thanks

Anup

Edited by: Anup Bharti on Oct 10, 2008 12:12 PM

Former Member
0 Kudos

Hi

singleton is true and this line has been also inserted

wdContext.node__I_Rf02_Ial_Query_Input().bind(new __I_Rf02_Ial_Query_Input());

Nevertheless it is not working, the input field is still disabled.

Bye

erdem

Former Member
0 Kudos

hi!

mapping of modal node with non modal node is not possible.if you r not doing this then please check that enabled property is true or not.

thanks

vishal

Former Member
0 Kudos

hi!

please ensure your singleton property is true.

thanks

vishal

Former Member
0 Kudos

Hi Erdem,

You have to write the following line of code in the wdDoInIt() of the component controller

wdContext.node<yourInputNode>().bind(new <yourInputModelClass>());

I hope this may be helpful to you.

former_member192434
Active Contributor
0 Kudos

Hi Sas,

Try to change cardinality 1:1 only and save and restart your application, if the problem still exits then try to use supply function.

Thanks

Anup