How to delete dynamically created nodes?

Hello Colleagues,
In our screen we have a push button which adds one node to the context when used. The node is having a few fields which are shown in the UI.
So as you keep on pressing the button, additional rows will be appended on the screen.
Now, I have added another button on each of these rows. On clicking of which it should remove the row (the node). So each time you press the button 'Add element', additional rows will be appended, and each row will have a button 'Remove Element'.
But, the problem I am facing is in the implementation of 'Remove Element'.
The button 'Remove Element' is mapped to an action. But since there are as many 'Remove Element' buttons as there are rows, how do I identify which node is to be deleted ?
I have tried with get lead selection etc. but it didnt work.
Is there any way we can find out which UI element has trigerred the deletion, in the code of 'onactionSOMETHING' ?
Thanks
Gagan

Hi,
In the WDEVENT parameter of the action handler you can find the event id.
***Variables
  DATA:
    lv_selected  type string.          "Selected tab value
***Structure and internal table for the Events and messages
  DATA:
    lt_events type WDR_EVENT_PARAMETER_LIST,
    ls_events type WDR_EVENT_PARAMETER.
***Field symbols
  field-symbols: <fs_value> type any.   "Attribute value in events table
***Move the event table to lt_events
  lt_events = wdevent->parameters.
  read table  lt_events into ls_events with key name = 'SAVE'.  "Button Id
  if sy-subrc eq 0.
    assign ls_events-value->* to <fs_value>.
    if sy-subrc eq 0.
      lv_selected  = <fs_value>.
    endif.                 "IF sy-subrc eq 0.
  endif.                 "IF sy-subrc eq 0.
Regards,
Lekha.

