Skip to Content

Static and Dynamic Context

Question 1. I have created a static value node say vn_static. At run time, based on some condition i want to add dynamic value attributes say va_dynamic1, va_dynamic 2 etcs... What is the code to create a dynamic value attribute to my static value node?

Question 2. I have a drop down list that i created dynamically based on the Function module's output as shown in below code. Now user selects a value from this drop down list and i want to retrieve that user selected value from the drop down on button action. What is the code to retrieve the value?

 IWDNodeInfo rootNodeInfo = wdContext.getNodeInfo();
					IWDNodeInfo configNodeInfo =
						wdContext.getNodeInfo().addChild(
							"vn_DynamicDDnode" + firstLoop,
							null,
							true,
							true,
							false,
							false,
							false,
							true,
							null,
							null,
							null);
					configNodeInfo.addAttribute(
						"va_config",
						"ddic:com.sap.dictionary.string");
					IWDNode configNode =
						wdContext.getChildNode(
							"vn_DynamicDDnode" + firstLoop,
							0);
					IWDNodeElement configElement = configNode.createElement();
					configElement.setAttributeValue("va_config", new String());
					configNode.addElement(configElement);
					IWDDropDownByKey iwdDD1 =
						(IWDDropDownByKey) view.createElement(
							IWDDropDownByKey.class,
							null);
					ISimpleTypeModifiable config =
						wdThis.wdGetAPI().getContext().getModifiableTypeOf(
							"vn_DynamicDDnode" + firstLoop + ".va_config");
					IModifiableSimpleValueSet configValues =
						config.getSVServices().getModifiableSimpleValueSet();
					configValues.put("", "");}

Appropriate answer to either 1 or both the questions will be rewarded with maximum points.

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 22, 2009 at 07:29 AM

    Hi,

    1. To add dynamic value attribute to your static node, use the following code

    wdContext.node<staticnode>().getNodeInfo().addAttribute(<name>,<type>);

    2. For getting the value of the current selected element of dynamic node

    wdContext.getChildNode(<dynamic node name>,IWDNode.LEAD_SELECTION).getCurrentElement().getAttributeAsText(<attribute name>);

    Regards,

    Murtuza

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 22, 2009 at 07:35 AM

    Hi Kavitha,

    Follow these steps for your first question,

    1) Get access to your static node and add the attributes like this,

    IWDNode <nodeName> = wdContext.getChildNode("<yourNodeName>", 0);
    IWDNodeInfo <nodeInfo> = <nodeName>.getNodeInfo();
    <nodeInfo>.addAttribute(<attrName>,<attrType>);
    

    Regards

    Kishan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 22, 2009 at 07:32 AM

    Hi,

    Question 2 answer

    you write this code in button action.

    I am retriving that dropdown value and displaying in textbox.

    String ss=wdContext.currentContextElement().getObject();

    wdContext.currentContextElement().setText(ss);

    getObject() means dropdown values.

    setText() means displaying that value in textbox.

    Regards,

    Sunaina Reddy T

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 22, 2009 at 09:20 AM

    And my question to you: Is it really necessary to create context structures and UI elements programmatically? Maybe we can solve that much more easily.

    Could you please describe the use-case in more detail?

    Armin

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 23, 2009 at 04:47 AM

    How to set lead selection as 0 for a dynamically created node?

    The below code is not working.

                            wdContext
    				.getChildNode(
    					wdContext
    						.nodeVn_ddNodeAttrNames()
    						.getVn_ddNodeAttrNamesElementAt(size)
    						.getVa_DDnodeName(),
    					IWDNode.LEAD_SELECTION)
    				.setLeadSelection(0); 

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 06, 2009 at 09:53 AM

    Hi Murtuza,

    How to set a particular value as lead selected in the dynamic drop down?

    Example: Dynamic drop down node name is vn_dd and value attribute name is va1. Say, va1 contains four values a,b,c,d. Now, during an action and condition i want to set va1's lead selected value as "c". How to do that in dynamic node?

    In static node, normally it works just by setting current element (drop down by key).

    Thanks & Regards.

    Add comment
    10|10000 characters needed characters exceeded