cancel
Showing results for 
Search instead for 
Did you mean: 

NW 7.30 severe bug in WDCopyService.copyCorresponding

rolf_paulsen
Active Participant
0 Kudos

Hi forum,

anyone out there using Web Dynpro Java on NetWeaver 7.30 SP4 ?

We are facing an unexpected, modified and erroneous behavior by invoking the standard Web Dynpro for Java method WDCopyService#copyCorresponding(Object source_node_element, Object target _node _element 😞

Null values from source node element attributes will not be copied to corresponding target node element attributes. That means, if the target node element has an attribute which references a u201Cnon-nullu201D value and the source node element exactly has that corresponding attribute assigned with null, after invoking the method WDCopyService#copyCorresponding(Object source_node_element, Object target _node _element) the corresponding target node element attribute is still assigned by the u201Cnon nullu201D value. This behavior has changed in NetWeaver 7.30. So you cannot set target node elements to "null" once they were "non null" using copyCorresponding().

This behavior blocks our development. We installed the latest patches, opened an OSS 872113 / 2011 for this issue and hope that SAP will fix this problem in nearest future, but one question remains: Are we alone? Is there nobody out there using WD Java on 7.30? A core functionality in data bindung in WD Java is broken, and we are the first to fall into the trap since GA of 7.30?

If anyone knows a workaround or a fix, this is highly appreciated, of course!

Thanks and regards

Rolf

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

Hi Rolf,

Although I haven't worked with 7.3 yet, I have faced other issues with the copy service in the past (most notably the limitation of not copying to differently named attributes)

As a workaround, I usually implement my own copy/recreate code stub, which basically boils down to iterating through all source elements, iterate through all attributes, and then setting the corresponding values.

I believe there is a slight decrease in performance this way, but if you don't have hundreds of elements to copy it should work flawless

Assuming you have a node Source you want to copy to node Target:


ISourceNode sourceNode = wdContext.nodeSource();
//iterate through source elements
while (sourceNode.iterateElements().hasNext()) {
	ISourceElement sourceElement = (ISourceElement)sourceNode.iterateElements().next();
	//create and add a corresponding target element
	ITargetElement targetElement = wdContext.createAndAddTargetElement();
	//iterate through the attributes of the source node
	while (sourceNode.getNodeInfo().iterateAttributes().hasNext()) {
		IWDAttributeInfo attrInfo = (IWDAttributeInfo)sourceNode.getNodeInfo().iterateAttributes().next();
		//set the target attribute with the value from the source
		targetElement.setAttributeValue(attrInfo.getName(), sourceElement.getAttributeValue(attrInfo.getName()));
	}
}

Hope this helps!

Robin van het Hof

rolf_paulsen
Active Participant
0 Kudos

Hi Robin,

thanks for that snippet and for showing that we are not the only ones who are in trouble with this basic function. We will change our code one by one to get independent from "accidents" introduced by SAP.

Citation from CD201 (SAP TechEd 2010): FAQ about WD Java

"Should I continue developing new Web Dynpro Java applications?"

"Sure! Web Dynpro Java is a mature, stable and robust framework for developing web applications on top of SAP.

Thereu2018s no reason to stop using it."

Obviously, SAP should make an effort to keep this robustness, e.g. write some (more) JUnit tests for basic funcionality of WD Java like WDCopyService. Ohterwise, the robustness will vanish if one bug is replaced by one or two others.

Regards,

Rolf

Answers (0)