cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Nodes again

Former Member
0 Kudos

Hi,

I have the following situation:

RFC PT_ARQ_REQUEST_PREPARE as output parameter EX_REQUEST

RFC PT_ARQ_REQUEST_CHECK as input parameter IM_REQUEST

(both same structure, same fields, same types)

and I want to make IM_REQUEST = EX_REQUEST to call my RFC.

Example:

Node A - Node A1

- Node A2

- Node A3

Node B - Node B1

- Node B2

- Node B3

Well, as you can see, in this example I have two nodes that are structuraly equal. (In the exemple I have only posted 3 sub-nodes but there are 6 of them.)

Each of these nodes and sub-nodes have almost 30 elements each, but they have the same name in the node A and B, and correspond to the same type of elements.

I'm trying to copy the values of the node B into the node A without setting all the elements individually, or making a for cycle. Is that possible?

Any help will be appreciated!!

Best Regards.

Ricardo Nascimento.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Recheck if the attribute name and type match in both the nodes. Try using copyCorresponding() or copySubtree() methods and see if it works.

If the copyservice doesnot work, try to loop through the node and manually copy the elements from one node to other.

Regards,

Laxmi

Answers (5)

Answers (5)

former_member189631
Active Contributor
0 Kudos

Hi Ricardo,

I hope this way will help You,

  • You can rename the node and thr elements by right click --> Rename

  • The copy the NodeB.

Regards,

<b>Ramganesan K</b>

Former Member
0 Kudos

Try this,

WDCopyService.copyElements(wdContext.nodeA2(), wdContext.nodeB2());

WDCopyService.copyElements(wdContext.nodeA3(), wdContext.nodeB3());

Instead of copying NodeA to NodeB, try copying the subnodes....

Good luck.

former_member189631
Active Contributor
0 Kudos

Ricardo,

One way is,

  • Create a same node in the controller side.

  • Do Context mapping like this,

Node A -


> Controller Node X-----> Node B

Regards,

<b>Ramganesan K</b>

Former Member
0 Kudos

Thanks for your answers, but none has yet solved my problem.

I've seen the situation of the Upper and lower case and it matches both, only the sub-nodes have different names. But none of the methods, copyElements, copySubtree ou copyCorresponding work.

The direct mapping of the tow bapi's is not possible in this case, the only way I haven't tried yet is to create an equal structure in a different controller, and mapping this structure to the ouput of the first Bapi and then to the input of the second.. But it must be possible to do it in a more direct way...

Former Member
0 Kudos

Also check the case(uppercase or lowercase) of the attributes in both nodes.

Former Member
0 Kudos

Hi Ricardo,

You can copy node b to node a as follows:

WDCopyService.copyElements(wdContext.nodeNodeB(), wdContext.nodeNodeA());

See to that, the names of the attributes match in both the nodes.

Let me know if it works.

Regards,

Laxmi

Former Member
0 Kudos

Thanks for your help and time Laxmi,

but i'm getting a com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: nodes are incompatible.

Well, the elements name and type match, the node, and sub-node names don't, because I can't have equal node names.

I really don't know why this isn't working, I only have to set the values of the elements of one node to another.

Do you have a clue?

Thanks in advance.

Regards,

Ricardo Nascimento.