Empty table & lead selection

Hi folks,
We are having a small problem with our new web dynpro application. Basically we have table, which is populated when the application is started. Under the table we have "detail area", and it shows more detailed information about the selected element in the table. This works basically without problems.
The problems appear when the table happens to be empty. In that situation we got a runtime error saying "Context binding for property VALUE of <attribute name> cannot be resolved: Node <context node> does not contain any elements".
We have also functionality to delete elements in the table, and this causes the same problem. Even if the table contains elements, but we delete those, then when the last element gets deleted, we got the runtime error.
How to handle this kind of situation? My guess is that the lead selection functionality is causing the problem. If the table is empty, no element can be set as selected.
The cardinality of the relevant context node is 0...n, and selection 0...1.
Regards,
Karri

Hi Niraja,
I am displaying data from 2 tables VBAK & VBAP. Depending up on the lead selection in VBAK am filling the data in VBAP. I can delete all the records from first table & still not end up in any error. I will try explain my procedure to you.
Below are the properties for my 2 context nodes:
VBAK:
Cardinality : 0..n
Selection  : 0..n
Initialization Lead Selection: Unchecked
Singleton:   No
VBAP:
Cardinality : 0..n
Selection  : 0..1
Initialization Lead Selection: Checked
Singleton:   Yes
Supply Function: SUPPLY_FETCH_VBAP_DATA
The 2 tables have the following properties set:
selectionChangeBehaviour : Auto
selectionMode: Auto
As you can see by default the leadSelection isn't set for the 1st table. But as soon as the user selects any record the leadSelection is set & the corresponding data is fetched into the 2nd table element.
METHOD supply_fetch_vbap_data .
  DATA: ls_vbak TYPE ig_componentcontroller=>element_vbak,
        lt_vbap TYPE ig_componentcontroller=>elements_vbap.
  CALL METHOD parent_element->get_static_attributes
    IMPORTING
      static_attributes = ls_vbak.
  SELECT * FROM vbap INTO TABLE lt_vbap WHERE vbeln = ls_vbak-vbeln.
  node->bind_table( new_items = lt_vbap ).
ENDMETHOD.
The user first enters a customer number & the corresponding orders are fetched from VBAK & bound to the first table. Below is the coding for the buttons action handler:
METHOD onactionfetch .
  DATA : wd_node   TYPE REF TO if_wd_context_node,
         it_vbak  TYPE ig_componentcontroller=>elements_vbak,
         lv_kunnr TYPE ig_componentcontroller=>element_vbak-kunnr.
  wd_node = wd_context->get_child_node( name = 'PARENT1' ).
  CALL METHOD wd_node->get_attribute
    EXPORTING
      name  = 'KUNNR'
    IMPORTING
      value = lv_kunnr.
  wd_node = wd_context->get_child_node( name = 'VBAK' ).
  SELECT * FROM vbak INTO TABLE it_vbak WHERE kunnr = lv_kunnr.
  IF sy-subrc EQ 0.
    wd_node->bind_table( new_items = it_vbak ).
  ELSE.
  ENDIF.
ENDMETHOD.
Regards,
Uday

