cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving values for all elements having used a supply function

Former Member
0 Kudos

Can someone advise on how do I retrieve all elements populated into the nodes and attributes at runtime?

The structure of my context is

PartNumbers (singleton node, with cardinality 0..n)

  --PartNum

  Headers (singleton node, with a supply function)

  --HeaderNum

  Items (singleton node, with a supply function)

--ItemNum

Value node ‘PartNumbers’ is a parent node of ‘Headers’, which again is the parent node of ‘Items’.

Each node has an associated value attribute as a num (PartNum, HeaderNum, and ItemNum)

The relationship between these nodes is like a single PartNum has multiple HeaderNums, and each HeaderNum further has multiple ItemNums.

For e.g.

PartNum1

Header1

Item1

Item2

Header2

Item1

Item2

In order to establish the relationship between the dependent and the independent nodes, I am implementing a supply function for the two dependent nodes (Headers, and Items).

I have got this relationship working and displaying in separate views so far, but I need to have all the PartNumbers, the associated Headers and the Items to be written to a file.

Having used supply functions with a singleton node the content of the node elements (Headers and Items) changes each time the lead selection of the parent node (PartNumbers) changes and as a consequence, I can’t get values of all the elements.

Can someone please help?

Many Thanks,

Vicky

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vicky,

As you said, since you have declared the inner nodes as singleton, only one instance of those will exist. Each time the parent element gets changed, the supply function will be called and the innernodes will be overwritten.

If you need to get all the generated values of the innernodes, you either need to declare the nodes as non-singleton or go for some workaround method (like creating another non-singleton structure and creating a new element each time the lead selection changes). Please update us if yu get some other solution.

Best Regards,

Nibu.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vicky

Make the inner nodes as non singleton and use calculated attribute instead of Supply function.

Regards

NagaKishore

Former Member
0 Kudos

Hi NagaKishore,

Thanks for your reply. Will go and give a shot tomorrow morning.

Menwhile, with the structure of the context mentioned earlier, one of the supply functions that I use is:


public void supplyHeaders(IPrivateChangeRequestCust.IHeadersNode node, IPrivateChangeRequestCust.IPartNumbersElement parentElement)
  {
    //@@begin supplyHeaders(IWDNode,IWDNodeElement)
    
	wdContext.currentZrfc_Ecm_Bom_Document_1_InputElement().setDocnum(""+parentElement.getAttributeValue("DocumentNumber"));
	wdContext.currentZrfc_Ecm_Bom_Document_1_InputElement().setDoctype(""+parentElement.getAttributeValue("DocumentType"));
	wdContext.currentZrfc_Ecm_Bom_Document_1_InputElement().setDocpart(""+parentElement.getAttributeValue("DocumentPart"));
	wdContext.currentZrfc_Ecm_Bom_Document_1_InputElement().setDocver(""+parentElement.getAttributeValue("DocumentVersion"));	
    this.executeBapi_BomDocument();	
	int size = wdContext.nodeZrfc_Ecm_Bom_Document_1_Input().nodeOutput().nodeBomheaders().size();
	
	IHeadersElement headersElement= null;
	node.bind(headersElement);
	
	for(int i = 0; i <size; i++)
	{
		headersElement = wdContext.nodeHeaders().createHeadersElement();
		headersElement.setAttributeValue("BomHeader",wdContext.nodeZrfc_Ecm_Bom_Document_1_Input().nodeOutput().nodeBomheaders().getElementAt(i).getAttributeValue("Matnr"));
		headersElement.setAttributeValue("BomDescription",wdContext.nodeZrfc_Ecm_Bom_Document_1_Input().nodeOutput().nodeBomheaders().getElementAt(i).getAttributeValue("Ztext"));
		headersElement.setAttributeValue("BomPlant",wdContext.nodeZrfc_Ecm_Bom_Document_1_Input().nodeOutput().nodeBomheaders().getElementAt(i).getAttributeValue("Werks"));
		wdContext.nodeHeaders().addElement(headersElement);
	}
}

So, with what you say, I have to essentially replace the supply functions with the calcuated attributes? Is it possible for you to post some code snippet or an example or something on calculated attributes that relates to what I am after? If yes, that'll be much appreciated.

Thanks heaps,

Vicky

Former Member
0 Kudos

Hi Nibu,

I managed to implement one of the work around ways and achieved what I sought. Though I am still having all nodes as Singleton and no non-singleton nodes have been used.

Thanks,

Vicky