cancel
Showing results for 
Search instead for 
Did you mean: 

copying from model node to the value data

Former Member
0 Kudos

hi

i have a Value Node IT_Car_Details and Model Node

IT_Car_Data

now i have to copy the data model node to the value

node (and populate the value node data inthe table) and i have written a statement as

wdcopyservice.copysubtree(wdcontext.nodeit_car_data,

wdcontext.nodeit_car_details)

iam getting this error

com.sap.tc.webdynpro.progmodel.context.ContextException: Node(SampleView.Zlgf001_Outfit_Match_Input.Output.It_Car_Details): cannot bind or add elements because the node has no valid parent

than i had written the following statements

// for(int i=0; i<wdContext.nodeIt_Car_Data().size(); i++)

// {

//

// WDCopyService.copyCorresponding(wdContext.nodeIt_Car_Data().getIt_Car_DataElementAt(i), wdContext.nodeIt_Car_Details().getIt_Car_DetailsElementAt(i));

// }

where i am not facing any exception or error but

model node data is not getting copied in to value node

after the wdcopyservice has been written

should be need to execute rfc or just the copy service

will make the data populate in the table as soon i click the

button .

any suggestions ?

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member214651
Active Contributor
0 Kudos

Hi Kishore,

try doing a structure binding on the value node which u have created and select the attributes from the model node which u want to copy,

after that right click on the value node and delete the structure binding.

then try using the copycorresponding statement

Hope this helps u

Regards,

Poojith MV

Former Member
0 Kudos

Hi ,

I have faced the same problem . I got the same error.

Kindly go thru this

As far as my understanding this error will come when there is no single element in traget node.

So please before copying the node create one dummy element for target node, then u can easily copy the node. Let me know if you face any problem. I did the same thing and my problem solved.

Pl award the points if it solves ur problem.

Thanks & Regards

Manoj Sahoo

snehal_kendre
Active Contributor
0 Kudos

Hi Kishor,

you code is correct..make sure your model node contains data?

as you said

should be need to execute rfc or just the copy service .

i think you must execute RFC and check wheather model node contains data or not

Former Member
0 Kudos

Hi,

while making use of copy service,you need to make sure of following things:

1. Structure of model node and value nodeis exactly same.

2. Attribute name in model node and value node is same.

3. CopySercvice is used as:

wdCopyService.copyElements(model node,data node);

4. Copy service is used only after executing the RFC.

5. Moreover copy service has one morelimitation.It can copy elements from model node to value node.Reverse is not possible.

regards,

amit bagati

Former Member
0 Kudos

Hi Kishore,

You are using the wrong order of source and target while using copyCorresponding(source,target)..

Give the model node in source and value node as target...

Regards,

Sayan Ghosh