Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Set Runtime Output parameters in GP WebdynproCO

Hi Experts,

I am trying to set runtime attributes to a Structure in guided procedures Input - output parameters definition in getDescription method in WebDynpro Callable Object.

1) In my WebDynpro component, I have created a Dynamic Node.

2) In my interface controller implementing IGPWebDynproCO - in

getDescription method i have specified an output parameter as

a "OutputStructure" with out - whose attributes are decided from

Dynamic Node.

3) Now when the program execution finishes, i need to pass this Dynamic

node as an output structure parameter.

4) On an action - when i try to set the Dynamic node as an output

parameter , i am unable to do so.

I get an error message as "Structure OutputStructure with namespace

null does not have any attributes with name attribute1 and name space

null".

When i check in guided procedure design time - in output structure i

see "OutputStructure" without any attributes under it. ( the attributes are set at runtime in Getdescription method)

Is there anyway to set dynamic output structure in webdynpro Callable

Object and to retrieve data from input structure?

These are stpes that i followed :

1. In Component Controller

public void wdDoInit()
  {
    //@@begin wdDoInit()
//	Dynamically create a context node and add value attributes
		IWDNodeInfo nodeInfo =
			wdContext.getNodeInfo().addChild(
				"ReqDataOutput",
				null,
				true,
				true,
				true,
				false,
				false,
				true,
				null,
				null,
				null);

	nodeInfo.addAttribute("CustomerName", "com.sap.dictionary.string");
	nodeInfo.addAttribute("CustomerID", "com.sap.dictionary.string");
	nodeInfo.addAttribute("CustomerAddress", "com.sap.dictionary.string");
}

2. In Interface Controller:

public com.sap.caf.eu.gp.co.api.IGPTechnicalDescription getDescription( java.util.Locale locale )
  {
//	Pre-existing structure for output parameters
		 IGPStructureInfo output =
			 technicalDescription.getOutputStructureInfo();
 // Create the attributes in the output structure
 IGPStructureInfo reqStructure =
				 output.addStructure("ReqStrOutput");
 reqStructure.setMultiplicity(IGPStructureInfo.MULITIPLICITY_0_N);
//			 Get the reference of Dynamic node
 IWDNodeInfo reqOutputNode =
	 wdThis
		 .wdGetAPI()
		 .getContext()
		 .getRootNode()
		 .getChildNode("ReqDataOutput", IWDNode.LEAD_SELECTION)
		 .getNodeInfo();

//			   Iterate through the dynamically created node attributes and display the node element
 Iterator iter = reqOutputNode.iterateAttributes();
 IGPAttributeInfo attr = null;
 while (iter.hasNext()) {
	 IWDAttributeInfo attrInfo = (IWDAttributeInfo) iter.next();
	 wdComponentAPI.getMessageManager().reportSuccess(
		 attrInfo.getName());
	 attr =
		 reqStructure.addAttribute(
			 attrInfo.getName(),
			 IGPAttributeInfo.BASE_STRING);
	 attr.setMultiplicity(IGPStructureInfo.MULITIPLICITY_0_1);
 }
}

3. In Complete Method u2013 On click of a button


  public void complete( )
  {
    //@@begin complete()
// Set the values of the output parameters
IGPStructure output = executionContext.getOutputStructure();

// Get the reference of Dynamic node
IWDNodeInfo reqOutputNodeInfo =
	wdThis
		.wdGetAPI()
		.getContext()
		.getRootNode()
		.getChildNode("ReqDataOutput", IWDNode.LEAD_SELECTION)
		.getNodeInfo();
IWDNode reqOutputNode =
	wdThis.wdGetAPI().getContext().getRootNode().getChildNode(
		"ReqDataOutput",
		IWDNode.LEAD_SELECTION);
//			  Iterate through the dynamically created node attributes and display the node element

Iterator iter = null;
for (int i = 0; i < reqOutputNode.size(); i++) {
	iter = reqOutputNodeInfo.iterateAttributes();
	;
	reqOutStructure = output.addStructure("ReqDataOutput");
	while (iter.hasNext()) {
		IWDAttributeInfo attrInfo = (IWDAttributeInfo) iter.next();
		
		reqOutStructure.setAttributeValue(
			attrInfo.getName(),
			reqOutputNode.getElementAt(i).getAttributeValue(
				attrInfo.getName()));
//@@end
  }

Regards,

Ashish Shah

Not what you were looking for? View more on this topic or Ask a question