cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro Field Elements Disabled

Former Member
0 Kudos

Hello:

The text fields of my Web Dynpro App are disabled when I run the app. Im trying to change the Collection Cardinality in the context to 1...1 but I cant, it seems to be disable too.

Can anyone help me? How can I change the cardinality?

Best Regards

Thanks

Mario G

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

You need to add the following code in your WdDoInit()

//create a new model instance

model = new <name_of_your_model>();

//create model objects

<name_of_your_request_model_class> requestMO = new <name_of_your_request_model_class>(model);

<name_of_your_send_model_class> sendMO = new <name_of_your_send_model_class>(model);

//associate model objects

requestMO.set< name_of_your_send_model_class>(sendMO);

//bind exacutable model object to context node

wdContext.node<name_of_your_context_node_for_ws>().bind(requestMO);

Regards,

Edzon

Former Member
0 Kudos

Hi Mario,

If you are not able to change the cardinality of the node then you can create an element of that node in wdDoInit() method.

IPrivate<viewname>.I<nodename>Element ele = wdContext.node<nodename>().create<nodename>Element();

wdContext.node<nodename>().addElement(ele);

Warm Regards,

Murtuza

Former Member
0 Kudos

Thanks for the support,

The idea is that the final users dont look and change the source code, you know if it can be changed with the Developer Studio UI?

I see the property but I cant change it, It is disabled!!

Thanks

Mario G

Former Member
0 Kudos

Hi Mario,

Are you mapping your model context to controller and then the controller context to view. If yes then try changing the cardinality in the component controller and then it would be reflected everywhere.

Warm Regards,

Murtuza

Former Member
0 Kudos

Thanks Murtuza:

Im able to change the selection cardinality, but the collection cardinality still in 0 .. 1. I change the selection to 1...1 and to 1... n and the problem continue!!!

Thanks

Regards

Mario G

Former Member
0 Kudos

Hi Mario,

Can you describe you context structure over here

eg.

parent node<cardinality you have set>

child node<cardinality you have set>

attribute<binded to input field>

Warm Regards,

Murtuza

Former Member
0 Kudos

Hello Murtuza:

Controller Structure:

Request_CreateProduct<Collection=1...1, Selection=1...1>

CreateProduct<Collection=0...1 (read-only), Selection=1...1>

Code

Name

How can I enable the Collection cardinality of the child, I think If we could enable this our problem is solved!!!

Kind Regards

Thanks!!

Mario G

Former Member
0 Kudos

Hello Murtuza:

Im using SAP Netweaver CE 7.1.

Thanks

Mario G

Former Member
0 Kudos

Hi Mario,

Yes, now the only solution is to enter the values programatically.

you can create a node called table with attributes code and name and set the values from that table to your createProduct node.

try

{

Request_CreateProduct input = new Request_CreateProduct();

for(int i=0; i<nodeTable().size();i++)

{

CreateProduct ele = new CreateProduct();

ele.setCode(wdContext.nodeTable().getTableElementAt(i).getCode());

ele.setName(wdContext.nodeTable().getTableElementAt(i).getValue());

input.addElement(ele);

}

wdContext.nodeRequest_CreateProduct().bind(input);

wdContext.nodeRequest_CreateProduct().currentRequest_CreateProductElement().modelObject().execute();

}

catch(Exception e)

{

//handle exception

}

Warm Regards,

Murtuza

Former Member
0 Kudos

Hello Murtuza:

Thanks, I try to write the line:

Request_CreateProduct input = new Request_CreateProduct();

But I dont have the constructor, It ask me for a model (its mandatory)

Request_CreateProduct input = new Request_CreateProduct(ProductModel m);

That takes the cardinality of the model that is in 0...1 for default.

I dont know if the CE 7.1 in Wed Dynpro is more limited. I remember that in a previous version I could do that!!

Thanks

Regards

Mario G

Former Member
0 Kudos

Hi Mario,

Try this and move ahead with the rest of the code.

<b>Request_CreateProduct input = new Request_CreateProduct(new ProductModel());</b>

Warm Regards,

Murtuza

Former Member
0 Kudos

Hi

if you are using a node in your context

do the following in your WdDoint()

I<YourNode>Element node=wdContext.create<YourNodeElement>

node.setYourElement(); // set all your values

node.setYourElement();

//finally add the element to your node

wdContext.node<YourNode>.addElement(node);

Regards

Abhijith YS

Former Member
0 Kudos

To zoom in the problem I cant change the collection cardinality of the subnodes in the context. It stay 0..1, Thats why all the text Fields are disable. I need to put it in 1...n or 1 ... 1.

Any clue?

Thanks

Mario G

Former Member
0 Kudos

Hi Mario

Depending upon your requirement you need to change your Cardinality

if you have only one element in your node then make it as 1..1

if you have more than one element then make it as 1..n

1..n represents (min..max)

For your clear understanding follow this <a href="https://forums.sdn.sap.com/click.jspa?searchID=-1&messageID=4139915">Thread</a>

Regards

Chaitanya.A