Similar Messages

  • How to delete Dynamically created input field UI Element

    Hi all,
              I want to delete dynamically created input field and label.
    Is there any method please tell.
    Thanks in advance
    Hemalatha

    Hi,
    In the WDEVENT parameter of the action handler you can find the event id.
    ***Variables
      DATA:
        lv_selected  type string.          "Selected tab value
    ***Structure and internal table for the Events and messages
      DATA:
        lt_events type WDR_EVENT_PARAMETER_LIST,
        ls_events type WDR_EVENT_PARAMETER.
    ***Field symbols
      field-symbols: <fs_value> type any.   "Attribute value in events table
    ***Move the event table to lt_events
      lt_events = wdevent->parameters.
      read table  lt_events into ls_events with key name = 'SAVE'.  "Button Id
      if sy-subrc eq 0.
        assign ls_events-value->* to <fs_value>.
        if sy-subrc eq 0.
          lv_selected  = <fs_value>.
        endif.                 "IF sy-subrc eq 0.
      endif.                 "IF sy-subrc eq 0.
    Regards,
    Lekha.

  • How to delete dynamically created attribute

    Hi,
      I am creating table dynamically according to no of columns. first time its displaying correctly, second time once i changed the no of columns its throwing error message like:
    com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(DynamicView.TableNode): duplicate name for attribute name0.
    Everytime before creating table i tried  following commands.
    table.removeAllColumns();
    but still i am getting error.
    Help me out in this....
    Regards
    Suresh KB

    hi suresh
    table.removeAllColumns();
    will remove all the columns from the view.
    but when u create the context attributes they are already existing. So it is giving the duplicate context exception.
    To solve this problem, first delete all the attributes created dynamically. using below code.
    wdcontext.node<urnode>().reset(<b>False</b>).
    it will delete all the attrbutes created at runtime.
    to delete attrbutes created at designtime use.
    wdcontext.node<urnode>().reset(<b>True</b>).
    Regards
    Brahmanandam.A
    collections created at design time will be preserved.  All dynamically
    added nodes and attributes are destroyed from the metadata.<p>
    Calling reset(true) is functionally equivalent to calling reset().<p>

  • How get context value form a dynamic created node

    Hi all,
    I have build my own dynamic view. In this view I use also a dynamic created Node. When I have more rows in my Node I see every row with context of the last row of the dynamic Node.
    this is the source I use.
    for (int x = 0; x < dynTabNode.size(); x++)
      dynTabNode.setLeadSelection(x);
      IWDGroup group = (IWDGroup)view.getElement("Group_name");
      IWDAttributeInfo aiName = wdContext.getChildNode("DayNode", IWDNode.LEAD_SELECTION).getNodeInfo().getAttribute("Name");
      IWDCaption name = (IWDCaption) view.createElement(IWDCaption.class, null);
      name.bindText(aiName);
      group.addChild(name);
      for (int i = 8; i < 18; i++)
        int teller = i * 100;
        IWDGroup group1 = (IWDGroup)view.getElement("hour" + teller);
        for (int z = 0; z < 12; z++)
          IWDImage image = (IWDImage) view.createElement(IWDImage.class, "Image" + teller + "_" + x);
          image.setWidth("10");
          image.setHeight("24px");
          image.setBorder(0);
          IWDAttributeInfo att = dynTabNode.getNodeInfo().getAttribute("hour" + teller);
          image.bindSource(att);
          group1.addChild(image);
          teller = teller + 5;
    How can I read my Node row for row?
    Richard
    Edited by: Armin Reichert on Jul 28, 2008 5:03 PM

    The reason is that all these Caption UI elements are bound against the same context attribute. At runtime this will be resolved to the attribute value of the lead-selected node element. In this example you can fix this by not binding the "text" property but setting it to the attribute value of the iterated node element:
    for (int x = 0; x < dynTabNode.size(); x++)
      dynTabNode.setLeadSelection(x);
      IWDGroup group = (IWDGroup)view.getElement("Group_name");
      IWDCaption name = (IWDCaption) view.createElement(IWDCaption.class, null);
      IWDNode dayNode = wdContext.getChildNode("DayNode", IWDNode.LEAD_SELECTION);
      String text = (String) dayNode.getElementAt(x).getAttributeValue("Name");
      name.setText(text);
      IWDAttributeInfo aiName = dayNode.getNodeInfo().getAttribute("Name");
      name.bindText(aiName);
      group.addChild(name);
    (I assume here that the node "DayNode" has the same size as dynTabNode. No idea if this assumption is correct)
    But this would not help for editable elements where you need to bind the edited property.
    Armin

  • How to delete Thr created functional module dynamically

    Hi All,
    How to delete Thr created functional module dynamically
    Regards,
    Lisa
    Message was edited by:
            Lisa Roy

    Hi,
    You can use the function module RS_FUNCTION_DELETE to do that.
    Make sure you are not deleting any standard FM's.
    Example
          call function 'RS_FUNCTION_DELETE'
               exporting
                    funcname          = 'ZFM_NAME" " Function modue name
                    suppress_popups   = 'X' " TO suppress any pop-ups that come when you delete
               exceptions
                    error_message     = 1
                    cancelled         = 2
                    function_released = 3
                    others            = 4.
    Regards,
    Sesh

  • Delete Dynamic context nodes?

    I have created Context nodes dynamically,, I want to delete few nodes dynamically itself.
    wdContext.getContext().reset(true)   would delete entire dynamically created nodes..... but i want to delete particular nodes...
    can any 1 help me regarding this....
    thanku

    Try
    wdContext.removeElementAt(index)
    or
    wdContext.removeElement(IWDNodeElement)
    Regards, Aldo.

  • How to delete order created against notification

    hi gurus,
    Someone tell me how to delete order created against notification. & also PR created against it.
    Regards,
    Radhika

    Hello
    You can set the deletion flag only when the order is business completed - CLSD status (no open costs remaining on the order). Deletion flag is set to the order when you want to archive the order. Till the order has a CLSD status, the del flag setting in the menu will remain inactive.
    Any open PR created against the order is automatically set to deletion when the order is set to TECO - tech completed status.
    For your scenario:
    If you dont want to use the order and the order is with CRTD status - you can set the 'Do not Execute' flag. It will set the order to CLSD and NCMP (Not completed) status. this will also delete your PR
    In case your order is already released - you will have to set the CLSD status for your purpose
    Regards
    Kartik

  • How to set a value to a dynamically created node/attribute?

    Hi,
    I dynamically created attributes using the following method,
    IWDNodeInfo cbOptions = wdContext.getNodeInfo().addChild("cbOpt"+count, null, true, true, false, false, false, true, null, null, null);
    cbOptions.addAttribute("opt"+critEle.getQuest_Critid(), "ddic:com.sap.dictionary.string");
    How do i assign a  value to it now, since the node/attribute cannot be accessed via wdcontext?
    On a side note, it seems really troublesome if i need to use a checkbox grp(s) dynamically. I actually need to dynamically create a seperate node + attribute for each checkbox grp i have. Is there any better way to do this?
    Thanx in advance

    Hi
    Steps:
    1) Create the  action click is done statically (you cannot create action dyanmically)
    2) binding the  action click to checkbox dynamically 
    code
    public static void wdDoModifyView(IPrivateDynamicProgrammingView wdThis, IPrivateDynamicProgrammingView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
        //@@begin wdDoModifyView
         if(firstTime){
                      IWDTransparentContainer con=(IWDTransparentContainer)view.getElement("RootUIElementContainer");
              IWDCheckBox checkBox=(IWDCheckBox)view.createElement(IWDCheckBox.class,"ck");
              IWDAction act=wdThis.wdCreateAction(IPrivateDynamicProgrammingView.WDActionEventHandler.CLICK,"");
              checkBox.setOnToggle(act);
              con.addChild(checkBox);
        //@@end
    Thanks and Regards,
    Arun

  • How to set the cardinality property as 1..n for a dynamically created node

    Hi...everybody
        I am creating Dropdown by index UI element and the
    context atrributes dynamically.To bind multiple data to a dropdown
    the cardinality property of the node should be 0..n or 1..n,
    But i could not set the property of the dynamically created context node to 0..n ...
    can any body suggest me..
    I implemented the following code in WDDoModify View
    IWDTransparentContainer tc=(IWDTransparentContainer)view.getElement("RootUIElementContainer");
    IWDNodeInfo node = wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,
              null,null);
    IWDAttributeInfo strinfo=node.addAttribute("Value","ddic:com.sap.dictionary.string");
    dbyindex.bindTexts(strinfo);
    tc.addChild(dbyindex);
    I could successfully display one value in the drop down,by adding the following code before the line tc.addchild(dbyindex);
    IWDNode node1=wdContext.getChildNode("DynamicNode",0);
    IWDNodeElement nodeElement=node1.createElement();
    nodeElement.setAttributeValue("Value","Hello");
    node1.addElement(nodeElement);
    but when
    i am trying to bind multiple values i am getting Exception ,,,,

    hi
    you are getting the exception because of cardinality property.
    i.e   true,false and
    you are trying to add morethan one element.
    so,if you want to add morethan one than one element you have to set the cardinality property to true,true (or) false,true.
    In your code do the following modification for changing the cardinality.
    For 0..n -->false,true
          1..n-->true,true
    IWDTransparentContainer tc=(IWDTransparentContainer)view.getElement("RootUIElementContainer");
    IWDNodeInfo node = wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,
    null,null);
    IWDAttributeInfo strinfo=node.addAttribute("Value","ddic:com.sap.dictionary.string");
    dbyindex.bindTexts(strinfo);
    tc.addChild(dbyindex);
    hope this will solve your problem.
    In addchild(..) the parameters are
    addChild("Name ,
                    Element class for model node ,
                    Is singleton? ,
                    Cardinality ,
                    Selection cardinality ,
                    Initialise lead selection? ,
                    Datatype ,
                    Supplier function ,
                     Disposer function);
    Regards
    sowmya

  • How to delete the context node in BSP Component?

    Hi,
    I have created a custom context node in one of the components : BP_BPBT.
    Now, I want to delete the context node..
    Could you please tel me, how can I do that?
    Thanks,
    Sandeep

    Hi Sandeep,
      Please check the below link.
    [How to delete Context Node;
    Regards,
    Lakshmi.Y

  • How to implement Dynamic Context Node Mapping between Components

    Hey genuis:
               I am looking for how to implement context mapping bwteen two components. I read some threads, and try to use external context mapping. The example works fine. However, my requirement is more than that.
    I have a context node in Component B, and the attributes in it are dynamically generated. Component A is the main component which use Component B's function. Both A and B work fine by theirselves. 
    When I assemble A and B (external mapping), the system gives me a exception:com.sap.tc.webdynpro.progmodel.context.ContextException: MappedNodeInfo(T8UploadCompInterface.data): cannot create nodes, no mapping defined yet.
    Please give me some suggestion?
    Any responses are appreciated.

    I miss this thread.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6fdae690-0201-0010-a580-d104b459cb44
    This is almost the right solution for my problem.

  • How to delete a perticular node from xml file using java code

    Hii All,
    Now i am trying to delete a perticular node from xml file.Like...
    XML file:
    <Licence>
    <SERVER>
    <was id="1">1</was>
    <was id="2">2</was>
    </SERVER>
    </LICENCE>
    I am working in messaging service using JABBER framework with whiteboard facility.
    Here Some commands i have created to add,modify,delete nodes from xml file.They Are
    1.If u want to add a new node then.
    create Licence.SERVER <ss id="3">ddd</ss> lic.xml
    (here u want to add a new node called "ss" under Licence.SERVER.
    And lic.xml is tyhe xml file name where it was saved.
    2.If u want to delete a node(Suppose <was id="1">),then the command should be
    delete Licence.SERVER.was:id='"1" lic.xml
    A problem arises that here it find two was attributes.And it delete the last was attribute,not the requested node.
    PLEASE HELP ME IN SOLVING THIS CODE..
    ------------------------------------

    Looks like you clicked on "Post" before you pasted in the code you were talking about.

  • How to delete objects created with new

    Hello,
    I am having a problem creating a behavior or script to delete new sprites created in channels. I have a behavior script that creates new sprites using the following (simplified) script:
    First, a Beginsprite creates a gChannel_list and assigns a beginning gChannel value. pSprite is used to establish the sprite that in the mousedown is clickon.
    on Beginsprite me 
      gChannel_List =[]
      gChannel = 70
      pSprite = sprite(Spritenum)
    end
    In the mousedown the gChannel is incremented and the newly created channel is added to the gChannel_list.
    on Mousedown me
      gChannel = gChannel + 1
      theChannel = addat(gChannel_List,gChannel)
      themember = pSprite.member
      channel(gChannel).makeScriptedSprite(themember, point(80,160))
      sprite(gChannel).width = thememberW
      sprite(gChannel).height = thememberH
      sprite(gChannel).rotation = theMemberR
      sprite(gChannel).moveablesprite = 1
      sprite(gChannel).ink = 36
    etc
    After creation of several sprites based on the the gChannel, the following globals, for example, are returned.
    -- Global Variables --
    gChannel_List = [71,72,73,74]
    gChannel = 74
    My problem is that I am unable to delete these created gchannel sprites with a lingo command. Deleting them from the list, for example, using deletat(gChannel,1), does nothing to remove them from the stage (they do disappear from the list). And while I can display their attributes such as width [n=getat(gChannel_list, x); put sprite(n).width], nothing seems to relate to deleting these gchannel sprites.
    How is it done?
    Hope this is enough information. If not, please let me know. I can provide whatever you might need. Please help.
    Rod

    Sean,
    DUH! Didn't even know that a 'removeScriptedSprite()' command existed! Very logical. It works perfectly. Thanks again so very much.
    Rod

  • How to delete Jobs created by T.Code SM36

    Hi,
    I am trying to delete Events created by T.code SM62.
    But this has some jobs which i created by T.Code SM36.
    How i Can delete these Jobs.
    Because i want stop my process chain triggered by this event.
    Regards,
    Anand Mehrotra.

    Hi Anand,
    Please go through the below procedure....
           1.      Select a job (or jobs) from the Select Background Jobs screen (Transaction SM37, or choose CCMS ® Jobs ® Maintenance, complete the description of the jobs you want to delete, then choose Execute to get to the Job Overview.)
           2.      In the Job Overview, mark the job or jobs you want to delete by checking the box to the left of the job name.
           3.      Choose Job ® Delete.
    Hope this helps you
    Thanks
    KP

  • How-to handle dynamically created AppModules with JUApplication, JUMetaobjectManager

    Hi,
    I've got a JClient App, where I want to dynamically create AppModules in the Context of the RootAppModule.
    How can I best do this??? The problem is that I can't really use the JUMetaObjectManager.createApplicationObject method and hence I can't use PanelBindings.....well I can't use the JClient Framework.
    Is there a way to elegantly manage this issue??
    Every solution would be very appreciated! thanks.

    Hi, first off, no need to determine what has been checked or not. If the checkbox is checked, on the post, the value will be submitted as part of the request. If the checkbox is not checked, it will not be submitted (it's value will be null). Depending on what you need, I have approached this a number of different ways. One way is to name all checkboxes the same name. If you need to distinguish between two rows in the form, then in the value field for the checkbox, use some type of distinguishing factor, for example,
    <input type=checkbox name=chkName value="1:abc">
    <input type=checkbox name=chkName value="1:def">
    Now, you only have to make one call on the Servlet/JSP receiving the form post, request.getParameterValues("chkName") which will return an array of the non-null Strings that were checked.

Maybe you are looking for

  • Iphone in recovery mode? PLEASE HELP

    Hello everyone. the iOS 8 update came out today and I wanted to download the update through my computer onto my iPhone 5s. i plugged in my phone and it said backing up and all. It then said Validating update and my iPhone went to the white screen wit

  • Understanding the get-help syntax

    Hi, I was studying on how to learn how to find and get powershell cmdlets.   However, when following the advice from an article: http://www.windowsnetworking.com/articles-tutorials/windows-server-2012/powershell-essentials-part3.html ================

  • Restarting of SAP PRD server

    Dear Team, We are facing a issue with PRD server. For last 20 days we restarted the PRD server for 3 times. 1)We restarted the server for TMS issue which is advised by SAP support team in one incident. 2)Another time we restarted the server for the i

  • Output in Texpad rather than CMD prompt

    I know there is a way to get textpad to output in textpad rather than command prompt. Its some setting in textpad that i need to turn on. Where do i go in textpad to do this? It is because i have to copy and paste my output to my teacher and i can't

  • Flash player silent install  os 10.8

    So I am trying to install the flash update on remote computers and of course want to use a script. So I got the correct flash installer after registering to distribute flash. Also looked that the "manual" for flash. I have yet to get the command show