OnAction for TreeItemType

Hi
If I click on a TreeItem, my Event Handler method get's the path information for the selected context element like
"IOCG.TreeUIView.Customer.1.Order.0.OrderItem.2"
How do I transfer this String into an context element?
(of type IWDTreeItemType Element)?
Thanks
Raphael

Hi,
I think, I found it out - it works in the same manner
In <b>doModifyView()</b> I used <b>IWDAbstractTreeTableColumn</b> instead of <b>IWDTreeNodeType</b> to get reference to UI element.
<b>IWDAbstractTreeTableColumn masterColumn =(IWDAbstractTreeTableColumn) view.getElement("MasterColumnID") ;</b>
After that I just mapped <b>"path"</b> argument to Action argument <b>"selectedElement"</b> by
<b>masterColumn.mappingOfOnAction().addSourceMapping(                    "path",                    "selectedElement")</b>
And in onActionLoadChildren I added argument <b>selectedElement</b> of type - Context Element that builds tree.
Best regards
KM

Similar Messages

  • OnAction for the UI element "Image"

    Hi,
    I'm using the UI Element Image and I need to know if the User click on it.
    So, I was wondering why there is no Event onAction on this element and if you know an other element to do this.
    Thanks
    Philippe.

    Hi
      There is no event for Image ui element. If you want an action to happen when you click on a image then the maximum you could do is create a button and attach a image to the Image property of the button. That should help you to achieve your requirement.
    regards
    ravi

  • View Container UI element in a table popin dynamically

    Hello people,
    I create a WD Table dynamically using the runtime class. I also create the table popin and then I set it in the table using the method SET_POPIN from the runtime class.
    Now my requirement is that I should be able to add the 'View Container UI Element' into this popin so that I can embed any other views into this VC UI E. I cannot find a way in which I can achieve this. I am able to do it statically but not dynamically.
    Even though it is suggested that such a design would lead to performance issues, but I have to achieve this.
    Regards
    Rohan

    Hi Anita,
    you cannot set metadata at element level of a node. When you set the metadata ( example mime type or file name ) for a particular element in the node , it changes for all the element. So you are always getting the file for the last row. ( most recent set metadata ).
    Try using the inteface IWDCachedWebResource for file download.
    For each row add a button, and associate an action "DownloadFile" for it. Use the following "onAction" for the said action. 
    public void onActionDownloadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionDownloadFile(ServerEvent)
        int selectedIndex = wdContext.nodeFileTab().getLeadSelection();
        IPrivateView_pdfView.IFileTabElement file = wdContext.nodeFileTab().getFileTabElementAt(selectedIndex);
        try {
         IWDCachedWebResource webResource = WDWebResource.getWebResource(
              this.
              getByteArrayFromResourcePath("/sapmnt/PCD/global/config/cm/etc/pdf/"+
              wdContext.nodeFileTab().getFileTabElementAt().getFilename(selectedIndex),
              WDWebResourceType.PDF);
         wdComponentAPI.getWindowManager().createExternalWindow(webResource.getURL(),"Download File",true).open();
       catch(Exception e) {
         // take some action
         wdComponentAPI.getMessageManager().reportException(e.toString(),true);
        //@@end
    Hope you get a solution.
    Regards
    KK.

  • FileDownload UI Element in a table

    I'm tryign to use FileDownload UI Element in a table, but it seems not to work.
    I have defined a binary, an IWDAttributeInfo and a IWDModifiableBinaryType attributes in the same context node of the table.
    In wdDoInit() I wrote the following code:
    for (int i=0;i<wdContext.nodeFileTab().size();i++)
    try {
    wdContext.nodeFileTab().getFileTabElementAt(i).setAttInfo(wdContext.nodeFileTab().getNodeInfo().getAttribute(IPrivateView_pdfView.IFileTabElement.T_FILE_DOWNLOAD));
    wdContext.nodeFileTab().getFileTabElementAt(i).setBinaryType((IWDModifiableBinaryType)wdContext.nodeFileTab().getFileTabElementAt(i).getAttInfo().getModifiableSimpleType());
    wdContext.nodeFileTab().getFileTabElementAt(i).getBinaryType().setFileName(wdContext.nodeFileTab().getFileTabElementAt(i).getFilename());
    wdContext.nodeFileTab().getFileTabElementAt(i).getBinaryType().setMimeType(WDWebResourceType.PDF);
    wdContext.nodeFileTab().getFileTabElementAt(i).setTFileDownload(this.getByteArrayFromResourcePath("/sapmnt/PCD/global/config/cm/etc/pdf/"+wdContext.nodeFileTab().getFileTabElementAt(i).getFilename()));
    catch (Exception e)
    wdComponentAPI.getMessageManager().reportException(e.toString(),true);
    As result each row download the file in the last row. Is there any other way I can try?

    Hi Anita,
    you cannot set metadata at element level of a node. When you set the metadata ( example mime type or file name ) for a particular element in the node , it changes for all the element. So you are always getting the file for the last row. ( most recent set metadata ).
    Try using the inteface IWDCachedWebResource for file download.
    For each row add a button, and associate an action "DownloadFile" for it. Use the following "onAction" for the said action. 
    public void onActionDownloadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionDownloadFile(ServerEvent)
        int selectedIndex = wdContext.nodeFileTab().getLeadSelection();
        IPrivateView_pdfView.IFileTabElement file = wdContext.nodeFileTab().getFileTabElementAt(selectedIndex);
        try {
         IWDCachedWebResource webResource = WDWebResource.getWebResource(
              this.
              getByteArrayFromResourcePath("/sapmnt/PCD/global/config/cm/etc/pdf/"+
              wdContext.nodeFileTab().getFileTabElementAt().getFilename(selectedIndex),
              WDWebResourceType.PDF);
         wdComponentAPI.getWindowManager().createExternalWindow(webResource.getURL(),"Download File",true).open();
       catch(Exception e) {
         // take some action
         wdComponentAPI.getMessageManager().reportException(e.toString(),true);
        //@@end
    Hope you get a solution.
    Regards
    KK.

  • How to call a custom method of same view?

    Hello
    I am developing a WDA on ABAP. I kept 3 LTA (Link To Action, kind of hyper link) on the initial_view, they perform the below functions (pls. note all the below 3 are on the initial_view ONLY),
    1) LTA_1 -> Creates 'A' -> The linked EVENT for this LTA is CREATE_A 
    2) LTA_2 -> Creates 'B' -> The linked EVENT for this LTA is CREATE_B
    3) LTA_3 -> Creates 'A' and 'B' -> The linked EVENT(onAction) for this LTA is CREATE_A_and_B, fine.
    I wrote the ABAP code for creating the 'A' for LTA_1 in the associated Event Handler(method), same way i did for B
    Now, for LTA_3 (Event is CREATE_A_and_B), i do not want to replicate the code from LTA_1 and LTA_2.
    1) So, i guess, i just call the above )Event Handler) methods sequentially in CREATE_A_and_B's ABAP editor, am i right?
    2) If so, pls. let me know how to call these methods, say, just for A, so that i will call for B on my own. Normally, we call as below
    my_Class->my_method_name
    3) If so, there is not-optional parameter as WDEVENT, just i need to pass blank for it?
    Thank you

    data: wdevent TYPE REF TO CL_WD_CUSTOM_EVENT.
    wd_this->CREATE_A ( exporting wdevent = wdevent ).
    wd_this->CREATE_B ( exporting wdevent = wdevent ).

  • Menu option under recursive tree item/folder & checkbox in tree

    Hi,
    I want to present a checkbox next to an item or folder in a recursive tree.
    I didn't see any option to do it so I tried to add a menu and a menu option type checkbox under the node item and note type.
    The issue it does nothing.
    Any ideas?
    THanks,
    Itay

    Hi Akshay,
    Everything mentioned here step by step:
    0. You cannot use check-boxes inside tree, so you have to emulate them with images (or use Table with Tree-like master column -- not discussed in this message)
    1. Create boolean attribute <b>isChecked</b> in node
    2. Create calculated read-only string attribute cbIcon, write following in generated getter function:
    return element.getIsChecked() ?
      "~sapicons/b_okay.gif" : "~sapicons/b_canc.gif";
    or whatever images you are using.
    3. Create & bind action onAction for TreeNode / TreeItem.
      -- apply parameters mapping in wdDoModifyView:
    if ( firstTime )
      final IWDTreeNodeType treeNode = (IWDTreeNodeType)
        view.getElement("<your-tree-node-element-id>");
      treeNode.mappingOfOnAction()
        .addSourceMapping("path", "selectedElement");
      <b>Your action must define parameter with type of your node element and name <i>selectedElement</i></b>
      -- write the following code for handler:
    selectedElement.setIsSelected( !selectedElement.getIsSelected() );
    4. Bind cbIcon attribute as TreeNode / TreeItem image source, bind rest of attributes.
    --Done.
    VS

  • NW 7.1 CE problems triggering onAction event for Business Graphics?

    I have ported an application that was running on NWDS 7.0 to CE 7.1. No problems with code compilation and on the web page everything is working fine in 7.1 except that I am unable to trigger the onAction event on Business Graphics (e.g., bar chart). In 7.1 the cursor is not even changing from pointer to hand when I mouseover on the bar legend as it does when I run the app in 7.0. Is this a server setting with CE7.1 or am I missing something else?

    I figured it out after some more poking around. In NW7.1 CE, the additional required step is to map the eventID of the Chart (Business Graphics) Category also to the same attribute as Category description.

  • Select-Options in Webdynpro for Abap with onAction

    Hello,
    I need your help. I have a Webdynpro with 6 Select-Options. I used a button to start the selection. Can the Selection be started with return key.
    Thanks.

    I would expect in any case that there is no problem when you transport WDA build from ehp3 to ehp5 (Backward compatibility ).

  • How to use single eventhandler for all menuitems...

    Hi all,
    I have a tray with a popup.
    Currently I have an eventhandler for every single menuitem.
    Is it also possible to provide only a single eventhandler for all of the menuitems and determine the clicked entry  with the event??
    Tried to use parameter mapping but onAction doesn't provide any parameters... Or am i wrong?!
    Additionally, is there a list populated where I can find  provided parameters for mapping?!
    Thanks in advance for replies.
    Bastian
    Message was edited by: Bastian Schnorbus

    Bastian,
    This is possible via parameter mapping.
    1. Set same action for every menu item;
    2. Add parameter, say "id" of type string to action;
    3. In wdDoModifyView write the following:
    if (firstTime)
      IWDMenuActionItem itm;
      itm = (IWDMenuActionItem)view.getElementById("<id-of-menu-item>");
      itm.mappingOfOnAction.addParameter( "id", itm.getId() );
      /* repeat for all items */
    4. In view handler you now can dispatch by "id" parameter received;
    Valery Silaev
    EPAM Systems
    http://www.NetWeaverTeam.com

  • How to call a view without event handler onaction method.

    Hi Experts,
    I have develop a WD application. It has three views let view1, view2 and view3.
    In view1 one button is there (onaction) which navigates to view2 through outbound plug  wd_This->Fire_Out_Screen1_Plg(   ). where Out_Screen1 is outbound plug of view1.
    Now view2 appears , I want that after 10 seconds view2 automatically call view3, without action on view2.
    I have written like  wd_This->Fire_OUT_SCREEN2_Plg(  ). where OUT_SCREEN2 is outbound plug of view2, which navigates to inbound plug of view3.
    But its not working. Please suggest how to and where to write code to call a view without action .
    for ur ref.

    Hi Bhagat,
    Yes, you can attach media objects into a view
    Using IFRAME ui element and html mime object.
         Please refer the below link
    To insert video in webdynpro - Web Dynpro ABAP - SCN Wiki
    Using Flash Islands
              Here, you need to have your audio/video file as flash object
         Please refer the below tutorial on flash islands( a generic example )
         Adobe Flash Islands for Webdynpro ABAP
    Hope this helps you.
    Regards,
    Rama

  • Action reference in the MAIN view for other Views

    Hi Experts,
    I have created a view(MAIN) that contains SUBMIT button and also included four other views(Using ViewContainerUIElement) in the MAIN view itslef. So am calling the respective view based on some certain condition from MAIN view.
    Now my problem is, am using  check_mandatory_attr_on_view() method which is being called on SUBMIT action from MAIN view of WDDOBEFOREACTION. But it is not checking Required Fields from other views. It checks the Required Fields only in the MAIN view.
    I know that I want to call the reference of other views in MAIN view, but how can I do it?
    Please help me, as how I can check the Required fields on action of SUBMIT button in MAIN view for other views.
    BR,
    RAM.

    Hi,
    Though am in MAIN view, If i clicks the submit button it checks the Required fields on both MAIN and Sub views, where still I have not called the Sub view.
    If you didn't call the sub view, the WDDOINIT method of your sub view wouldn't have been triggered and so the sub view reference is not set in the component controller, isn't it.?
    OR you are calling sub view separately in the initial state and get the reference and then in your MAIN view calling the sub view based on condition in the View Container UI..?
    If so, create an attribute in your Main view (say sub_view_name of type string) and then use the below code to get the current sub view name and then pass the corresponding sub view reference:
    DATA:lr_view_controller    type ref to        IF_WD_VIEW_CONTROLLER,
           lr_main_view_usage  type ref to        IF_WD_RR_VIEW_USAGE.
           lr_vc_assignment      type ref to        IF_WD_RR_VIEW_CNT_ASSIGNMENT.
           lr_view_usage           type ref to        IF_WD_RR_VIEW_USAGE.
           lr_t_views                 type                WDRR_VCA_OBJECTS.
           lr_s_view                  like line of        lr_t_views.
           lr_view                     type ref to        if_wd_rr_view.    
          lr_view_controller = wd_this->wd_get_api( ).
        lr_main_view_usage = lr_view_controller->GET_VIEW_USAGE( ).
       lr_t_views  = lr_main_view_usage->GET_VIEW_CNT_ASSIGNMENTS( ). "This will return all the View Container assignments.
    * Now loop over all the View containers and get the reference of embedding view.
       loop at lr_t_views  into lr_s_view .
          lr_vc_assignment = lr_s_view-VIEW_CNT_ASSIGNMENT.
          lr_view_usage  = lr_vc_assignment->GET_DEFAULT_VIEW_USAGE( ). " This will return view usage reference
          lr_view = lr_view_usage->get_view( ). " This will have the meta info of view
          wd_this->sub_view_name = lr_view->get_name( ).   
       endloop.
    Now in onAction submit,
    CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW(
                                  EXPORTING
                                   view_controller =  lr_view_controller " MAin view reference
    case wd_this->sub_view_name.
    when 'SUB_VIEW1'.
    CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW(
                                  EXPORTING
                                   view_controller = wd_comp_controller->gr_emb_view1.
    when 'SUB_VIEW2'.
    CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW(
                                  EXPORTING
                                   view_controller = wd_comp_controller->gr_emb_view2.
    Or, alternatively; create all the nodes(of sub views) in component controller, then map all those to MAIN view, then read the required node attributes and validate manually.
    hope this helps u,
    Regards,
    Kiran

  • Error while working with POP-IN object for Table UI

    Hi Expert,
    I am creating a pop-in for one column of table UI. I have a LinkToAction object to open pop-in. i have some lable and input fields in pop-in. I dont know the flow to display the pop-in and where should i assign data to pop-in fields. how system will know which row i am clicking? Please help to know all details. I have a lots of questions.
    I am able to create link on the column and when i am clicking on link i am getting below error.
    "Node VIEW_VAL.1.POP_IN does not contain any elements" but i have attributes in node POP-_N.
    Please help me.
    Thanks and Regards,
    Anil
    Details from ST22----
    An exception occurred which is explained in detail below.
    The exception, which is assigned to class 'CX_WDR_ADAPTER_EXCEPTION', was not
    caught and
    therefore caused a runtime error.
    The reason for the exception is:
    Adapterfehler im  INPUT_FIELD "INPUT_FIELD01" des Views
    "Z_BP_GENERAL.VIEW_VAL": Context-Bindung des Properties VALUE kann nicht
    aufgelöst werden: Node VIEW_VAL.1.POP_IN does not contain any elements
    The occurrence of the exception is closely related to the occurrence of
    a previous exception "CX_WD_CONTEXT", which was raised in the program
    "CL_WDR_CONTEXT_NODE===========CP",
    specifically in line 9 of the (include) program
    "CL_WDR_CONTEXT_NODE===========CM00R".
    The cause of the exception was:
    Node VIEW_VAL.1.POP_IN does not contain any elements

    hi,
    Use this code in OnAction of LinktoAction UI element.
    This code will give you index of the row from which Link to Action is Triggered.
    <cn_popin> is my node binded to Table.
    data: lr_element type ref to if_wd_context_element.
    DATA ls_cn_popin TYPE wd_this->element_cn_popin.
    lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).
    get all declared attributes
      lr_element->get_static_attributes(
        IMPORTING
          static_attributes = ls_cn_popin ).
    data lv type I.
    lv = lr_element->GET_INDEX( ).
    Finally you have the index in varialbe lv.

  • OnAction is going timeout - Interactive Adobe form in webdynpro

    Hi,
         I have developed an application with interactive adobe form whenever i click the onaction 'Submit' button it keeps on running and i kept a break point in WDDOBEFOREACTION but no use. the control is not at all coming inside.
    If make the form in invisible mode then every thing works fine it happens because of the form only.
    any idea?????
    regards,

    >
    roop s wrote:
    > Hi,
    >      I have developed an application with interactive adobe form whenever i click the onaction 'Submit' button it keeps on running and i kept a break point in WDDOBEFOREACTION but no use. the control is not at all coming inside.
    >
    > If make the form in invisible mode then every thing works fine it happens because of the form only.
    > any idea?????
    >
    >
    > regards,
    Hi,There can be many reason for that.
    what does it do onActionSubmit ?
    Have you seen in St22 any meaning full dump  if any in this case?

  • Word Crashing When Discarding Checkout for Document Stored in SharePoint

    We have recently noticed an issue when we have a Word file checked out from SharePoint, if we then discard the checkout from Word, Word crashes. The error details point to an issue in wwlib.dll.
    Having done some further investigation into this it appears this only happens if the document has an attached template which contains a custom ribbon.  We use SharePoint 2013 and Word 2010, although I have tested using Word 2013 with the same results.
    This was noticed on our company templates which contain a custom ribbon tab and a number of custom buttons. I have since tested it by creating a template with a single button on a custom tab with the same results.
    Has anyone else come across this issue and and is there any way to resolve it?
    Thanks,
    Richard

    Hi Daniel,
    Thanks for the response.
    The issue only happens when discarding checkout. Editing and saving a document back to SharePoint does not cause an issue. I am using a dotm template. I am not storing the template
    as a content type. When I say I created a custom tab, this was created by adding the XML to create the ribbon tab and button. I used the 'Custom UI Editor for Microsoft Office' to add this. The file created for this is called customUI14.xml and the
    XML is as follows (in the basic test template that I created):
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <ribbon startFromScratch="false">
    <tabs>
    <tab id="customTab" label="Custom Tab">
    <group id="customGroup" label="Custom Group">
    <button id="customButton" label="Test Ribbon Button" imageMso="HappyFace" size="large" onAction="TestRibbonCrash" />
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>
    The code this points to is as follows:
    Sub TestRibbonCrash(ByRef Ctrl As IRibbonControl)
        MsgBox "Ribbon button working"
    End Sub
    Following your reply I have tested it by adding a custom tab and button through the GUI and the problem doesn't occur when using that method of creating the tab and button.
    I will see if I can find anything useful in the ULS logs although no correlation ID is displayed when the error happens and in my experience even with a correlation ID, 99% of the time the ULS logs don't provide any useful information.
    I've also observed that Word doesn't crash if I discard checkout when I have another document open at the same time which is based on the same template.
    I have already posted on a MS Word forum. Is there more chance of getting some help on one of the other Word forums you have suggested?
    http://answers.microsoft.com/en-us/office/forum/office_2010-word/word-crashing-when-discarding-checkout-for/95565f9e-411b-4f11-b14d-d3771e2e2ba4
    Thanks,
    Richard

  • How to add event handler for outlook build in control through programmatically

    Hi,<o:p></o:p>
         There is requirement in my plug in where i need to intercept outlook native attach file method.If user attach more than specified
    exchange limit , i need to perform some operatoin. I found  that there is way to add "Onaction" method for built in control  like this " <command idMso="AttachFile" onAction="CatchExchangeWarning"/> ".
    I have to do the same thing via programmatically .I need to attach this event handler through programmatically since my add is not developed by xml file.
    <o:p>Thanks</o:p>

    Hello,
    It looks like you are interested in the
    BeforeAttachmentAdd event of Outlook items. It is fired before an attachment is added to an instance of the parent object. So, you can analyze the attachment object passed as a parameter and set then Cancel argument - set
    it to true to cancel the operation; otherwise, set to false to allow the Attachment to
    be added.
    Also the Outlook object model provides the
    AttachmentAdd event for Outlook items. It is fired when an attachment has been added to an instance of the parent object. You can also analyze the attachment object passed as a parameter to the event handler. You will not be able to
    cancel the action in that case.

Maybe you are looking for

  • Powermac g5 will not boot---hard disk appears not to mount

    tried resetting smu, nvram tried disk util---does not see drive(orig. 160 gb) tried new disk---not recognized either boots to OF ok i'm running out of patience and have no money to take it to apple would greatly appreciate any input/advice--thanks

  • How do I convert a PDF to Word file.

    How do I convert a scanned PDF document into a word document?

  • How do I delete pictures not in camera roll

    How do I delete pictures previously synced to icloud, but no longer in my camera roll? (I want to get a new phone and transfer only the pictures currently on my iphone 4S camera roll) I'd like to avoid having to delete all pictures I've taken when in

  • Having trouble finding a driver/utility for backlit keyboard

    I did a fresh install of Windows 7 and have come across a utility that I cannot find, its for the infrared sensors near the webcam that detects if you are near the computer and turns the backlit keyboard off if you are not sitting in front of it.

  • Website Security Certificate Error

    I am trying to get on Facebook, as I do everyday, but when I do I get a message stating that there is a problem with the websites security certificate. Then when I click continue anyways it takes me to an OpenDNS page and says that the domain is bloc