cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a dynamic Context-Element

Former Member
0 Kudos

Hello,

I want to create an dynamic Context Element.

The Context-Node Selection existed already.

I has implement the following Code:

IWDNode SelectionNode = wdContext.getChildNode("Selection",0);

IWDNodeInfo SelectionNodeInfo = SelectionNode.getNodeInfo();

SelectionNodeInfo.addAttribute("Test2","ddic:com.sap.dictionary.string");

SelectionNode.getCurrentElement().setAttributeValue("Test2","Hello");

My Problem is, that I become the following failure:

500 Internal Server Error

Web Dynpro Container/SAP J2EE Engine/6.40

Failed to process request. Please contact your system administrator.

The Error must come from the last implement ine,

because without it I didn't become the failure.

Can anybody help me?

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I did some tests and the reason for the problem

must be the last line:

SelectionNode.getCurrentElement().setAttributeValue("Test2","Hello");

Because there comes no Error without it.

Former Member
0 Kudos

Hi,

As far as i think "Selection" is a value node that u might have created dynamically or staticaly. Now with out creating an element of that node u cannot set the value of its attributes.

First create elements of that node:

IWDNodeElement ele = wdContext.getChildNode("Selection",IWDNode.LEAD_SELECTION).createElement();

wdContext.getChildNode(Selection",IWDNode.LEAD_SELECTION).addElement(ele); // add that element.

ele.setAttributeValue("Test2","ABC");

To get a specific element:

wdContext.getChildNode("Selection",IWDNode.LEAD_SELECTION).getElementAt(index); // where 'index' is int field.

Regards,

Piyush.

Former Member
0 Kudos
Former Member
0 Kudos

Dear Patrick,

See if this works:

IWDNode SelectionNode = wdContext.getChildNode("Selection",0);

SelectionNode.getNodeInfo().addAttribute("Test2","ddic:com.sap.dictionary.string");

SelectionNode.getCurrentElement().setAttributeValue("Test2","Hello");

Let me know if its working.

Pavan.

Former Member
0 Kudos

Hi,

Try this:

IWDAttributeInfo attrInfo = wdContext.getChildNode("Selection",0).getNodeInfo().addAttribute("Test2","com.sap.dictionary.string");

Regards,

Piyush.

pravesh_verma
Active Contributor
0 Kudos

Hi Patrik,

As far as I know, this is not the error because of the last lines you have added. That error is because of the J2EE server problem. Please try and restart the server and the try and deploy the application.

You can try and remove these last added lines. If there will be the server problem then this error will again come.:-

<i>500 Internal Server Error

Web Dynpro Container/SAP J2EE Engine/6.40</i>

I hope this helps you.

Regards

Pravesh

Former Member
0 Kudos

Please post the complete stack trace.

Regards, Anilkumar