Showing results for 
Search instead for 
Did you mean: 

Setting dynamic context with actions

0 Kudos

Hey experts,

I have created a new WDJ application running on a SAP EP 7.4. Since our customer has quite special requirements on this one, I needed to use dynamic context and view creation, approx like this:

    IWDTable rfcTable = (IWDTable) view.createElement (IWDTable.class, new String ("rfcTableIdentifierFor" + destinationName));
    rfcTable = formatTable(rfcTable);
    //dynamic context creation
    IWDNodeInfo nodeInfo = wdContext.getNodeInfo().addChild("RFCDynamicFor" + destinationName, null, false, CMICardinality.MANY, CMICardinality.MANY, false, null);
    //Dynamically add attributes to the context node
    nodeInfo.addAttribute("system", ""); //System

    nodeInfo.addAttribute("firstVisible", ""); //first visible
    nodeInfo.addAttribute("popinKey", ""); //popin key
    nodeInfo.addAttribute("popinStatus", ""); //popin status
    nodeInfo.addAttribute("iconSource", ""); //popin icon image source

    rfcTable.bindDataSource("RFCDynamicFor" + destinationName);
    rfcTable.bindFirstVisibleRow("RFCDynamicFor" + destinationName + ".firstVisible");

Im also creating some columns with binded content on my dynamic context, this all works well so far. In fact Im following Dynamic UI Generation - Web Dynpro Java - SCN Wiki on this task

So here comes the problem: my dynamic table has also a popin column:

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos
    //popin button column
    IWDTableColumn popinColumn = view.createElement(IWDTableColumn.class); 
    IWDCaption popinColumnHeader = view.createElement(IWDCaption.class);
    IWDLinkToAction linkToAction = (IWDLinkToAction) view.createElement(IWDLinkToAction.class, "LinkToAction" + destinationName);
    linkToAction.bindImageSource("RFCDynamicFor" + destinationName + ".iconSource");
    IWDAction popinToggleAction = view.getAction("onPopinToggle");
linkToAction.setOnAction( popinToggleAction );
linkToAction.mappingOfOnAction().addSourceMapping("nodeElement", "row");
0 Kudos

So popin toggle action is defined as follows:

  public void onActionOnPopinToggle( wdEvent, row )


    //@@begin onActionOnPopinToggle(ServerEvent)


   row.setAttributeValue("popinKey", "");

   row.setAttributeValue("popinStatus", false);

   row.setAttributeValue("iconSource", "~Icon/Add");



   row.setAttributeValue("popinKey", "PopinId");

   row.setAttributeValue("popinStatus", true);

   row.setAttributeValue("iconSource", "~Icon/Remove");




As we can see Im using the generic class row for parameter passing, since if you creating context dynamically you dont have classes like I<your>Node. At the same time SAP says you need always to create actions on design time, even you are using them dynamically, it cant work otherwise.

So, if Im debugging this action Im noticing the handler is running through it if Im klicking on my popin button as desired and is able to read / set properties, I have no exceptions while runtime and cant see any problems in the developer log. However, if Im klicking the button again and running a second time through the action handler, Im noticing my impression it is working properly is wrong, since setting attributes doesnt works at all. It means if Im klicking the button a second time popinStatus is still false, even it was set to true while first action execution.

Corresponding to this problem, popin of course dont work, so Im missing the expected runtime behaviour here. Do you guys have any ideas what is running wrong? Thank you very much in advance,

best regards