Tableview model

Hi guys...
I'm trying to show a TableView in HTMLB, but I get the following execption :
I debugged the JSPDynpage and I do get the data succesfully from the data base.
I think the problem is when the tableview tries to get the model. I am not sure, because I'm new to PAR development.
Could you please help me?
Thank you.
The Exception is :
Date : 06/08/2008
Time : 19:01:26:438
Message : null
[EXCEPTION]
java.lang.ClassCastException
     at com.sapportals.htmlb.table.DefaultTableViewModel.getValueAt(DefaultTableViewModel.java:186)
     at com.sapportals.htmlb.table.DefaultTableViewModel.getValueAt(DefaultTableViewModel.java:196)
     at com.sapportals.htmlb.table.TableColumn.getValueAt(TableColumn.java:478)
     at com.sapportals.htmlb.table.DefaultCellRenderer.renderCell(DefaultCellRenderer.java:275)
     at com.sapportals.htmlb.unifiedrendering.ie5.TableViewRenderer.renderTableViewCellFragment(TableViewRenderer.java:2504)
     at com.sapportals.htmlb.unifiedrendering.ie5.TableViewRenderer.renderTableViewRowFragment(TableViewRenderer.java:1792)
     at com.sapportals.htmlb.unifiedrendering.ie5.TableViewRenderer.renderTableViewFragment(TableViewRenderer.java:500)
     at com.sapportals.htmlb.unifiedrendering.ie5.TableViewRenderer.render(TableViewRenderer.java:99)
     at com.sapportals.htmlb.rendering.PageContext.render(PageContext.java:983)
     at com.sapportals.htmlb.taglib.TableViewTag.doEndTag(TableViewTag.java:139)
     at pagelet._sapportalsjsp_ReporteVisita.subDoContent(_sapportalsjsp_ReporteVisita.java:190)
     at pagelet._sapportalsjsp_ReporteVisita.doContent(_sapportalsjsp_ReporteVisita.java:40)
     at pagelet._sapportalsjsp_ReporteVisita.service(_sapportalsjsp_ReporteVisita.java:24)
