cancel
Showing results for 
Search instead for 
Did you mean: 

Null pointer in dynamic context assigment to Dynamic UI

Former Member
0 Kudos

Hi all,

i am creating a context dynamically for celldesign and date :

nodeInfo.addAttribute("Color"+contextNum,"com.sap.ide.webdynpro.uielementdefinitions.TableCellDesign");

nodeInfo.addAttribute("Date"+contextNum,"com.sap.dictionary.date");

but when i access the access the same in WdDoModify as AttributeInfo it throws Null Pointer . but i access this context before actually assigning to UI. i dont get null there

IWDAttributeInfo colorAttrInfo = wdThis.wdGetAPI().getContext().getRootNode().getChildNode("Node"siteNum, IWDNode.LEAD_SELECTION).getNodeInfo().getAttribute("Color"contextNum);

Same is with date...

can anyone please tell why this can happen.

Thanks and Regards,

Aditya

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks everyone... problem was not resolved... started with different approach

thanks and regards,

Aditya

Former Member
0 Kudos

Thanks Aishwarya for the reply.

I have gone through the link.

my problem is :

i create the above shown attributes in one method

then i set those attributes in another method

and i access those and display for my confirmation.

then i assign the same values to UI in wdDoModify

only in wdDoModify it throws Null Pointer.

i know null pointer means the attributes do not exist but i am accessing the context before assigning them to UI.

and i am not resettig the context anywhere.

how is it possible that a method earlier i am accessing the attribute and immediately in wdDoModify it throws null.

Thanks and Regards,

Aditya Deshpande

Former Member
0 Kudos

Hi,

Try to call your method that create context nodes in the wdDoint

Other wise have a condition in wdDomodity before invoking this context attributes

if(created)

// call the attribute

Regards

Ayyapparaj

Former Member
0 Kudos

Hi Ayyapparaj,

i have controlled the execution of DoModify by using a context attribute of type boolean, i make sure that it is true after i create the contexts.

along with those 2 context mentioned above i also create 2 more context which do not throw null pointer, (when code comment for COLOR and DATE in do Modify method)

but only for COLOR and DATE it throws null pointer.

Thanks and Regards,

Aditya

Former Member
0 Kudos

Hi,

once check the attribute you using COLOR or Color in both ?

Regards,

ramesh

Former Member
0 Kudos

Hi Aditya,

You can refer to the following link for the dynamic UI context generation:

http://saptechnical.com/Tutorials/WebDynproJava/Runtime/Manipulation.htm

I hope this will help you.