Similar Messages

  • WD Java blackberry - problem with table lead selections

    hi everybody,
    i have a table which shows data from backend - works fine also on blackberry.
    when i change the selected line - lead selection - which works on the browser and shows other detail data below the table - on the blackberry it seem that this does not work.
    is thery any trick? to do this
    kind regards
    oliver

    Hi Oliver,
    I know this is a pretty old post but just wanted to know if you were able to find a solution to make this work?
    Thanks,
    MK

  • Bind Table / Lead Selection

    Is there a way to bind a table without changing the lead selection?  I know that I can read the lead selection before binding, and then set it after binding, but was wondering if there was a better way.

    As far as i know there is no such ready made method or api available. As you already pointed out , you need to do that with programmatic.

  • Table lead selection

    Hi Colleagues,
    Here is the problem with tables selection
    Depending upon the node size in the context i.e. if the nof elements is 4 i am displaying 4 tables in the output, where each table has three culms and one row containing test, text and Button elements
    on click of button i am triggering an action which should display some other attributes of the particular node element(i.e. filesize, filename,title etc)
    here my output has three tables where on click of the button in any table it is displaying the same element values
    *on action of the button i have coded this*
    public void onActionGetThesecuritydetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    String URL = wdContext.currentElementsElement().getURL();
    String Filename = wdContext.nodeElements().getCurrentElement().getAttributeAsText("fileName");
    but on click of buttons in the tables i am getting the same output (which should not be same)
    i think on click of button that particular tgable element needs to selected and this should be sent to the action and we have to get that element attributes
    could anyone help me how to achieve this?
    Thanks & Regards
    Swetha
    Edited by: Swetha Nellore on May 13, 2009 4:21 PM
    Edited by: Swetha Nellore on May 13, 2009 4:23 PM
    Edited by: Swetha Nellore on May 13, 2009 4:27 PM

    Hi,
    Thanks  a lot for all your replies.I have got a solution for this
    i.e i am passing parameters along with the action using
    mappingOfOnAction.setString()
    //Create column3
      IWDTableColumn column2 = (IWDTableColumn) view.createElement(IWDTableColumn.class, null);
      table.addColumn(column2);
      //Create 3rdst TableCellEditor and bind it to an attribute of the Elements node in the context
      IWDButton editor2 = (IWDButton) view.createElement(IWDButton.class, null);
    IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();     
      String lViewText = textAccessor.getText("install");
      editor2.setText(lViewText);               
      IWDAction thisAction  = view.getAction("GetThesecuritydetails");     
      IWDGridData celleditor2 = editor2.createLayoutData(IWDGridData.class);
    celleditor2.setVAlign(WDCellVAlign.MIDDLE);
      celleditor2.setPaddingTop("100px");                    
      editor2.setOnAction(thisAction);
      *editor2.mappingOfOnAction().setString("filename", element2.getFileName());*
       *editor2.mappingOfOnAction().setString("displayurl", element2.getURL());*
    *editor2.mappingOfOnAction().setString("token", element2.getURLLabel());*
      editor2.setVisible(IWDUIElement.DEFAULT_VISIBLE.VISIBLE);
    editor2.setEnabled(true);
      column2.setHAlign(WDTableColumnHAlign.CENTER);                    
    column2.setTableCellEditor(editor2);          
    column2.setWidth("20%");     
    So i am getting the exact element details on click of action and in the action i am able to get them without using any context related coding
    public void onActionGetThesecuritydetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String filename, java.lang.String token, java.lang.String displayurl )
        //@@begin onActionGetThesecuritydetails(ServerEvent)
           String file = filename;
            String finalurl = displayurl;
            String title = token;
    Thanks & Regards
    Swetha

  • How to get list of block identifiers in a empty table and an empty index

    We have an application that has issue with ITL waits: this application is running many INSERT statements on a table that has 2 NUMBER columns and one primary key index. The application is designed to run INSERT statements but they are never committed (this is a software package).
    To check what are the really allocated ITL slots, I know that I can dump data block but I don't know how to get the block identifiers/numbers for an "empty" table and an "empty" index. Does someone knows how to do that ?
    PS: I already had a look to the Metalink notes and I have a Metalink SR for that but maybe OTN forum is faster ?

    You should be able to find the first data/index block with the following, even on an empty table/index.
    select header_file, header_block +1
    from dba_segments
    where segment_name = '<index or table name>';

  • Problem with table cell editors - Dropdown by Index, getting lead selection

    Hi experts,
    I have a table editor with 5 columns
    1st column is a Drop Down byIndex.
    My contex looks like this
    AS_DATA(Parent Node cardinality 1.1, selection 0-1)
          HEADER (NODE)
          DETAILS(NODE cardinality 0..n, selection 0-1)
             ACTIVITY_TYPES (NODE cardinality 0..n selection 0-1 ) "node for drop down
             description - attribute
             unit
             quantity
    i have bound details node to table data source.
    i have a tool bar button 'Add Line item' which will add a new line item to the table.
    (i am adding a blank line to the table that is bound to table )
    Its working fine. but when ever i add more than one row, the selection made in the previous rows drop down is lost.
    its initializing. where could be the problem.
    My code
    data LO_ND_INV_TYPE type ref to IF_WD_CONTEXT_NODE.
      data LO_EL_INV_TYPE type ref to IF_WD_CONTEXT_ELEMENT.
      data LS_INV_TYPE type WD_THIS->ELEMENT_INV_TYPE.
      data LV_INV_TYPE type WD_THIS->ELEMENT_INV_TYPE-INV_TYPE.
      data LO_ND_DETAILS type ref to IF_WD_CONTEXT_NODE.
      data LT_DETAILS type WD_THIS->ELEMENTS_DETAILS.
      data LS_DETAILS like line of LT_DETAILS.
      data:  WD_NODE type ref to IF_WD_CONTEXT_NODE,
            LR_ELEMENT type ref to IF_WD_CONTEXT_ELEMENT.
      data LO_ND_INV_PATTERN type ref to IF_WD_CONTEXT_NODE.
      data LO_EL_INV_PATTERN type ref to IF_WD_CONTEXT_ELEMENT.
      data LS_INV_PATTERN type WD_THIS->ELEMENT_INV_PATTERN.
      data LV_INV_PAT type WD_THIS->ELEMENT_INV_PATTERN-INV_TYPE.
      data LO_ND_ACTIVITY_TYPES type ref to IF_WD_CONTEXT_NODE.
      data LT_ACTIVITY_TYPES type WD_THIS->ELEMENTS_ACTIVITY_TYPES.
      data LW_ACTIVITY_TYPES type WD_THIS->ELEMENT_ACTIVITY_TYPES.
        data LO_EL_ACTIVITY_TYPES type ref to IF_WD_CONTEXT_ELEMENT.
    *     navigate from <CONTEXT> to <DETAILS> via lead selection
        LO_ND_DETAILS = WD_CONTEXT->PATH_GET_NODE( PATH = `AS_DATA.DETAILS` ).
        LO_ND_DETAILS->GET_STATIC_ATTRIBUTES_TABLE(
          importing TABLE = LT_DETAILS ).
    * Append an empty row to lt_details
        append LS_DETAILS to LT_DETAILS.
        LO_ND_DETAILS->BIND_TABLE(
        NEW_ITEMS = LT_DETAILS ).
    * Get values for dropdown
    call method WD_ASSIST->GET_ACTIVITY_TYPE
          exporting
            I_INV_CAT_ID     = LV_INV_PAT
          importing
            ET_ACTIVITY_TYPE = LT_ACTIVITY_TYPES.
        LW_ACTIVITY_TYPES-ID = 'Select a Activity type'.
        LW_ACTIVITY_TYPES-TEXT = 'Select a Activity type'.
        insert LW_ACTIVITY_TYPES into LT_ACTIVITY_TYPES index 1.
        loop at LT_DETAILS into LS_DETAILS.
          LV_TABIX = SY-TABIX.
          LR_ELEMENT = LO_ND_DETAILS->GET_ELEMENT( LV_TABIX ).
          WD_NODE = LR_ELEMENT->GET_CHILD_NODE( 'ACTIVITY_TYPES' ).
    *lv_index = wd_node->get_lead_selection_index( ). " it is dumping at this statement when i try to get lead selection
          WD_NODE->BIND_TABLE( NEW_ITEMS =  LT_ACTIVITY_TYPES ). " data for dropdown
        endloop.
    any clue on what am i missing will be appreciated.
    I am getting dump when i try to get the lead selection
    Ajay

    You only have only one option in the DDI to display in the example. when you have multiple values
    i assume that by adding an empty row like this will lose the SELECTION MADE in DDI. (Correct me If i am wrong)
    somehow i believe that we need to bind the DD values using  SET LEAD SELECTION INDEX METHOD FOR THE DDI when they are already selected and trying to BIND.
    *LO_ND_DETAILS->GET_STATIC_ATTRIBUTES_TABLE(*
          *importing TABLE = LT_DETAILS ).*
    ** Append an empty row to lt_details*
        *append LS_DETAILS to LT_DETAILS.*
        *LO_ND_DETAILS->BIND_TABLE(*
        *NEW_ITEMS = LT_DETAILS ).*
    even though the above code will have the selected value, the SELECTIONS MADE will be initialize.
    you need to bind it explicitly.
    you have to create an element and bind the DDI values for adding an row as SARAVANAN said.
    or i guess you can continue with you code but need to use SET LEAD to display the correct SELECTIONS MADE
    loop at LT_DETAILS into LS_DETAILS.
          LV_TABIX = SY-TABIX.
          LR_ELEMENT = LO_ND_DETAILS->GET_ELEMENT( LV_TABIX ).
          WD_NODE = LR_ELEMENT->GET_CHILD_NODE( 'ACTIVITY_TYPES' ).
          WD_NODE->BIND_TABLE( NEW_ITEMS =  LT_ACTIVITY_TYPES ). " data for dropdown
    *" try to set the desired value in the DDI when you have multiple values using SET LEAD*
        endloop.

  • How to delete the record in the table without using lead selection?

    hi,
    I have added the separate column "delete" to the table uielement and so for each record or row of the table the appropriate "delete" link to action will be there................the code below works when the particular row is selected through lead selection only.......
    help me how to delete without using lead selection.....
      DATA:
      NODE_MODULE                         TYPE REF TO IF_WD_CONTEXT_NODE,
      ELEM_MODULE                         TYPE REF TO IF_WD_CONTEXT_ELEMENT,
      STRU_MODULE                         TYPE IF_V_MODULE=>ELEMENT_MODULE .
       data itab TYPE TABLE OF zac_modules.
      navigate from <CONTEXT> to <MODULE> via lead selection
      NODE_MODULE = WD_CONTEXT->GET_CHILD_NODE( NAME = `MODULE` ).
      get element via lead selection
      ELEM_MODULE = NODE_MODULE->GET_ELEMENT(  ).
      get all declared attributes
      ELEM_MODULE->GET_STATIC_ATTRIBUTES(
        IMPORTING
          STATIC_ATTRIBUTES = STRU_MODULE ).
    NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
        IMPORTING
         TABLE  = itab )
    DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id.
    CALL METHOD NODE_MODULE->BIND_TABLE
        EXPORTING
          NEW_ITEMS            = itab
       SET_INITIAL_ELEMENTS = ABAP_TRUE
       INDEX                =
    ENDMETHOD.

    Hi  ,
    The onclick event provides you with a standard paramater "CONTEXT_ELEMENT" which has the element from which the event is triggered.
    so you can declare this in the handler(if it is not there) and use it as follows.
    CONTEXT_ELEMENT  TYPE REF TO IF_WD_CONTEXT_ELEMENT  an importing paramater.
    DATA:
    NODE_MODULE TYPE REF TO IF_WD_CONTEXT_NODE,
    ELEM_MODULE TYPE REF TO IF_WD_CONTEXT_ELEMENT,
    STRU_MODULE TYPE IF_V_MODULE=>ELEMENT_MODULE .
    data itab TYPE TABLE OF zac_modules.
    CONTEXT_ELEMENT->GET_STATIC_ATTRIBUTES(
    IMPORTING
    STATIC_ATTRIBUTES = STRU_MODULE ). "Using the context_element paramater to get the static attributes.
    NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
    IMPORTING
    TABLE = itab )   "getting all the data.
    DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id. "deleting the particular row from the table and binding it.
    CALL METHOD NODE_MODULE->BIND_TABLE
    EXPORTING
    NEW_ITEMS = itab
    * SET_INITIAL_ELEMENTS = ABAP_TRUE
    * INDEX =
    thanks,
    Aditya.

  • Opening a new window on lead select in a table

    Hi,
      I want to open a window on Lead Select ...i have written the below code in the ActionLeadSelect
    ************************Begin Code******************************************************
    message.reportSuccess("came inside LeadSelect");
    IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow("www.yahoo.com","",false);
    message.reportSuccess("came 1");
    window.open();
    message.reportSuccess("came 2");
    ***************************end code********************************************************
    but On selecting a particular row in a table , window is not being opened..but the message I gave are displayed .Can u gimme  a solution
    Thanks,
    Shiny

    Hi, 
         It helped abijeet.Pop Up window is  opened.
    Now, I also tried opening another pop up window. I created a view called 'PopUp'. now.On selecting a row in the table I want to open this window(PopUp) .I tried the below code:
    IWDWindowInfo wInfo =wdComponentAPI.getComponentInfo().findInWindows("PopUp");
        IWDWindow window   =  wdComponentAPI.getWindowManager().createModalWindow(wInfo);
    message.reportSuccess("came 1");
    window.show();
    message.reportSuccess("came 2");
    window.setWindowPosition(WDWindowPos.CENTER);
    window.setWindowSize(100, 100);
    message.reportSuccess("came 3");
    I get the below  exception on executing:
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Parameter windowInfo must not be null.
    what else should i set. Can u gimme a solution??
    Thanks,
    Shiny

  • Index of the Table control - No lead selection activated

    Hi guys,
    I have a table control where there is no lead selection.... One colum of the table contains push button on all rows and I need to find the row id based on the click of the which row button... How to do this???
    regards,
    Prabhu

    Hi Prabhu ,
    write the below piece of code in the button Action .
    DATA lo_nd_node_table TYPE REF TO if_wd_context_node.
      DATA lo_el_node_table TYPE REF TO if_wd_context_element.
      DATA ls_node_table TYPE wd_this->Element_node_table.
    *   navigate from <CONTEXT> to <NODE_TABLE> via lead selection
      lo_nd_node_table = wd_context->get_child_node( name = wd_this->wdctx_node_table ).
      CALL METHOD wdevent->get_context_element
        EXPORTING
          name  = 'CONTEXT_ELEMENT'
        RECEIVING
          value = lo_el_node_table.  " getting the clicked line
      CALL METHOD lo_nd_node_table->SET_LEAD_SELECTION
        EXPORTING
          ELEMENT = lo_el_node_table.  " Setting the lead
      data lv_index type i.
      CALL METHOD lo_nd_node_table->GET_LEAD_SELECTION_INDEX
        RECEIVING
          INDEX = lv_index. " getting the index of the lead line
    Hope it will Helpfull .
    Regards
    Chinnaiya P
    Edited by: chinnaiya pandiyan on Jun 28, 2010 12:04 PM

  • Lead Selection to be disabled for some of the records in Table

    Hi ,
    I have 5 records in table .User shouldn't be allowed to select four rows thosse four rows should be in disable mode just for display purpose.Only one Row must be allowed to select(lead select).
    How can I Achieve above Functionality.
    Thanks & Regards
        Kiran

    Hi Kiran,
    Probably you might have tried the following.
    Bind OnLeadSelect event to some action.
    And in that action method write the code to fetch selected lead and check if it is 0(first row) else set leadselection to 0
    int selectedRow = wdContext.node<node name>().getLeadSelection();
    if(selectedRow!=0)
        wdContext.node<node name>().setLeadSelection(0);
    With this code the user can not select any of the rows other than first.
    If this is not what u require please let me know
    Regards,
    Santhosh

  • Unable to lead select the table

    Hi All ,
    i i have some requirement something like this i have three table side by side in a view when i select the row of the first table the data in the second table should be dislayed and similarly for the third table as well .
    Now my problem is when i am lead selecting the first table i a able to fetch the data and display but i am unable to lead select that rows in the table to display the lead selection i used Lead selection by Index then is is displaying properly BUT when i click on the second row or the third row or so...... It is not getting lead selected. I am Surprised i tried to check but did not found a single clue please help me with this.......
    Good Day....................
    Thanks and Regards,
    Sana.

    hi ,
    did u check the LeadSelect property of ur context node to which ur table is binded ?
    http://help.sap.com/saphelp_nw04s/helpdata/EN/79/555e3f71e41e26e10000000a114084/content.htm
    regards,
    amit

  • How to remove lead selection in table dynamically

    I have a table in webdynpro which allows multiple selections of row. I have a button which is supposed to be clicked after selecting single or multiple rows. After clicking on the button I want to remove the lead selection of the  selected rows (which is shown in golden color for each selected row) .
    I tried REMOVE_SELECTED ELEMENTS and it works fine but only if i select the row by pressing CTRL. If i had selected a single row by just a mouse click (without ctrl) then it wont work.
    THANKS

    Hallo Amber,
    If_wd_context_node has static attribute no_selection. use that to clear the lead_selection_index.
    node->set-lead_selection_index(  if_wd_context_node=>no_selection ).

  • Disable Lead selection for table row cloumn

    HI Team,
    I have table with multiple rows and multiple columns.
    Based on the lead selection of the row we are displaying the some form.
    But in table row there are some columns like enter date, when the user is trying to enter the date, it displaying the form because of lead selection and it is not allowing the user to enter the date.
    So, I want disable the lead selection for some columns.
    How can I do this?
    Regards,
    BAla

    Hi
    I think that you can get  the UI Table in the wdDoModifyView method, and then the UI Column and play with his values, is something like this:
    IWDTable table =(IWDTable)view.getElement( ");
    And then play with the "column" methods.
    Josué Cruz

  • The return value of sqlcode when select an empty table in a proc code

    Table: test
    there is an empty table. But when I use "select * from test" in a proc code, I found the return value of sqlca.sqlcode is 0, not 1403 (NO MORE DATA). Why ?

    EXEC SQL DECLARE individual_cursor CURSOR for
                   SELECT IATA_C, DELAY, UPDATE_TIME
                   FROM TBL_TIME
                   WHERE IATA_C <> '***' AND
                        FLAG = 1;
    EXEC SQL OPEN individual_cursor;
    while(1) {
    printf("in while");
         if (sqlca.sqlcode == 1403 && individual_flag == 0) {
    printf("no any data");
              return 1;
         } else if (sqlca.sqlcode == SQLNOMORE) {
              break;
         EXEC SQL FETCH individual_without_general_cursor INTO :pnrtime.airline, :pnrtime.delay, :pnrtime.update_time;
    EXEC SQL CLOSE individual_cursor;
    The result is:
    in while
    in while
    no any data
    Since the table is empty, why "in while" is printed twice? And "no any data" is printed in the end? I cannot decide the empty when using "select ... into" in proc unless using "select count(*) from test", right? Thx.

  • Table: show the line of lead selection

    Hello,
    I have a table with 691 lines, showing 20 lines per page. Is it possible to change the lead selection for example to line 60 and also jump to line 60. So that the table automatically shows the 3rd page with the line 60 - 80.
    I can change the lead selection with:
    node_trefferliste->set_lead_selection_index( index = 60 ).
    Lead selection is set correctly to 60 but the table still shows the lines 1- 20.
    best regards
    Stefan

    Hi Stefan,
    What ever you have done is correct. One thing you need to change is whenever you change the lead selection for you table you need to scroll ALV also. For that get the lead selected entry and set it as frst_visible_row for you ALV table. Please do this coding in the respective view controller method WDDOMODIFYVIEW(). so that you will get exact result what you are expecting.
    I hope i make you clear.
    Warm Regards,
    Vijay

Maybe you are looking for

  • IPhoto logo change & won't open

    The iPhoto icon in the Dock has changed from the 'palm tree sunset' to one resembling the Masonic logo  (pen, brush and ruler'). When I click on the new logo it bounces once and the application will not open.

  • Error in deploying EJB 2.0 on OracleAS 10.1.2

    Hi All, This issue is related to a customer issue. I am trying to deploy an ejb-web application developed using JDeveloper 10.1.3 on OracleAS 10.1.2. The deployment fails with following error: Deployment failed: Nested exception Resolution: Base Exce

  • Samsung TV-HDMI Cable Crackling noise during video play

    I have a Samsung Plasma 50inch. Just connected the HDMI cable and audio/video works great except when they're working at the same time. If I watch any movies/videos, there is a crackling noise coming from the speakers. (If I mute the TV, the cracklin

  • Mobile messaging from J2EE

    Hi All, I need to send an sms from my java application(J2EE--WebApplication).I am not aware how can we interface with mobile devices to send the sms.I know rather that interfacing with amobile device we need to interface with the service providers.Th

  • Firefox 3.6.15 Can not print entire web page

    When using the print icon or "print preview" I only get/see the first and last page of a web page, all pages in between are missing. Only time it prints correctly is when web page is 1 or 2 pages. Copying URL to IE and printing works fine. This used