My code is :
JSPDynPage
public static class JSPDynPageReporteVisitaDynPage extends JSPDynPage{
    public TablaReporteModel myBean = null;
    public void doInitialization(){
          Vector vectData = new Vector();
          Vector vectColumn = new Vector();
          try
             java.sql.Connection conn;
             com.indelpro.bd.SQLConnection sqlConn = new com.indelpro.bd.SQLConnection();
             conn = sqlConn.getConnection();
             BdReporteDeVisitaPorProducto bdReporteDeVisitaPorProducto = new BdReporteDeVisitaPorProducto(conn);
             vectData = bdReporteDeVisitaPorProducto.obtenerReporteDeVisitasPorProducto();
             conn.close();
             conn = null;
        catch (java.lang.SecurityException e)   {e.printStackTrace(); }
        catch (java.lang.NullPointerException e)  {e.printStackTrace();}
        catch (java.sql.SQLException e) { e.printStackTrace(); }
        catch (javax.naming.NamingException e)  {e.printStackTrace(); }                         
        catch (java.lang.ClassNotFoundException e) {      e.printStackTrace();       }
        catch (java.lang.IllegalAccessException e)  {e.printStackTrace();  }
        catch (java.lang.InstantiationException e)  {e.printStackTrace();        }
        catch (java.lang.Exception e)  {e.printStackTrace();        }
        IPortalComponentSession componentSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
       myBean = new TablaReporteModel(vectData);
        componentSession.putValue("myBean",myBean);
My JSP is :
<%@ taglib uri= "tagLib" prefix="hbj" %>
<jsp:useBean id="myBean" scope="session" class="bean.TablaReporteModel" />
</jsp:fallback>
<hbj:content id="myContext" >
  <hbj:page title="PageTitle">
   <hbj:form id="myFormId" >
<hbj:tableView
           id="myTableView1"
           model="myBean.model"
           design="ALTERNATING"
           headerVisible="true"
           footerVisible="true"
           fillUpEmptyRows="true"
           navigationMode="BYLINE"
           selectionMode="SINGLESELECT"
           headerText="Visitas a Productos"
           visibleFirstRow="1"
           visibleRowCount="20"
           rowCount="20"
           width="600 px"/>            
   </hbj:form>
  </hbj:page>
</hbj:content>
An the Bean class is :
public class TablaReporteModel  extends DefaultTableViewModel implements Serializable   {
     private DefaultTableViewModel  model;
        public TablaReporteModel()
             super();
             model = new DefaultTableViewModel();
          public TablaReporteModel(Vector vRepVisita)
               Vector colName = new Vector();
               Vector retVector = new Vector();
               colName.addElement("Usuario");ja
               colName.addElement("Familia");
               colName.addElement("Producto");
               colName.addElement("Visitas");
               Vector dataVect = null;
               ReporteDeVisitaPorProducto reporte = null;
               for (int i=0;i<vRepVisita.size();i++)
                     dataVect = new Vector();
                     reporte = new ReporteDeVisitaPorProducto((ReporteDeVisitaPorProducto) vRepVisita.elementAt(i));
                     dataVect.addElement(reporte.getCodUsuario());
                     dataVect.addElement(reporte.getCodTiProducto());
                     dataVect.addElement(reporte.getCodProducto());
                     dataVect.addElement(new Integer(reporte.getCanVisita()));
                     retVector.addElement(dataVect);     
               this.model = new DefaultTableViewModel (colName, retVector);
          public DefaultTableViewModel getModel()
             return this.model;

I solved it and report the bug for others:
In the constructor of the DefaultTableViewModel of the above example the data vector is the first argument and the column name vector the 2nd. This was turned around and the implementation tried to cast the Strings in the column name vector to Vectors for rows.
Hope this will be improved by a type safe API sometimes...
kind regards,
Achim

Similar Messages

  • Regarding tableView Model

    Hi,
       I've created a tableView model using HTMLB & populated d data in it using a bean.I've used checkbox for each row.
    What method shud be implemented to check if a row is selected & to get d details of the row??
    Any help would b appreciated.
    Thanks in Advance
    Message was edited by: Subathra Murugesan

    you cud do something like this:
    Say ur tableview is something like below,
    JSP:
         <hbj:tableView
              id="myTableView"
              model="myBean.model"
              design="STANDARD"
              headerVisible="true"
              footerVisible="true"
              fillUpEmptyRows="true"
              navigationMode="BYPAGE"
                 selectionMode="MULTISELECT"
              onNavigate="myOnNavigate"
              visibleFirstRow = "<%=myBean.getVisibleRow() %>"
              visibleRowCount="6"
              rowCount="10"
              width="500 px" >
              <%myTableView.useRowSelection(myBean.getOldTableView());%>
         </hbj:tableView>
    DynPage:
    public void useRowSelection(Event event) throws PageException{
    TableView table = (TableView) this.getComponentByName("myTableView");
         int firstVisibleRow = table.getVisibleFirstRow();
         int lastVisibleRow = table.getVisibleLastRow();
         StringBuffer strBuff = new StringBuffer();
    for (int i = firstVisibleRow; i <= lastVisibleRow; i++) {
         if (table.isRowSelected(i)) {
                <b>strBuff.append(i);</b>
       myBean.setSelectedRowString(strBuff.toString());
       myBean.setOldTableView(table);
    Bean:
         private String selectedRowString;
         public DefaultTableViewModel model;
         public TableView oldTableView;
         private String visibleRow = "1";
         public void setVisibleRow(String visibleRow){
              this.visibleRow = visibleRow;
         public String getVisibleRow(){
              return this.visibleRow;
    public void setSelectedRowString(String selectedRows) {
              this.selectedRowString = selectedRows;
         public String getSelectedRowString(){
              return this.selectedRowString;
         public TableView getOldTableView()
              return this.oldTableView;
         public void setOldTableView(TableView Table)
              this.oldTableView = Table;
    Highlited Line wud get all the rows u check on the table.
    You cud a button or link, clicking which cud display the rows you selected.
    <b>Plz don't forget points, if it helped</b>
    Regards.
    P.

  • Web Service as Web Dynpro tableView Model

    Hi people!
    I´ve developed a WebService with a findAllClients method which brings out all the rows from a MaxDB table. Everything works fine when I test it from de WebServices perspective, but when I create a model for my Web Dynpro tableView importing the mentioned WS, I get the following error message:
    The Java type of the cmp-field that is stored in column ID, table DB_CLIENTES does not fit to the JDBC type INTEGER of the column. The expected JDBC type is VARCHAR.
    I´ve set the built-in type of the column ID in my Java Dictionary project to integer. The corresponding CMP-Field in the entity EJB is java.lang.Integer. I´ve deleted the column from the tableView.
    What´s wrong? Any idea please? Where could I find some documentation about this mapping requirements topic?
    Thanks very much in advance.

    Is this the only way?
    Anyways, thanks a lot. I haven't been working with ODI yet, I just have to find out, if it is possible to use it for our project. So I just read through the user's guide...

  • Access deep structures from tableView model binding

    Hi,
    I have a problem with accessing a deep structure component from a tableView control.
    The structure is defined like this:
    structure project_data
        main_data type structure
        data_table1 type table
        data_table2 type table
    end structure
    The deep structure project_data is an attribute of my model class.
    When I have a table attribute, it can directly be accessed by using table="//model/table_data" in the tableView.
    What do I have to write in my table attribute to access the deep structure directly via model binding.
    table="//model/project_data.table_data" doesn't work, it throws a bsp exception.
    Thanks in advance!

    So there is no direct way of doing this?
    But why does it work for textEdits like this: value="//model/project_data.main_data-description"
    What would I have to do in the interface methods to get it work, or is it simpler to just add the elements of the deep structure directly to my model class?

  • Displaying a link in a tableView

    Hi,
    I am trying to display a link in column of a tableview in a jsp page.
    the source code is:
         public void initAttachmentsModel() {
              Vector colName = new Vector(2);          
              colName.addElement("File Name");
              colName.addElement("URL");
              attachmentsModel = new DefaultTableViewModel(attachmentsList, colName);
              TableColumn col = attachmentsModel.getColumn("URL");
              col.setType(TableColumnType.LINK);
              col.setEncode(false);
    But no link is displayed within the tableview.
    I also tried setUserTypeCellRenderer() and still no results.
    Message was edited by: Mark Finnern

    Hi Aviad,
    You can do this in two ways. Populate the value of all columns in Table Model.
    <u>I Way</u>: Set the column type as Link in TableView Model.
    <hbj:tableView  id="myTableView"
                    model= "myTableViewBean.model"
                    design = "ALTERNATING"
                    headerVisible = "true"
                    footerVisible = "true"
                    fillUpEmptyRows = "true"
                    selectionMode = "MULTISELECT"
                    navigationMode = "BYLINE"
                    headerText = "<h3>tableView</h3>"
                    visibleFirstRow = "1"
                    visibleRowCount = "4"
                    onNavigate="onNavigate" >
    <%
    myTableView.setColumnType(TableColumnType.LINK,column no);
    %>
      </hbj:tableView>
    <u>II Way</u> Set the column type as TableColumnType.USER and write the cell renderer.
    <%
    myTableView.setColumnType(TableColumnType.USER,column no);       
    myTableView.setUserTypeCellRenderer(new TableViewCellRenderer()); %>
    In Cell Renderer "TableViewCellRenderer.java"
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.rendering.IPageContext;
    import com.sapportals.htmlb.table.ICellRenderer;
    import com.sapportals.htmlb.table.TableView;
    public class TableViewCellRenderer implements ICellRenderer {
        public void renderCell(int row, int column, TableView tableView, IPageContext rendererContext) {
            if (column == 1) {
             Link mylink = new Link();
             String linkText = tableView.getValueAt(row, 
                               column).toString();
             mylink.addText(linkText);
         // Set the renderer
                ddlb.render(rendererContext);
    Hope this helps.
    Regards,
    Praveen
    PS. Dont foget to award points if it is useful/solved

  • BSP Tableview error when trying to bind an itab within an itab

    Hello dear forum members,
    I got a requirement to dynamically generate tableviews and bind them to a model's attribute (an itab 'model->gt_prd_grps' which holds the actual internal table to display as tableview 'model->gt_prd_grps-prods_table' within it). Below code would give you a correct picture.
    BSP View code:
    LOOP AT model->gt_prd_grps INTO ls_prd_grps.
            lv_idx = sy-tabix.
            CONCATENATE 'ProductsList_' ls_prd_grps-prod_group INTO lv_tableid.
            CONCATENATE '//model/' 'gt_prd_grps[' lv_idx '].prods_table' INTO lv_bind_str.
            CREATE OBJECT lr_tableview.
            lr_tableview->id            = lv_tableid.
            lr_tableview->headertext    = ls_prd_grps-prod_grp_desc.
            lr_tableview->_table        = lv_bind_str.
            lr_tableview->headerVisible = 'true'.
            lr_tableview->footerVisible = 'true'.
            lr_tableview->filter        = 'SERVER'.
            lr_tableview->design        = 'alternating'.
            lr_tableview->sort            = 'SERVER'.
            lr_tableview->fillUpEmptyRows = 'false'.
            lr_tableview->selectionMode   = 'NONE'.
            lr_tableview->iterator        = lo_prdctschtb_iter.
            lr_tableview->emptyTableText  = 'No Products available.'.
            tableview_str = lr_tableview->if_bsp_bee~render_to_string( page_context ).   %>
      <%    lv_col_count_default = 1. lv_row_count_default = lv_row_count_default + 1.   %>
      <htmlb:gridLayoutCell columnIndex = "<%= lv_col_count_default %>"
                            rowIndex    = "<%= lv_row_count_default %>"
                            colSpan     = "3" >
                            <%= tableview_str %>
    </htmlb:gridLayoutCell>
    <% ENDLOOP. %>
    I am encountering dump while trying to run the above BSP view and the error says "BSP exception: No structure component with the name "PRODS_TABLE[1].PRODUCT_ID" exists"
    Actually the user would select from the tableview via a 'select' column which would be rendered as checkbox and the MVC binding would greatly reduce the effort of manually transferring the user selections to the respective model table(s).
    Please suggest if the above way is possible and if so how to overcome the exception i am facing OR do i have to manually capture the tableview selection via CL_HTMLB_MANAGER=>GET_DATA.
    Huge thanks in advance,
    Ram

    Hi Raja,
    I am getting the dump as soon as the view is called. The tableview to be displayed is indeed the nested table only and the user can select the records via the 'checkbok' column in the tableview.
    Also, when i debugged, the dump occurs exactly at the below point:
    tableview_str = lr_tableview->if_bsp_bee~render_to_string( page_context ).
    Regards,
    Ram
    Edited by: Ram Mohan Venkatraman on Mar 11, 2010 12:12 PM

  • Tableview tag in htmlb visible controls

    hi gurus,
    i am trying to create a table view using the "tableView" tag presents in the htmlb visible controls.
    i am using the"help.sap.com" as reference website.i understood the details given there partially.so i couldnt complete my task.
    if anybody completed these type of task please send me ur sample code for reference with the codes for  jsp file,model (bean) and controller (.java file).....
    regards,
    tamil

    Hi,
    In JavaDeveloper role you have working examples of TableView.
    I am pasting the code, incase you dont have JavaDeveloper on your server.
    TableViewExample.java
    import bean.TableViewBean;
    import com.sapportals.htmlb.event.Event;
    import com.sapportals.htmlb.event.TableNavigationEvent;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.htmlb.table.TableView;
    import com.sapportals.portal.htmlb.page.JSPDynPage;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    import com.sapportals.portal.prt.component.IPortalComponentContext;
    import com.sapportals.portal.prt.component.IPortalComponentProfile;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    public class TableViewExample extends PageProcessorComponent {
      public DynPage getPage() {
        return new MyDynPage();
      // JSPDynPage
      public class MyDynPage extends JSPDynPage {
        public TableView table;
        TableViewBean myBean;
        Used for user initialization. called when the application is started
        public void doInitialization() {
          // Get the request, context and profile from portal platform
          IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
          IPortalComponentContext myContext = request.getComponentContext();
          IPortalComponentProfile myProfile = myContext.getProfile();
          // Initialization of bean
          TableViewBean myBean = new TableViewBean();
          setBeanFromProfile(myProfile, myBean);
          // Put the bean into the application context
          myContext.putValue("myBeanName", myBean);
      Used for handling the input. Generally called each time
        after doInitialization
        public void doProcessAfterInput() throws PageException {
          // Get the request, context and profile from portal platform
          IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
          IPortalComponentContext myContext = request.getComponentContext();
          IPortalComponentProfile myProfile = myContext.getProfile();
          // Get the bean from application context
          table = (TableView) this.getComponentByName("myTableView");
          myBean = (TableViewBean) myContext.getValue("myBeanName");
          setBeanFromProfile(myProfile, myBean);
          myBean.setOldTableView(table);
      Used for handling the output. This method is always called.
        public void doProcessBeforeOutput() throws PageException {
          // set the name of your JSP page
          setJspName("tableview.jsp");
        public void onMyOnNavigate(Event event) throws PageException {
          // NAVIGATION - get the event to recover the actual position
          TableNavigationEvent tne = (TableNavigationEvent) event;
          // With the event we can use method getFirstVisibleRowAfter(); which gives
          // us the actual position (after the event)
          if (myBean != null) { // just for the first time, when there is no bean
            // set the new visibleRow
            myBean.setVisibleFirstRow(new Integer(tne.getFirstVisibleRowAfter()).toString());
        public void onMyOnHeaderClick(Event event) throws PageException {
        public void onMyOnCellClick(Event event) throws PageException {
        public void onMyOnRowSelection(Event event) throws PageException {
        private void setBeanFromProfile(IPortalComponentProfile myProfile, TableViewBean myBean) {
          myBean.setDesign(myProfile.getProperty("design"));
          myBean.setHeaderVisible(myProfile.getProperty("headerVisible"));
          myBean.setFooterVisible(myProfile.getProperty("footerVisible"));
          myBean.setFillUpEmptyRows(myProfile.getProperty("fillUpEmptyRows"));
          myBean.setNavigationMode(myProfile.getProperty("navigationMode"));
          myBean.setSelectionMode(myProfile.getProperty("selectionMode"));
          myBean.setHeaderText(myProfile.getProperty("headerText"));
          myBean.setVisibleFirstRow(myProfile.getProperty("visibleFirstRow"));
          myBean.setVisibleRowCount(myProfile.getProperty("visibleRowCount"));
          myBean.setRowCount(myProfile.getProperty("rowCount"));
          myBean.setTableWidth(myProfile.getProperty("width"));
    D:\usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.pct.pdk.htmlbcontrols\pagelet\tableview.jsp
    <%--- TableView.jsp --%>
    <%@ taglib uri= "tagLib" prefix="hbj" %>
    <%--- Get the Bean named myBeanName from the application context --%>
    <jsp:useBean id="myBeanName" scope="application" class="bean.TableViewBean" />
    <hbj:content id="myContext" >
      <hbj:page title="Template for a portal component">
       <hbj:form id="myFormId">
        <hbj:tableView
                   id="myTableView"
                   model="myBeanName.model"
                   design="<%=myBeanName.getDesign() %>"
                   headerVisible="<%=myBeanName.isHeaderVisible() %>"
                   footerVisible="<%=myBeanName.isFooterVisible() %>"
                   fillUpEmptyRows="<%=myBeanName.isFillUpEmptyRows() %>"
                   navigationMode="<%=myBeanName.getNavigationMode() %>"
                   selectionMode="<%=myBeanName.getSelectionMode() %>"
                   headerText="<%=myBeanName.getHeaderText() %>"
                   visibleFirstRow="<%=myBeanName.getVisibleFirstRow() %>"
                   visibleRowCount="<%=myBeanName.getVisibleRowCount() %>"
                   rowCount="<%=myBeanName.getRowCount() %>"
                   width="<%=myBeanName.getTableWidth() %>"
                   onNavigate="myOnNavigate">
                   <% myTableView.setOnHeaderClick("myOnHeaderClick");
                      myTableView.setOnCellClick(1,"myOnCellClick");
                      myTableView.useRowSelection(myBeanName.getOldTableView());
                      myTableView.setOnRowSelection("myOnRowSelection"); %>
        </hbj:tableView>
        </hbj:form>
      </hbj:page>
    </hbj:content>
    TableViewBean.java
    package bean;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    import com.sapportals.htmlb.table.TableColumn;
    import com.sapportals.htmlb.table.TableView;
    // Bean for dataexchange between DynPage and JSP
    public class TableViewBean {
      public String design;
      public String headerVisible;
      public String footerVisible;
      public String fillUpEmptyRows;
      public String navigationMode;
      public String selectionMode;
      public String headerText;
      public String visibleFirstRow;
      public String visibleRowCount;
      public String rowCount;
      public String tableWidth;
      public DefaultTableViewModel model;
      private TableView oldtableview;
      public TableView getOldTableView() {
        return this.oldtableview;
      public void setOldTableView(TableView table) {
        this.oldtableview = table;
      public DefaultTableViewModel getModel() {
        return model;
      public void setModel(DefaultTableViewModel model) {
        this.model = model;
      public String getDesign() {
        return design;
      public void setDesign(String design) {
        this.design = design;
      public String isHeaderVisible() {
        return headerVisible;
      public void setHeaderVisible(String headerVisible) {
        this.headerVisible = headerVisible;
      public String isFooterVisible() {
        return footerVisible;
      public void setFooterVisible(String footerVisible) {
        this.footerVisible = footerVisible;
      public String isFillUpEmptyRows() {
        return fillUpEmptyRows;
      public void setFillUpEmptyRows(String fillUpEmptyRows) {
        this.fillUpEmptyRows = fillUpEmptyRows;
      public String getNavigationMode() {
        return navigationMode;
      public void setNavigationMode(String navigationMode) {
        this.navigationMode = navigationMode;
      public String getSelectionMode() {
        return selectionMode;
      public void setSelectionMode(String selectionMode) {
        this.selectionMode = selectionMode;
      public String getHeaderText() {
        return headerText;
      public void setHeaderText(String headerText) {
        this.headerText = headerText;
      public String getVisibleFirstRow() {
        return visibleFirstRow;
      public void setVisibleFirstRow(String visibleFirstRow) {
        this.visibleFirstRow = visibleFirstRow;
      public String getVisibleRowCount() {
        return visibleRowCount;
      public void setVisibleRowCount(String visibleRowCount) {
        this.visibleRowCount = visibleRowCount;
      public String getRowCount() {
        return rowCount;
      public void setRowCount(String rowCount) {
        this.rowCount = rowCount;
      public String getTableWidth() {
        return tableWidth;
      public void setTableWidth(String tableWidth) {
        this.tableWidth = tableWidth;
      public TableViewBean() {
        String[][] data = createData();
    // get a new array for the titles
        String[] colNames = {"LASTNAME", "FIRSTNAME", "STREET", "ZIP", "CITY"};
    // set titles
    /// By default the title also defines the column name - we use both methods to create a
    /// proper title and a column name that is better to work with. You should omit
    /// blanks or other special characters in the column name.
    /// The column name is important later (Part 2) to retrieve data from the tableView
        model = new DefaultTableViewModel(data, colNames);
        model.setKeyColumn(1);
        // To set the cell event we have to get the column and set the setOnCellClick
        // for every column.
        // Get the column with the specified column name.
        TableColumn column = model.getColumn("LASTNAME");
        // Set the event.
        column.setOnCellClick("onMyOnCellClick"); // set the TableCellClickEvent
        column.setTitle("Last Name");
        // Repeat that with the other column. Every cell can have its own onCellClick
        // method names of course. We use the same event method for all cells.
        column = model.getColumn("FIRSTNAME");
        column.setOnCellClick("onMyOnCellClick"); // set the TableCellClickEvent
        column.setTitle("First Name");
        column = model.getColumn("STREET");
        column.setOnCellClick("onMyOnCellClick"); // set the TableCellClickEvent
        column.setTitle("Street");
        column = model.getColumn("ZIP");
        column.setOnCellClick("onMyOnCellClick"); // set the TableCellClickEvent
        column.setTitle("ZIP - Code");
        column = model.getColumn("CITY");
        column.setOnCellClick("onMyOnCellClick"); // set the TableCellClickEvent
        column.setTitle("City");
      private String[][] createData() {
        // just a simple way to produce data, not real life indeed
        String[][] retVal = {
          {"Backer", "Melissa", "528 34th Ave", "94121", "San Francisco"},
          {"Hamilton", "Ann", "4752 17th St", "94117", "San Francisco"},
          {"Hudson", "Bree", "16 Hudson Ct", "94124", "San Francisco"},
          {"Watson", "David", "168 Cervantes Blvd", "94123", "San Francisco"},
          {"Eastwood", "Kenneth", "3367 Troy Dr", "90068", "Los Angeles"},
          {"Peter", "Smith", "524 Arvin St", "93308", "Bakersfield"},
          {"Antony", "Miller", "10430 Wilshire Blvd", "90024", "Los Angeles"},
          {"Moore", "Roger", "1815 W 82d", "90001", "Los Angeles"},
          {"Jackson", "Michael", "3450 Sawtelle Blvd", "90066", "Los Angeles"}
        return retVal;
    Greetings,
    Praveen Gudapati
    [Points are always welcome for helpful answers]

  • Deleting one row from a table view

    hi i have one tableview model. At the footer of this tableview there are 2 buttons add and delete. I want that when I press the delete button one row must be deleted. I have written one ondel event.I have to implement the logic inside that.Can anyone help me with the logic?

    Hey Sumana,
    Check the row of the table view u want to delete.Iterate through all the rows from the top of the Table View and copy it into another new array.While doing so, check whether the row is selected or not.If it is not selected,
    then copy the content into the new array and if it selected,skip that particular row and start copying from the next row.proceed till the end of the TableView.At the end initialize this new array to the model of the Table View.u have a Table View with the specified row deleted now.
    Anil

  • Web Dynpro and Oracle

    Greetings to all!
    We had been two weeks trying to develop a simple application with Web Dynpro that brings data from an Oracle database. We have defined a table in the Java Dictionary with such fields and names that in the data base. We have created a project J2EE with a EJB Entity with properties and methods for the fields of the table. For the tableView model in Web Dynpro we had to use a Java conventional Bean since it did not accept the EJB import directly. Also we have defined a system with the connection properties, user, password... of the Database. Everything seems to work fine, but sometimes we obtain the java.lang.NoClassDefFoundError exception:  com/sap/tc/webdynpro/progmodel/gci/IGCIComponentDelegate and the others just an empty tableView. Can somebody help us? It would be to us of much utility a simple project of this kind with all the properties, detailed references...
    Thank you very in advance.

    Hi Srikant,
    I have worked on similar stuff, but the scenario was a little different. I worked on creating Web Services using EJBs, but the basic part was that, the web service was supposed to interact with the SQL Server database. So maybe I can help you...
    First thing which is needed is that you have created the JDBC Connector in your Visual Administrator correctly. If you wish to cross check, you can see my answer in the following thread:
    JDBC error
    In this thread itself I have given the code which is the solution to your problem (this is what i believe). I am pasting the code again:
    <b>InitialContext initialContext = new InitialContext();
    DataSource dataSource = (DataSource)initialContext.lookup("jdbc/MyAlias");
    java.sql.Connection connection = dataSource.getConnection();</b>
    You can use this code in the method of your EJB, and then you can easily use this connection object to access your database tables using SQL queries.
    And if by any chance you are looking for a step wise procedure for creating a web service from an EJB, then give me your email address, i will send you the doc.
    Bye
    Ankur
    Do reward points if it helps!!

  • Cancel a submit in a javascript

    I have a tableview model which provides a list of order numbers.  I have made it so this column of order numbers is a clickable link.   I have set the table column to encode(false) so that my column shows up as an actual link.   
    Here is the actual contents of what the
    <a href="orderinfo" onClick"orderDetail(12345)>12345</a>
    In this way the order number (12345) shows up as a clickable link.  When I click on this link I call a javascript function: orderDetail which shows me some detail in formation in a NEW window. 
    window.open('/irj/servlet/prt/portal/prtroot/orderInfo.orderDetail?orderNumber=order_number','','scrollbars=1,resizable=1,width=400,height=600,left=300');
    Everything works fine except that the old window (which lists the order list) refreshes and asks the user to input the selection criteria again.  I want that screen to remain unchanged after I open the new window with the details.    Does anyone know what I can do to prevent my main iview window from going back to its initial state (being refreshed).  I know that if I had an HTMLB link I could possibly use htmlbevent.cancelSubmit=true;, however, my link is a regular html link.   
    Thanks
    Angie.

    Hi,
    Try this:
    a href="http://www.google.com/" target="_blank" onclick="window.open(this.href, '_blank',
    'width=500,height=400'); return false;"> Click Here
    /a>
    (or) put return false at the end of the window.open
    Regards,
    N.
    Message was edited by:
            Naveen Muthadi

  • Error : Array constants can only be used in initializers

    Hello All,
    I am using tableview model and declared two-dimensional array.
    Getting error Array constants can only be used in initializers in the line retVal<i>[j] =  {  {  createBy,desc,dispName }  };
    String[][] retVal;
    retVal = new String[20][20]
    //Fetching IResorce propeties here
    int resourceCounter = 0;
    for (int i = 0; i < list.size(); i++) {
       for (int j = 0; j < i; j++) {
          IResource ir = list.get(i);
          createBy = ir.getCreatedBy();
          desc = ir.getDescription();
            dispName = ir.getDisplayName();
         retVal<i>[j] =  {  {  createBy,desc,dispName }  };
         resourceCounter++;
    return retVal;
    Please help me out.
    Thanks
    Risha                              }

    I created ArrayList 
    static public String[] colnames =
                   "News Title",
                   "Short Description",
                   "Published",
                   "Valid To",
                   "Read Count",
                   "Users Details",
                   "Reply" };
         public ArrayList createData() {
               ArrayList rowArrList = new ArrayList();
              ArrayList tableArrList = new ArrayList();
              String createBy = null;
              String desc = null;
              String dispName = null;
              String lastMod = null;
              String name = null;
              String resType = null;
              try {
                   com.sapportals.portal.security.usermanagement.IUser user = null;
                   user = WPUMFactory.getUserFactory().getEP5User(request.getUser());
                   IResourceContext resourceContext = new ResourceContext(user);
                   String path = "/documents/Australia/News";
                   RID rid = RID.getRID(path);
                   com.sapportals.wcm.repository.IResource res =
                        ResourceFactory.getInstance().getResource(rid, resourceContext);
                   IProperty prop = null;
                   String propValue = null;
                   PropertyName propName = null;
                   if (res != null) {
                        if (res.isCollection()) {
                             ICollection collection = (ICollection) res;
                             IResourceList list = collection.getChildren();
                             int resourceCounter = 0;
                             for (int i = 0; i < list.size(); i++) {                              
    //                              for (int j = 0; j < i; j++) {
                                       IResource ir = list.get(i);
                                       createBy = ir.getCreatedBy();
                                       desc = ir.getDescription();
                                       dispName = ir.getDisplayName();
                                       lastMod = ir.getLastModifiedBy();
                                       name = ir.getName();
                                       resType = ir.getResourceType();
                                       rowArrList.add(createBy);
                                       rowArrList.add(desc);
                                       rowArrList.add(dispName);
                                       rowArrList.add(lastMod);
                                       rowArrList.add(name);
                                       rowArrList.add(resType);
                                       tableArrList.add(i,rowArrList);
                                  //}//Inside for loop
                             }//First for loop
                        }//Inside If
              } catch (ResourceException e) {
                   // TODO Auto-generated catch block
                   response.write("Error " + e.getMessage());
              } catch (UserManagementException ex) {
                   ex.printStackTrace();
                   response.write("Error " + ex.getMessage());
              return tableArrList;
          * Constructor.
         public TableViewBean() {
              ArrayList tabArr = createData();
              String[][] data = (String[][])tabArr.toArray();          
              model = new DefaultTableViewModel(data, colnames);
    Edited by: Risha on May 26, 2011 8:52 AM

  • Creating custom cell factories

    I can't quite figure out how to create a cell factory properly. In short, this is what I'm doing (for a Boolean column):
            existsInCustTable.setCellFactory(new Callback<TableColumn<Actor, Boolean>, TableCell<Actor, Boolean>>() {
                public TableCell<Actor, Boolean> call(TableColumn<Actor, Boolean> p) {
                    return new TableCell<Actor, Boolean>() {
                        @Override
                        public void updateItem(Boolean item, boolean empty) {
                            super.updateItem(item, empty);
                            System.out.println(item + ", " + empty);
                            if (item != null) setText(item.toString());
            });This should (from my understanding) just recreate the default implementation, but it doesn't: I get all blank fields even though there are data in the table, and it prints "null, true" for all items.
    What am I doing wrong?

    Well - I can't see all your code - but did you set the CellValueFactory? This is the beast that actualy propagates a "value" from your TableView model, when updated, to the updateItem method call....
    something like
    existsInCustTable.setCellValueFactory(
                    new PropertyValueFactory<Actor, Boolean>("MyBooleanPropertyName"));If this isn't it - please post all your code

  • DynPage

    Hi,
       I am connecting to r/3 thru portal component(DynPage).
    i am trying to get sales orders pertainiing to teh given customer and salesorg(hardcoded values). but i am getting a runtime exception. can any one tell me wts wrong with this code.
    package com.sap.armstrong.dynpage;
    import java.util.Vector;
    import javax.resource.cci.MappedRecord;
    import javax.resource.cci.RecordFactory;
    import com.sapportals.connector.connection.IConnection;
    import com.sapportals.connector.execution.functions.IInteraction;
    import com.sapportals.connector.execution.functions.IInteractionSpec;
    import com.sapportals.connector.execution.structures.IRecordSet;
    import com.sapportals.htmlb.Button;
    import com.sapportals.htmlb.Form;
    import com.sapportals.htmlb.GridLayout;
    import com.sapportals.htmlb.Group;
    import com.sapportals.htmlb.InputField;
    import com.sapportals.htmlb.TextView;
    import com.sapportals.htmlb.enum.CellHAlign;
    import com.sapportals.htmlb.enum.GroupDesign;
    import com.sapportals.htmlb.enum.TableSelectionMode;
    import com.sapportals.htmlb.enum.TextViewDesign;
    import com.sapportals.htmlb.event.Event;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    import com.sapportals.htmlb.table.TableView;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    import com.sapportals.portal.prt.component.IPortalComponentContext;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    public class test extends PageProcessorComponent {
      public DynPage getPage() {
        return new testDynPage();
      public static class testDynPage extends DynPage {
    Initialization code executed once per user.
        public final static String HELLO = "Hello User";
         private final static String PROPERTY_GROUPTITLE = "GroupTitle";
        private final static String PROPERTY_GROUPTOOLTIP = "GroupTooltip";
         private final static String INPUT_FIELD_KEY1 = "CUSTOMER_NUMBER";
         private final static String INPUT_FIELD_KEY2 = "SALES_ORG";  
         private final static int INITIAL_STATE = 0;
        private final static int WELCOME_STATE = 1;
         private int state = INITIAL_STATE;
         public String Cust;
         public String Org;
         IRecordSet orders1;
         TableViewBean myBean;
         String column_val;
         int clickedrow;
         int clickedcolumn;
         public Vector vec;
         public Vector col;
         public class TableViewBean {
                 public DefaultTableViewModel model;
                 public TableViewBean() {
                          Vector data = createData();
                          String[] colNames = {"<center><h5>LASTNAME</h5></center>", "SALESORDER", "SALESITEM", "MATERIAL", "MATERIALDESC"};
                          col.add(colNames);
                          model = new DefaultTableViewModel(vec , col);
                 private Vector createData() {
                   vec = new Vector(); 
                   String[] str={"orders1.getString(0)","orders1.getString(1)","orders1.getString(2)","orders1.getString(3)"
                   try{
                             while (orders1.next()){
                                  vec.add(str);
                        }catch (Exception ex){
                           return vec;
        public void doInitialization() {
              myBean = new TableViewBean();
              //state = INITIAL_STATE;
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentContext myContext = request.getComponentContext();
              myContext.putValue("myBeanName", myBean);
        public void doProcessAfterInput() throws PageException {
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentContext myContext = request.getComponentContext();
              myBean = (TableViewBean) myContext.getValue("myBeanName");
        public void doProcessBeforeOutput() throws PageException {
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentResponse response = (IPortalComponentResponse) this.getResponse(); 
             Form myForm = this.getForm(); // get the form from DynPage
              Group myGroup = new Group(); // create a Group component
               myGroup.setDesign(GroupDesign.SAPCOLOR);
              // myGroup.setWidth("300 px");
               TextView myText;
               GridLayout myGrid = new GridLayout();
               TextView label;
               myGroup.addComponent(myGrid);
               myForm.addComponent(myGroup);
              orders1 = this.callrfc(request, response);
               myForm.addComponent(myGroup);
             myGroup.setTitle("Table");
              TableView tv = new TableView("myTableView");
              tv.setModel(myBean.model);
              for (int i = 1;i <= tv.getRowCount(); i++)
               for (int j= 1; j <= tv.getColumnCount(); j++)
                 tv.setCellHAlignment(i,j,CellHAlign.CENTER);
              tv.setModel(myBean.model);
              tv.setSelectionMode(TableSelectionMode.SINGLESELECT);
              tv.getColumn(1).setEncode(false);
              tv.setOnRowSelection("onRowSelect");
              myGroup.addComponent(tv); 
      public IRecordSet callrfc(IPortalComponentRequest request, IPortalComponentResponse response){
           IConnection con = Util.getConnection(request, response);
           Object rs = execute(con, response);
           IRecordSet orders;
           orders = null;
           try {
                if (rs != null) {
                     if (rs instanceof IRecordSet) {
                          orders = (IRecordSet)rs;
                    //return orders;
                else
                     response.write("Bean has got a null value");
                }catch(Exception ex) {
                     response.write(ex.getMessage());
                }     return orders;                                         
      public Object execute(IConnection connection, IPortalComponentResponse response) {
          try{
                               IInteraction ix = connection.createInteractionEx();
                               IInteractionSpec ixspec = ix.getInteractionSpec();
                               String funcname = "BAPI_SALESORDER_GETLIST" ;
                               ixspec.setPropertyValue("Name", funcname);
                               String funcout = "SALES_ORDERS";
                               RecordFactory rf = ix.getRecordFactory();
                               MappedRecord input = rf.createMappedRecord("input");
                              input.put("CUSTOMER_NUMBER", "0000001175");
                              input.put("SALES_ORG", "1100");
                               //input.setRecordName("Org");
                              MappedRecord output = (MappedRecord) ix.execute(ixspec, input);
                              Object rs = null;
                              try {
                                   Object result = output.get(funcout);
                                   if (result == null) {
                                        rs = new String(" ");
                                   } else if (result instanceof IRecordSet) {
                                        rs = (IRecordSet) result;
                                   // result object returned
                                   else {
                                        rs = result.toString();
                                   response.write(rs.toString());
                              } catch (Exception ex) {
                                   response.write(ex.getMessage());
                              return rs;
                               //input.setRecordName(Cust);
                         }catch (Exception e) {
                         response.write(e.getMessage());
                         return null;
    regards,
    theja

    Hi,
    eventing in dynPage:
    doInitialization -> PBO -> <user CLICK> -> PAI -> on<CLICK> -> PBO -> <user CLICK> -> ...
    In my opinion the <b>orders1 == NULL</b> when trying to populate data for vector of the tableView model:
    try{
    while (orders1.next()){
    vec.add(str);
    }catch (Exception ex){
    ... I think you should call
    orders1 = this.callrfc(request, response);
    before
    myBean = new TableViewBean();
    hope this helps,
    Romano

  • Fill JCO.Table with Model from TableView

    Hi all,
    i need to fill a JCO.Table to save some data in a BAPI. I already have the data in form of a DefaulTableViewModel.
    Is there a simple way to fill the table with this data, or do I have to loop through the model and fill the table row by row?
    Kind regards
    Francisco

    Hi Francisco,
    there is no method which does it for you. I'm not that experienced in this field, but I think it seems hard to create the correct metadata from a HTMLB TableViewModel (for example the data field internal length as well as field types).
    Also have a look here: JCO.table creation...
    As you may have realized, the other way round - having a JCO.Table, creating a TableViewModel - works via HTMLB JCOTableViewModel.
    Hope it helps
    Detlev

  • Issue with tableview data storing

    Hi,
    We are using MVC model, it has view-model-main controller and sub controller. I am displaying
    4 columns on the tableview where 2 columns are editable. when i click update button on the screen
    i have called do_handle_event method on sub controller, when i debug the code i am getting
    table as initial always. I am not sure what am i missing here..can any one help me ?
    Here is code
    method DO_HANDLE_EVENT
    data: o_event    type ref to cl_htmlb_event,
          visible_row type int4,
          visible_last_row type int4,
          visrow_count type int4 value 10,
          it_osha like line of it_mfgprf_osha,
          wa_osha type zpp1_mfgprf_osha,
          o_app  type ref to zcl_mfg_perf.
    o_event = cl_htmlb_manager=>get_event( request ).
        if o_event is not initial.
            if o_event->id = 'osha_update'.
                  data: tv type ref to cl_htmlb_tableview.
                  tv ?= cl_htmlb_manager=>get_data(
                              request      = runtime->server->request
                              name         = 'tableView'
                              id           = 'it_osha_history' ).
                    if tv is not initial.
                    data: tv_data type ref to cl_htmlb_event_tableview.
                    tv_data = tv->data.
                if it_mfgprf_osha is not initial.
                    visible_row = tv_data->visiblefirstrowindex.
                    visible_last_row = visrow_count + visible_row - 1.
                    loop at it_mfgprf_osha into it_osha
                          from visible_row to visible_last_row.
                    it_osha-zosha_ytd = tv_data->get_cell_value(
                                row_index    = sy-tabix column_index = 3 ).
                     endloop.
               endif.
                   endif.
                 endif.
         endif.
    view
                  <htmlb:tableView id              = "it_osha_history"
                                   table           = "<%=o_app->it_mfgprf_osha%>"
                                   iterator        = "<%=o_cont->osha_iterator%>"
                                   headerText      = "OSHA History"
                                   headerVisible   = "True"
                                   sort            = "SERVER"
                                   onHeaderClick   = "sort"
                                   visibleRowCount = "10"
                                   width           = "100%"
                                   design          = "ALTERNATING"
                                   allRowsEditable = "<%=o_app->ALLOW_RECORD_EDIT%>" />
    Thanks!
    Lakshmikandh

    Hi Guys,
    Thanks for valuable suggestion. Let me give you over view of application. We have sub-controller
    for all views, one controller and one model for those sub controllers and views.
    Hi Sebastian,
    Are you suggesting to use new model for all table view iterator ?
    If i use iterator on that one model i can't use
    that for other table view iterator..right ?
    Hi raju,
    If i get all the values on 'do_handle_data' method in the controller class, can i use that
    for other table view iterator if i create a new table view iterator?  can i have some
    outline(example coding) of passing those values to sub controller ?
    Thanks in advance.
    Lakshmikandh

Maybe you are looking for

  • Ok so. . . . . i got my ipod to go into diagnostic mode and did some test .

    yea i got it in diagnostic mode finally but, im on the accessorize test and it says Please Plug FW lcd id : 2 fwrpwr : 0 what does that mean? what do i do? plz help.

  • Fm for finding methods and interface

    I had a FM for finding BADI names and classes for a trabnsaction by placing a bug pint on that FM... I missed it.....Can anybody help me if u know abt that FM.. Kesav

  • Blank figures appearing in Gross Profit %

    Forum, Within 8.8 when logging into the sales order scren as a particular user, if they click on the Gross Profit % icon the values appear as: ***** instead of actual numeric values. I presume as this is user specific it's down to authorisations. Upo

  • Online backup fail on a file

    i am trying to backup and got the initial backup just fine. subsequent backups, I have one file 102 MB that continues to fail and don't know why. how can I determine why a backup file fails?

  • X230 that thinks its a tablet.

    I just received my second non-tablet X230 after my first one didn't work out. The new one has Windows 8 Pro loaded on it and I noticed that many of the programs were optimized for a touch screen by default, I also had the touch keyboard button on the