cancel
Showing results for 
Search instead for 
Did you mean: 

how to insert data in a child node

Former Member
0 Kudos

Hi all,

I have a parent node P and a child node C now for a particular attribute of parent node I check the value and populate C node attribute accordingly ie say P has an attribute A so P.A = 1 now if it is equal to 1 then in child no C Ineed to populate its 2 attribute ie value and code as C.value=xyz and C.value= 1. This population I am doing after executing the rfc taking values from its output node and checking condition and populating but I am getting null pointer exception.

The code I am using is follows:

if(rfcouputnode.attribute.equalignorecase("1")

{

ICElement ele = wdcontext.nodeC.createCElement;

ele.setCode("1");

ele.setValue("xyz");

wdContext. nodeP.nodeC.addelement(ele)

}

The parent node cardinality is 0..n

selection 0..n

singleton true

Child node cardinality is 0..n

selection 0..1

singleton false

Kindly let me know wut could i possibly be doin wrong.

Thank you

Regards,

Preet

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

You nead to create the element of the Child Node, add this new element to Child Node and them, bind the Child Node to the Parent Node.

Best regards,

Ana.

Former Member
0 Kudos

Hi Preet,

Have you created any element of node P before creating elements of C. Only then you would be able to set values to attributes or even create an element of C.

One more doubt. You must be executing the BAPI and comparing the values returned in the output structure with the desired value. I would suggest you to check if you are correctly pulling up values from output structure. You can print and check.

Regards,

Tushar S