Tableview Problem

Hi,
I am working with tableview. I have initialised
Model bean and trying to show the table. When
I run the iView, it throws error. I have confirmed
that data is being fetched from backend(see below which
I am showing for testing purpose). There is no error
when setting the bean vectors.
Here is the Error Message
Portal Runtime Error
An exception occurred while processing a request for :
iView : pcd:portal_content/HRDEV/Roles/HRTESTROLE/MSSPages/HR_Workset/Myassociates/MSSCOMPHIST2
Component Name : MSS_COMPHISTORY.MSSHeaderDynpage
5 >= 5.
Exception id: 01:35_11/08/05_0023
Printing retrived values from SAP
B - Business Intelligence|M3
B - Create & Deliver Soln - Plan & Orgnz|M3
B - Create & Deliver Soln - Problm Solvg|M3
B - Customer Orientation|M5
B - Customer Orientation|M3
B - Financial Responsibility|M6
B - Financial Responsibility|M3
B - General Profile|M3
B - Technical Expertis - Apply & Anticip|M3
B - Technical Expertis - Buildng & Maint|M3
Creativity|Yes
How ever, when I remove this block from the JSP page,
the error is gone.
       <hbj:tableView
         id="myTableView1"
         model="myBean.model"
         design="ALTERNATING"
         headerVisible="true"
         footerVisible="true"
         fillUpEmptyRows="true"
         navigationMode="BYLINE"
         selectionMode="MULTISELECT"
         headerText="TableView example 1"
         onNavigate="myOnNavigate"
         visibleFirstRow="1"
         visibleRowCount="30"
         width="500 px"
         />
can anyone tell me what could be the issue
Here is my Bean code
package com.wwy.mss;
import java.io.Serializable;
import java.util.Vector;
import com.sapportals.connector.execution.structures.IRecordSet;
import com.sapportals.htmlb.table.DefaultTableViewModel;
import com.sapportals.htmlb.table.TableViewModel;
  public class MSSCompHistoryBean implements Serializable {
     public DefaultTableViewModel model;
     public TableViewModel getModel() {
          return this.model;
     public void setModel(DefaultTableViewModel model) {
          this.model = model;
     public void createData(IRecordSet table) {
          Vector vColHeader = new Vector();
          vColHeader.addElement("Competency");
          vColHeader.addElement("Required for Current Position?");
          vColHeader.addElement("Proficiency");
          vColHeader.addElement("Valid From");
          vColHeader.addElement("Valid To");
          vColHeader.addElement("VENDD");
          Vector vTabData = new Vector();
          try {
            table.beforeFirst();
            while (table.next()) {
              Vector vRowData = new Vector();
               vRowData.addElement(table.getString("QUALIFICATION"));
               vRowData.addElement(table.getString("REQUIRED"));
               vRowData.addElement(table.getString("PROFICIENCY"));
               vRowData.addElement(table.getString("VBEGD"));
               vRowData.addElement(table.getString("VENDD"));                              
               vTabData.addElement(vRowData);
          } catch (Exception e) {
              e.printStackTrace();
           this.setModel(new DefaultTableViewModel(vTabData, vColHeader));
Here is my XML code
<?xml version="1.0" encoding="utf-8"?>
<application>
  <application-config>
  <property name="PrivateSharingReference" value="com.sap.portal.htmlb,com.sap.portal.ivs.connectorservice"/>   
  </application-config>
  <components>
    <component name="MSSHeaderDynpage">
      <component-config>
        <property name="ClassName" value="com.wwy.mss.MSSCompHistoryDynpage"/>
        <property name="SecurityZone" value="com.wwy.mss/low_safety"/>
      </component-config>
      <component-profile>
        <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
      </component-profile>     
    </component>
  </components>
  <services/>
</application>
regards
Sudheer

Hi Sudheer,
In method createData you define 6 columns in the header vector, and put only 5 values in each data row.
This may be the cause to the problem.
Hope that helps,
Yoav.

Similar Messages

  • Strange TableView problem when entering editing mode.

    I'm having a problem when entering editing mode in a tableview. What happens is the cell data from the section below is being displayed on top of the last cell in the current section.
    The narrower cell, with the plus sign on the left side, is briefly visible before (a copy of) the cell from below covers it up.
    Has anyone else seen this behavior? I'm really stumped here.
    More info, or how my table isn't standard: Each of the three sections is populated from a list. If the user has previously deleted one of the items from the section, only then is the plus sign shown. Otherwise, only the delete sign is shown. In other words, if there isn't anything to add, then the plus sign with the associated ...add a new X is not shown. This all works correctly. The counters work. The lists of previously deleted items are populated correctly.
    What doesn't work is the last row of the second section being covered by a copy (at full width) of the first row from the third section. The first and third sections both look correct. phew, I hope this makes sense.
    Here is what it looks like:
    Sizes
    - Size 1
    - Size 2
    + ..add a new Size
    Measurements
    - Measurement 1
    - Measurement 2
    Note 1 << this is the problem row
    Notes
    - Note 1
    - Note 2
    + ...add a new Note
    Thanks for any help you can provide.
    Ty

    OK, after more digging I answered my own question.
    The problem was the section order for added and deleting rows in setEditing. I was setting the indexPathForRow in section 2, then, 1, then 0. If I do the update in order 0, 1, then 2 it works fine in 2.0, 2.1, and 2.2.

  • Tableview problem when sort

    Hi all,
    We've implemented a tablewiew in MVC. The property sort is "SERVER". When a row of the tableview is selected an we try to sort the table, the selected row is lost.
    How we keep the selected row when we sort the tableview?
    Thanks in advance.

    Hi Mario
       What is happening in case you are sorting the table is it is refreshing the selectedrowindex.
       If you want the same index to remain selected, you can do one thing, just save the selectedrowindex in some variable before sorting and assign that variable to selectedrowindex after sorting. It will show that index as selected.
       If you want the same item to remain selected. i.e. let you have selected index 5 and after sorting the item of index 5 move to 2, And now you want the same item which is now on index 2 , to be selected. Than you need to store the key values of that item in some variable before sorting and after sorting Loop through the table to get the index of that item having same set of KEY VALUES.
    Now use that index to set the selectedrowindex value.
    This will make that item selected.........
    I think it will solve your problem, otherwise do revert back.........
    Have a nice time..
    Mithlesh

  • Tableview problem on firefox browser

    Hi,
    We faced with a problem while using firefox browser on linux client.
    The problem is browser cannot send selected item index into the BSP
    application in OnInputProcessing event, but we do not have any problem
    with IE7, on the same process. We are running on 6.20 with patch level
    58 on ABAP stack. Anyone faced with this problem?

    See this SAP note for information on browser support:
    <a href="https://service.sap.com/sap/support/notes/598860">Note 598860 - Browsers supported by BSP</a>
    Non-IE browser unfortunately do not support all functionality.
    Max

  • Applescript Studio TableView problem

    Does anyone know how to setup a Table View in the interface builder so it does not open open the item for editing when the user double clicks?
    I've setup a table view and I hooked it up to a double click handler but when I build and run the app and double click the table view the current line opens, like editing a file name in the Finder, instead of running my double click handler.
    Is there an Attribute to set with the Inspector to control this?
    thanks
    iMac G5 20   Mac OS X (10.4.2)  

    [Edit]
    Since you need multiple actions in your table view. A cool trick is to have a contextual menu in the table view. It's fairly simple to do:
    Create a menu item in your menu bar, call it "Actions"; add sub-items to it, call them "Action 1", "Action 2" ... So the menu item looks like:
    NSMenuItem (Actions)
    |
    NSMenu <-- this is when the menu item fully expanded, check the IB Inspector.
    |
    NSMenuItem (Action 1)
    NSMenuItem (Action 2)
    To connect the table view to the NSMenu, hold down control key and you can draw the mouse from table view to the menu.
    In the IB Inspector/Connections, select menu and click on the connect button.
    Voila you got CM in table view.

  • Changing cloros on row selection in itarotors in BSP HTMLB

    Hi all,
    I am new to BSP new technolgy.I have created a itrator table view with following code:-
    <htmlb:tableView id                    = "tv_idint"
                           table                 = "<%= it_error_data %>"
                           visibleRowCount       = "100"
                           selectionMode         = "MULTISELECT"
                           emptyTableText        = "No Data Found"
                           selectedRowIndexTable = "<%= selectedRowIndexTable %>"
                           width                 = "920"
                           sort                  = "SERVER"
                           iterator              = "<%= iterator %>" >
          </htmlb:tableView>
    Problem :- How i can add the feature that on row selection the color of selected row gets changed (get dark color).
    Thanks
    Bhagat Rajput

    hai bhagat,
          Review the following code and also set the onRowSelection attribute
    <htmlb:tableView id              = "tvX"
                           headerText      = "Connections"
                           headerVisible   = "true"
                           design          = "alternating"
                           visibleRowCount = "8"
                           fillUpEmptyRows = "true"
                           onHeaderClick   = "MyEventHeaderClick"
                           onRowSelection  = "MyEventRowSelection"
                           selectionMode   = "LINEEDIT"
                           keyColumn       = "carrid"
                           table           = "<%= sflight %>"
                           iterator        = "<%= tv_iterator %>" />
    Regards,
    Albin

  • Problem with iterator in tableview

    Hi, Im having a problem with an iterator in a tableview. Sometime ago I use an iterator in a BSP with flow logic, I created the class fill the methods GET_COLUMN_DEFINITIONS and RENDER_CELL_START. And worked fine.
    Now, Im working in another BSP and this time I wanted to use MVC, so I have been reading but cant figure it out what Im missing out.
    In the controller of my page I add the Interface IF_HTMLB_TABLEVIEW_ITERATOR
    I ridefine the methods GET_COLUMN_DEFINITIONS and RENDER_CELL_START (I think that you dont have to redifine GET_COLUMN_DEFINITIONS but did it anyway just in case).
    This is my RENDER_CELL_START
      IF NOT ( p_column_key = 'ICON' ).
        RETURN.
      ENDIF.
      FIELD-SYMBOLS: <row> TYPE ANY, <col> TYPE ANY.
      DATA: ti_results TYPE ZBSPREP_VEND_T,
                 wa_results TYPE ZBSPREP_VEND.
      ASSIGN p_row_data_ref->* TO <row>.
      ASSIGN COMPONENT p_column_key OF STRUCTURE <row> TO <col>.
      wa_results = <col>.
      DATA: html_bee TYPE REF TO CL_BSP_BEE_HTML.
      CREATE OBJECT html_bee.
      LOOP AT it_results INTO wa_results.
        icon = CL_BSP_MIMES=>SAP_ICON( id = 'ICON_GREEN_LIGHT' ).
      ENDLOOP.
      p_replacement_bee = CL_HTMLB_IMAGE=>FACTORY( id = p_cell_id src = icon ).
    In my table view the column ICON doesnt show anything and the rare part is if I put breakpoint in the method and execute the page doesnt stop.
    So I dont know if Im missing something.
    My tableview layout is this:
    <htmlb:tableView id             = "Monitor"
                                     selectionMode  = "SINGLESELECT"
                                     onRowSelection = "rowSelection"
                                     table          = "<%= it_results %>"
                                     iterator        = "<%= iterator  %>"
                                     design         = "ALTERNATING"
                                     filter         = "SERVER"
                                     sort           = "SERVER"
                                     headerVisible  = "FALSE"
                                     footerVisible  = "FALSE">
    I declare a attribute iterator TYPE IF_HTMLB_TABLEVIEW_ITERATOR.
    Someone could give a hand ?

    Solved, I forget to set the attribute of the view in the REQUEST Method.
    result_view->set_attribute( name = 'iterator' value = me ).

  • Problems loading text to xib using plist in tableview's selected cell

    I am developing an app that starts with a grouped tableview cell.  Each cell has an image, text, and description from a plist.  When a cell is chosen a xib is loaded by a view controller in the plist.  I want to load into the xib some text, an image, and a sound file that is in the plist (dict for that cell).  This way I don't have to have lots of view controllers and xibs.  I have been able to load the xib using this method but I can't get the images and text to load.  I have been able to do it when I don't have a grouped table view but when I add the grouping in the plist the connection is lost.  below is my code.  Could someone look at it and tell me where I've gone wrong, how to correct it, or another way to do what I want to do?
    I know I am not calling the right array and then dictionary but I don't know how to correct this.  Help please.
    //  RootViewController.h
    //  TableViewPush
    #import <UIKit/UIKit.h>
    @interface RootViewController :  UITableViewController <UITableViewDelegate, UITableViewDataSource>  {
    NSArray *tableDataSm;
    @property (nonatomic, retain) NSArray *tableDataSm;
    @end
    //  RootViewController.m
    //  TableViewPush
    #import "RootViewController.h"
    #import "Location One.h"
    #import "HowToUseViewController.h"
    #import "TableViewPushAppDelegate.h"
    @implementation RootViewController
    @synthesize tableDataSm;
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        const NSDictionary *const row = [self rowForIndexPath:indexPath];
        NSString *wantedClassName = [row objectForKey:@"controller"];
        UIViewController *const vc = [[NSClassFromString (wantedClassName) alloc] init];
        NSLog(@"controller is -%@-", wantedClassName);
        [self.navigationController pushViewController:vc animated:YES];
        TableViewPushAppDelegate *appDelegate = ( TableViewPushAppDelegate *)[[UIApplication sharedApplication]delegate];
        appDelegate.myImage = [[NSString alloc]initWithFormat:@"%@",[[tableDataSm objectAtIndex:indexPath.row]objectForKey:@"picture"]];
    NSLog(@"%@", appDelegate.myImage);
    appDelegate.textView = [[NSString alloc]initWithFormat:@"%@",[[tableDataSm objectAtIndex:indexPath.row]objectForKey:@"description"]];
        [vc release];
    //  TableViewPushAppDelegate.h
    //  TableViewPush
    #import <UIKit/UIKit.h>
    @class RootViewController, HowToUseViewController;
    @interface TableViewPushAppDelegate : UIViewController <UIApplicationDelegate>  {
        NSString *myImage;
        NSString *textView;
        UIWindow *window;
        UINavigationController *navigationController;
        HowToUseViewController *howToUseViewController;
    @property (nonatomic, retain) IBOutlet UIWindow *window;
    @property (nonatomic, retain) IBOutlet RootViewController *viewController;
    @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
    @property(retain,nonatomic)NSString *myImage;
    @property(retain,nonatomic)NSString *textView;
    @end
    //  TableViewPushAppDelegate.m
    //  TableViewPush
    #import "TableViewPushAppDelegate.h"
    #import "RootViewController.h"
    @implementation TableViewPushAppDelegate
    @synthesize window;
    @synthesize navigationController;
    @synthesize viewController;
    @synthesize myImage;
    @synthesize textView;
    //  Location One.h
    //  TableViewPush
    #import <UIKit/UIKit.h>
    #import "RootViewController.h"
    @interface   Location_One: UIViewController  {
        IBOutlet UIImageView *imageOne;
    IBOutlet UITextView  *textViewTwo;
    @property (nonatomic, retain) UITextView *textViewTwo;
    @property (nonatomic, retain) UIImageView *imageOne;
    @end
    //  Location One.m
    //  TableViewPush
    #import "Location One.h"
    #import "TableViewPushAppDelegate.h"
    @implementation Location_One
    @synthesize textViewTwo;
    @synthesize imageOne;
    -(id) init{
        if((self = [super initWithNibName:@"Location One" bundle:nil])){
        return self;
    - (void)viewDidLoad {
           NSLog(@"InView did load");
    [super viewDidLoad];
        TableViewPushAppDelegate *appDelegate = (TableViewPushAppDelegate *)[[UIApplication sharedApplication]delegate];
    textViewTwo.text = [[NSString alloc] initWithFormat:@"%@", appDelegate.textView];
    NSString *path = [[NSString alloc]initWithFormat:@"%@",appDelegate.myImage];
    UIImage *img = [UIImage imageNamed:path];
        [imageOne setImage:img];
    plist 
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
         <dict>
              <key>header</key>
              <string>85710</string>
              <key>rows</key>
              <array>
                   <dict>
                        <key>text</key>
                        <string>52 Glass Illusions Studio</string>
                        <key>detailText</key>
                        <string>150 S Camino Seco, #119</string>
                        <key>image</key>
                        <string>VisualFEight.png</string>
                        <key>controller</key>
                        <string>Location_One</string>
                        <key>picture</key>
                        <string>VisualOne.png</string>
                        <key>audio</key>
                        <string>AudioOne.mp3</string>
                        <key>description</key>
                        <string>TextOne</string>
                   </dict>

    I think you problem lies in this part.
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
        const NSDictionary *const row = [self rowForIndexPath:indexPath];
        NSString *wantedClassName = [row objectForKey:@"controller"];
        UIViewController *const vc = [[NSClassFromString (wantedClassName) alloc] init];
        NSLog(@"controller is -%@-", wantedClassName);
        [self.navigationController pushViewController:vc animated:YES];
        TableViewPushAppDelegate *appDelegate = ( TableViewPushAppDelegate *)[[UIApplication sharedApplication]delegate];
        appDelegate.myImage = [[NSString alloc]initWithFormat:@"%@",[[tableDataSmobjectAtIndex:indexPath.row]objectForKey:@"picture"]];
    NSLog(@"%@", appDelegate.myImage);
    appDelegate.textView = [[NSString alloc]initWithFormat:@"%@",[[tableDataSm objectAtIndex:indexPath.row]objectForKey:@"description"]];
        [vc release];
    specifically the underlined part.  does this need modifying or completely rewritten.

  • Problem with checkbox selection in Tableview

    Hi All
    I am using table view with 8 columns - in the last 4 columns i have checkboxes for user input - i have a strange problem - when the table has multiple entries - for the last column i can only select the checkbox on line 1 - and i cannot select the checkbox on the remaining entries below - but for the other colums with checkboxes this is not the case
    The selection mode for the table is no line selection - since the table is already displayed with input enabled fields - this is to reduce the no of clicks for user
    Can anyone point out what is going wrong - how can i fix this - what i am doing wrong ?
    Thanks
    Sen

    Hi
    When i click on the checkbox for the 2nd or 3rd rows of the last column - nothing happens - the checkox is still active but nothing happens -
    this is the tableview code
    <htmlb:tableView id              = "Detail"
                     design          = "ALTERNATING"
                     headerText      = "Header Text"
                     onNavigate      = "onMyNavigate"
                     emptyTableText  = "test"
                     onRowSelection  = "onMyRowSelection"
                     fillUpEmptyRows = "false"
                     footerVisible   = "true"
                     visibleRowCount = "5"
                     table           = "<%= DETAILTAB %>"
                     iterator        = "<%= iterator %>" >
    and this is the code for the last column
    <htmlb:tableViewColumn columnName         = "OBSOFLGICON"
                               width               = "3"
                               type                = "user"
                               horizontalAlignment = "CENTER"
                               title               = "Obs" >
          <htmlb:checkbox />
        </htmlb:tableViewColumn>
    Thanks
    Sen

  • Problem with tableview iterator

    Dear friends.
    I try to adopt tableview iterator in my customer's BSP pages. So, I programmed test page.
    METHOD if_htmlb_tableview_iterator~render_row_start .
      m_row_ref ?= p_row_data_ref.
    ENDMETHOD.
    M_ROW_REF is "Static Attribute" and "Public" and "Type Ref To Z3TYDISP"
    z3tydisp has structure as below
    REQNO          NUMC     12
    VGUBUN          CHAR     1
    DSCOFVGUBUN     STRING     0
    REQDT          DATS     8
    RNAME          CHAR     10
    VCOMP          CHAR     30
    VNAME          CHAR     10
    VPLACE          CHAR     5
    VPLACEDSC     CHAR     20
    APPROVAL     CHAR     1
    DSCOFAPPROVAL     STRING     0
    AND... p_row_data_ref has structure below
    REQNO     N     12
    VGUBUN     C     1
    DSCOFVGUBUN     g     0
    REQDT     D     8
    RNAME     C     10
    VCOMP     C     30
    VNAME     C     10
    VPLACE     C     5
    VPLACEDSC     C     20
    APPROVAL     C     1
    DSCOFAPPROVAL     g     0
    In my option, p_row_data_ref has same structure compared with z3tydisp. But there is "CX_SY_MOVE_CAST_ERROR". How I have to define "z3tydisp"????

    >><b>M_ROW_REF is "Static Attribute" and "Public" and "Type Ref To Z3TYDISP"</b>
    instead of this make your M_ROW_REF a instantaneous attribute. since static attribute are intantiated only once when object created and are shared by all other intances. m_row_ref contains data about the table you are going to render using tableview. so it should be public, so that get different data for different iterator objects.
    your p_row_data_ref must be of type ref to data which is superior class of data types.
    and if you have defined iterator "IF_HTMLB_TABLEVIEW_ITERATOR" in your interfaces. then you need not to define structure for p_row_data_ref, its already there in interface.
    hope this will solve your problem,
    regards,
    hemendra

  • Having problem with two Tableview controls.

    Hi all,
    I have two tableview controls in my page. TV1 has list of employees. TV2 is populated with details based on the employee selected in TV1.
    The actual problem is, in TV1 when i goto next page using navigator and select an employee in 15th row, and select a detail row from TV2, TV1 gets refreshed and goes back to row 1.
    How can i avoid this?
    Thanks & Regards,
    Lalith

    Hi,
    you can bind the attribute of the tableView selectedRow = "//model/selected_row"
    to an attribute in your model class
    that way you can always find your selection if working stateful
    grtz
    Koen

  • Problem on refreshing tableview's content

    Hi everyone!
    I'm developing a program using BSP and MVC based on tutorial_4_mvc.
    The program functions is basically insert, update and delete records on a transparent table using a tableview element.
    I defined tableview using the following parameters:
    <htmlb:tableView id              = "result"
                     design          = "ALTERNATING"
                     headerText      = "Header Text"
                     footerVisible   = "TRUE"
                     onRowSelection = "onRowSelection"
                     table           = "<%= t_dados_table %>"
                     visibleRowCount = "3" >
    For tableview collums, I used the following parameters:
      <htmlb:tableViewColumns>
        <htmlb:tableViewColumn columnName          = "APROGRUP"
                               width               = "100"
                               horizontalAlignment = "left"
                               title               = "Grupo de Aprovação de Programa"
                               type                = "input" >
        </htmlb:tableViewColumn>
        <htmlb:tableViewColumn columnName          = "DSCEN"
                               width               = "100"
                               horizontalAlignment = "left"
                               title               = "Descrição"
                               type                = "input" >
        </htmlb:tableViewColumn>
        <htmlb:tableViewColumn columnName          = "delete"
                               horizontalAlignment = "center"
                               title               = "Delete Item"
                               type                = "button"
                               onCellClick         = "delete" >
        </htmlb:tableViewColumn>
      </htmlb:tableViewColumns>
    The insert and update functions works just fine. So as the first time I search for a record and fill the tableview with the results. But the real problem is:
    The first time I fill the tableview, it works just fine! But when I try to search for a second code or when I have to delete a tableview's record I can't display the correct information.
    Example:
    1     1
    2     2
    3     3
    When I delete the "1   1" record on the tableview, it returns displaying:
    1    1
    2    2
    and seems like I've deleted the wrong record, but looking at the transparent table, the result is:
    2    2
    3    3
    This means that the logic for delete is correct and it's working no problem.
    BUT the tableview is displaying the wrong data.
    Anyone has been in a similar situation?

    Hi Hoffmann,
    my server cache is already set to "0". The browser cache has the same value. I tried to overwrite de value on this two fields and activate again, but the problem remains.
    There is any chance of this problem be a simple configuration mistake?
    When I change the type from "INPUT" to "TEXT" on the tableViewColumn property all the functions works just fine!
    But when I try to use the "INPUT" statement, the fields came with the old value, and the only way to update them is reloading the tableview element using an empty internal table and then reloading again with the filled internal table.
    For now, I'm using this way, but must be another way.

  • Problem while populating RFC table into HTMLB tableView control

    Hi, We are trying to populate some data from R/3 into the front end. For this we are using tableView control in HTMLB. But the problem is, one particular field is behaving strangely where as all other fields are displayed correctly. This value is sometimes displayed correctly and sometimes not. The FM if executed at the back end is giving correct result always. In Java there is a single line code i.e. table.getString("FIELD_NAME_IN_RFC");. Please guide us to find out the problem if somebody has already faced this before.

    Hi, We are trying to populate some data from R/3 into the front end. For this we are using tableView control in HTMLB. But the problem is, one particular field is behaving strangely where as all other fields are displayed correctly. This value is sometimes displayed correctly and sometimes not. The FM if executed at the back end is giving correct result always. In Java there is a single line code i.e. table.getString("FIELD_NAME_IN_RFC");. Please guide us to find out the problem if somebody has already faced this before.

  • JSP TableView Sorting Problem

    I have been trying to get a tableview to be sortable by clicking on the header of columns.  I have been reviewing existing threads on the forum in particular the one below.
    https://forums.sdn.sap.com/thread.jspa?threadID=16417
    I seem to understand the concept but for some reason my table does not sort, it just does nothing.  Could someone take a look and see if you can find any problems - I can't wait to give points.
    Here is all my code.
    Here is the Java....
    package MSSPackage;
    import MSSBeanPackage.PositionOverviewBean;
    import MSSPackage.SortTableModel;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    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;
    import com.sapportals.portal.prt.component.IPortalComponentSession;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.table.*;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    import javax.servlet.http.*;
    // SAP RFC Imports
    import com.sap.mw.jco.IFunctionTemplate;
    import com.sap.mw.jco.JCO;
    import com.sapportals.portal.prt.service.jco.IJCOClientPoolEntry;
    import com.sapportals.portal.prt.service.jco.IJCOClientService;
    import com.sapportals.portal.prt.runtime.PortalRuntime;
    import java.util.*;
    public class PositionOverview extends PageProcessorComponent {
      public DynPage getPage(){
         return new PositionOverviewDynPage();
      public static class PositionOverviewDynPage extends JSPDynPage{
         JCO.Repository mRepository;
         public JCO.Table tblRelations;
         public JCO.Table tblPositions;     
         public SortTableModel tableModel;
         public int visibleRow = 1;     
         private boolean OrgUnitSelected = false;
         public void doInitialization(){
              IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
              PositionOverviewBean oBean = new PositionOverviewBean();
              // Table Start row
              oBean.setvisibleRow(new Integer(this.visibleRow).toString());          
              oSession.putValue("myBean", oBean);
              // Define request, context and profile containers         
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentContext myContext = request.getComponentContext();
              IPortalComponentProfile myProfile = myContext.getProfile();
              // Define bean reference to bean
              PositionOverviewBean myBean = new PositionOverviewBean();
              // Table Start row
              myBean.setvisibleRow(new Integer(this.visibleRow).toString());
              // Place bean in user profile.          
              myProfile.putValue("myBean", myBean);
         public void doProcessAfterInput() throws PageException {
         public void doProcessBeforeOutput() throws PageException {
              String NavType = "RCORGUNIT";
              String OType = "O";
              //String OBjid = "10004399";
              String OBjid = "";
              String sapSystem = "SAP_R3_HumanResources";          
              IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
              PositionOverviewBean myBean = (PositionOverviewBean) oSession.getValue("myBean");
              // Define request, context and profile containers         
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
    /*          IPortalComponentContext myContext = request.getComponentContext();
              IPortalComponentProfile myProfile = myContext.getProfile();
              //HttpSession session = request.getServletRequest().getSession();          //dmm
              //Get Bean from Profile
              PositionOverviewBean myBean = (PositionOverviewBean) myProfile.getValue("myBean");
              //PositionOverviewBean myDataBean = (PositionOverviewBean) session.getValue("POviewBean");               //dmm
              String ddlbSelection = "";
              String ddlbValue = "";
              DropdownListBox ddlbOrgUnits = (DropdownListBox) getComponentByName("ddlbOrgUnits");
              if (ddlbOrgUnits != null)
                   ddlbSelection = ddlbOrgUnits.getSelection();
                   ddlbValue = ddlbOrgUnits.getValueAsDataType().getValueAsString();
                   OBjid = ddlbValue;
                   myBean.setObjId(OBjid);
              else
                   OBjid = "";
                   myBean.setObjId(OBjid);                 
              IJCOClientService clientService;
              IJCOClientPoolEntry poolEntry;          
              JCO.Client client;          
              try
                   clientService = (IJCOClientService) PortalRuntime.getRuntimeResources().getService(IJCOClientService.KEY);
                   poolEntry = clientService.getJCOClientPoolEntry(sapSystem, request);
                   client = poolEntry.getJCOClient();
                // connect to SAP system, logon
                   client.connect();
                // Create Jco Repository Object
                   mRepository = new JCO.Repository("R3USERMENU", client);
                // Reset function object
                   JCO.Function function = null;
                // Run RFC Module on SAP system
                   function = this.createFunction("HRWPC_GET_NAV_OBJECTS");
                   JCO.ParameterList input = function.getImportParameterList();
                   input.setValue("RCORGUNIT", "NAVTYPE");               
                   client.execute(function);
                   tblRelations = function.getTableParameterList().getTable("RESULT_OBJEC");
                   myBean.setRowcnt(tblRelations.getNumRows());
                   if (tblRelations.getNumRows() != 0)               
                        myBean.setOrgUnits(tblRelations);
                        if (ddlbOrgUnits == null)
                             // check to see if there is not a position id already assigned
                             tblRelations.setRow(0);
                             OBjid = tblRelations.getString("OBJID");
                             myBean.setObjId(OBjid);
                             //myBean.sTemp = OBjid;                         
                   // GET THE POSITION DETAILS
                   function = null;
                   input = null;
                   function = this.createFunction("Z_GET_POSITION_OVERVIEW");
                   input = function.getImportParameterList();               
                   input.setValue(NavType, "NAVTYPE");               
                   input.setValue(OType, "OTYPE");
                   input.setValue(OBjid, "OBJID");               
                   client.execute(function);
                   tblPositions = function.getTableParameterList().getTable("RESULT_OBJEC");
                   myBean.setRowcnt(tblPositions.getNumRows());
                   tableViewFormat();
                   tableModel.setTesting("Startxxxx");
                   myBean.settableModel(tableModel);
                   //tableModel.setTesting("SSSS");               
                   //myDataBean.settableModel(tableModel);                                             //dmm               
                   //session.setAttribute("POviewBean", myDataBean);                                //dmm
                   oSession.putValue("myBean", myBean);
              //Release pool entry
              poolEntry.release();                           
           catch(Exception ex)
                //name = ex.getMessage();                         
           //String sTest = "this is a test";      
           //request.getComponentSession().putValue("Test", sTest);
           //myProfile.putValue("Testx", sTest);
           this.setJspName("PositionOverviewJSP.jsp");
         public void getPositions()
              String NavType;
              String Root_Ot;
              String Root_ObjId;
         public void tableViewFormat()
              // Define the vectors used to build tableView
              Vector tempRec = new Vector();
              Vector dataRec = new Vector();
              String sDate = "";
              String sPosLink = "";
              String sPosVal = "";
              String sENameLink = "";
              String sENameVal = "";
              String sStatus = "";
              // Loop at company code list and add to vectors
              for (int i = 0; i < tblPositions.getNumRows(); i++)
                   tblPositions.setRow(i);
                   tempRec = new Vector();
                   sStatus = (String) tblPositions.getString("STATUS");
                   if (sStatus != null)
                        if (sStatus.equals("0"))                    
                             sDate = tblPositions.getString("ZHR_VACANT_BEGDA");
                             sDate = sDate.substring(5, 7) + "/" + sDate.substring(8, 10) + "/" +  sDate.substring(0, 4);                         
                        else
                             sDate = "";                    
                   sPosVal = tblPositions.getString("STEXT");
                   sENameVal = tblPositions.getString("ENAME");
                   if (sPosVal.equals(""))
                        sPosLink = sPosVal;
                   else
                        sPosLink = "<a HREF="myLink" onclick="return EPCM.doNavigate('ROLES://portal_content/com.sap.portal.migrated/ep_5.0/pages/com.sap.pct.hcm.positionprofile?CKey=000000" + tblPositions.getString("OBJID") + "', 1)">" + tblPositions.getString("STEXT") + "</a>";
                   if (sENameVal.equals(""))
                        sENameLink = sENameVal;
                   else
                        sENameLink = "<a HREF="myLink" onclick="return EPCM.doNavigate('ROLES://portal_content/com.phi/com.phi.mgt/com.phi.mss/com.phi.hr/com.phi.pages/com.phi.mgt.mss.hr.pages.positionholder?CKey=000000" + tblPositions.getString("OBJID") + "', 1)">" + tblPositions.getString("ENAME") + "</a>";
                   tempRec.addElement(sStatus);
                   tempRec.addElement(tblPositions.getString("OBJID"));
                   tempRec.addElement(sPosLink);
                   tempRec.addElement(sENameLink);
                   tempRec.addElement(sDate);               
                   dataRec.addElement(tempRec);
              // Then define the technical column names
              Vector colNames = new Vector();
              colNames.addElement("STATUS");
              colNames.addElement("OBJID");
              colNames.addElement("STEXT");     
              colNames.addElement("ENAME");
              colNames.addElement("ZHR_VACANT_BEGDA");
              // Now we build the actual tableView
              //tableModel = new DefaultTableViewModel(dataRec, colNames);
              tableModel = new SortTableModel(dataRec, colNames, 5);     
              // Define tableView parameters
              tableModel.setKeyColumn(2);
              TableColumn column = tableModel.getColumn("STATUS");
              column.setEncode(false);
              column.setType(com.sapportals.htmlb.enum.TableColumnType.USER);
              column.setTitle("Vacant");
              column = tableModel.getColumn("OBJID");
              column.setTitle("Position Number");
              column = tableModel.getColumn("STEXT");
              column.setTitle("Position");
              column = tableModel.getColumn("ENAME");
              column.setTitle("Holder of Position");          
              column = tableModel.getColumn("ZHR_VACANT_BEGDA");
              column.setTitle("Vacant as of");
         //     * Navigation Button Clicked
         public void myOnNavigate(Event event)
              TableNavigationEvent tne = (TableNavigationEvent) event;
              visibleRow = tne.getFirstVisibleRowAfter();
              // Define request, context and profile containers         
              IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
              IPortalComponentContext myContext = request.getComponentContext();
              IPortalComponentProfile myProfile = myContext.getProfile();
              // Get Bean from profile
              PositionOverviewBean myBean = (PositionOverviewBean) myProfile.getValue("myBean");
              // Table Start row
              myBean.setvisibleRow(new Integer(this.visibleRow).toString());
         public void onHeaderClick(Event event)
              IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
              PositionOverviewBean myBean = (PositionOverviewBean) oSession.getValue("myBean");
              TableHeaderClickEvent tne = (TableHeaderClickEvent) event; // get the event
              SortTableModel tblModel = myBean.gettableModel();
              //tblModel.sort();
              int col = 3;
              tblModel.sortByColumn(col);
              myBean.settableModel(tblModel);
              oSession.putValue("myBean", myBean);
         // Create Function object for RFC Calls
         public JCO.Function createFunction(String name) throws Exception
              try
                   IFunctionTemplate ft = mRepository.getFunctionTemplate(name.toUpperCase());
                   if (ft == null)
                        return null;
                   return ft.getFunction();
              catch (Exception ex)
                   ex.printStackTrace();
                   throw new Exception("Problem retrieving JCO.Function object");
         public void onSelectddlbOrgUnits(Event event) throws PageException
              OrgUnitSelected = true;          
    Here is the JSP
    <%@ page import="com.sap.mw.jco.*" %>
    <%@ page import="com.sapportals.htmlb.enum.*" %>
    <%@ page import="MSSPackage.TableViewCellRenderer" %>
    <%@ page import="com.sapportals.portal.prt.component.IPortalComponentRequest" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="com.sapportals.portal.prt.component.IPortalComponentContext" %>
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <hbj:content id="myContext" >
         <hbj:page title="PageTitle">
              <hbj:form id="myFormId" >  
              <jsp:useBean id="myBean" scope="session" class="MSSBeanPackage.PositionOverviewBean" />     
                   <hbj:gridLayout rowSize="1" columnSize="1" cellSpacing="1">
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="1">
                             <hbj:textView id="ddlbLable" text="Select organizational unit to display positions" design="STANDARD" />
                        </hbj:gridLayoutCell>                         
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="2">
                             <hbj:dropdownListBox id="ddlbOrgUnits" onSelect="onSelectddlbOrgUnits" selection="<%=myBean.getObjId()%>">                                                       
                                  <%                         
                                       JCO.Table org_units = null;                                                       
                                       org_units = myBean.getOrgUnits();
                                       for (int i = 0; i < org_units.getNumRows(); i++)
                                            org_units.setRow(i);
                                            String sUnit = org_units.getString("STEXT");
                                            String Unit_Id = org_units.getString("OBJID");
                                  %>
                                  <hbj:listBoxItem key="<%=Unit_Id%>" value="<%=sUnit%>" />
                                  <%
                                  %>
                             </hbj:dropdownListBox>                                                                                                   
                        </hbj:gridLayoutCell>
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="3">
                             <hbj:textView id="listLable" text="To designate a vacant position, click the icon in the 'Create Form' column" design="STANDARD" />                    
                        </hbj:gridLayoutCell>                    
                        <hbj:gridLayoutCell columnIndex="1" rowIndex="4">     
                             <hbj:tableView
                                  id="myTableView"
                                  headerVisible="true"
                                  footerVisible="true"
                                  fillUpEmptyRows="true"
                                  selectionMode="NONE"                              
                                  navigationMode="BYPAGE"
                                  onNavigate="myOnNavigate"                                        
                                  visibleFirstRow="<%= myBean.getvisibleRow() %>"                                                  
                                  visibleRowCount="5" >                                                            
                                  <%
                                  myTableView.setOnHeaderClick("onHeaderClick");
                                  myTableView.setUserTypeCellRenderer(new TableViewCellRenderer());                                                             
                                  myTableView.setModel(myBean.gettableModel());
                                  myTableView.setColumnType(TableColumnType.LINK, 3);
                                  myTableView.setColumnType(TableColumnType.LINK, 4);                              
                                  %>
                             </hbj:tableView>
                        </hbj:gridLayoutCell>                                        
                   </hbj:gridLayout>   
              </hbj:form>
         </hbj:page>
    </hbj:content>
    Here is the BEAN
    package MSSBeanPackage;
    //import com.sapportals.htmlb.enum.TableColumnType;
    import MSSPackage.SortTableModel;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    //import com.sapportals.htmlb.table.TableColumn;
    //import com.sapportals.htmlb.table.TableView;
    //import com.sapportals.htmlb.table.TableViewModel;
    import com.sap.mw.jco.JCO;
    import com.sap.mw.jco.JCO.Table;
    public class PositionOverviewBean {
    //     public DefaultTableViewModel tableModel;
         public SortTableModel tableModel;
         public JCO.Table OrgUnits;
         public String ObjId;
         public String visibleRow;
         public int rowcnt;
         public String sTemp;
         // Get and Set methods for table model
    //     public DefaultTableViewModel gettableModel() { return tableModel; }
    //     public void settableModel(DefaultTableViewModel tableModel)     { this.tableModel = tableModel;     }
         public SortTableModel gettableModel() { return tableModel; }
         public void settableModel(SortTableModel IntableModel)     { this.tableModel = IntableModel;     }     
         public JCO.Table getOrgUnits()     { return OrgUnits; }
         public void setOrgUnits(JCO.Table value) { this.OrgUnits = value; }
         // Get and Set methods for visiblerow
         public String getvisibleRow() {     return visibleRow; }
         public void setvisibleRow(String visibleRow) { this.visibleRow = visibleRow; }     
         public int getRowcnt() { return this.rowcnt; }
         public void setRowcnt(int rowcnt) { this.rowcnt = rowcnt; }
         public String getObjId() { return this.ObjId; }
         public void setObjId(String value) { this.ObjId = value; }     
    Here is the sorting class
    package MSSPackage;
    import java.util.Collections;
    import java.util.Comparator;
    import java.util.Vector;
    import com.sapportals.htmlb.table.DefaultTableViewModel;
    public class SortTableModel extends DefaultTableViewModel implements Comparator {
         //protected int currCol;
         public int currCol;
         protected Vector ascendCol; // this vector stores the state (ascending or descending) of each column
         protected Integer one = new Integer(1);
         protected Integer minusOne = new Integer(-1);
         public String testing;
         public SortTableModel()
              super();
              ascendCol = new Vector();
         public SortTableModel(Vector vec)
              super(vec);
              ascendCol = new Vector();
         public SortTableModel(Vector vec, Vector vec2, int numberOfColumns)
              super(vec, vec2);
              ascendCol = new Vector();
              setSortOrder(numberOfColumns);
         public int compare (Object v1, Object v2)
              // the comparison is between 2 vectors, each representing a row
              // the comparison is done between 2 objects from the different rows that are in the column that is being sorted
              int ascending = ((Integer)ascendCol.get(currCol)).intValue();
              if (v1 == null && v2 == null)
                   return 0;
              else if (v2 == null)
              { // Define null less than everything.
                   return 1 * ascending;
              else if (v1 == null)
                   return -1 * ascending;
              Object o1 = ((Vector)v1).get(currCol);
              Object o2 = ((Vector)v2).get(currCol);
              // If both values are null, return 0.
              if (o1 == null && o2 == null)
                   return 0;
              else if (o2 == null)
              { // Define null less than everything.
                   return 1 * ascending;
              else if (o1 == null)
                   return -1 * ascending;
              if (o1 instanceof Number && o2 instanceof Number)
                   Number n1 = (Number)o1;
                   double d1 = n1.doubleValue();
                   Number n2 = (Number)o2;
                   double d2 = n2.doubleValue();
                   if (d1 == d2)
                        return 0;
                   else if (d1 > d2)
                        return 1 * ascending;
                   else {
                        return -1 * ascending;
              else if (o1 instanceof Boolean && o2 instanceof Boolean)
                   Boolean bool1 = (Boolean)o1;
                   boolean b1 = bool1.booleanValue();
                   Boolean bool2 = (Boolean)o2;
                   boolean b2 = bool2.booleanValue();
                   if (b1 == b2)
                        return 0;
                   else if (b1)
                        return 1 * ascending;
                   else
                        return -1 * ascending;
              else
                   // default case
                   if (o1 instanceof Comparable && o2 instanceof Comparable)
                        Comparable c1 = (Comparable)o1;
                        Comparable c2 = (Comparable)o2; // superflous cast, no need for it!
                        try
                             return c1.compareTo(c2) * ascending;
                        catch (ClassCastException cce)
                        // forget it... we'll deal with them like 2 normal objects below.
                   String s1 = o1.toString();
                   String s2 = o2.toString();
                   return s1.compareTo(s2) * ascending;
         * This method sorts the rows using Java's Collections class.
         * After sorting, it changes the state of the column -
         * if the column was ascending, its new state is descending, and vice versa.
         public void sort()
              Collections.sort(dataVector, this);          
              //Collections.sort(dataVector);
              Integer val = (Integer)ascendCol.get(currCol);
              ascendCol.remove(currCol);
              if (val.equals(one)) // change the state of the column
                   ascendCol.add(currCol, minusOne);
              else
                   ascendCol.add(currCol, one);
         public void sortByColumn(int column)
              this.currCol = column;
              sort();
         public void setSortOrder(int numberOfColumns)
              for (int i = 0; i < numberOfColumns; i++)
                   ascendCol.add(one);
         public void setTesting(String inStr)
              testing = inStr;
    Any help would be greatly apprciated and rewarded...

    Hi Don,
    be aware that after the method onHeaderClick(Event event) is executed the method doProcessBeforeOutput() is executed as well.
    I look over your code and found the following:
    1) In method onHeaderClick you sort the table model and store the table model in the bean
    2) In method doProcessBeforeOutput() you create a new table model from scratch (in helper method tableViewFormat())and store it in the bean. Thus you overwrite the sorted model.
    I suggest that you move the initial creation of the table model in method doInitialization(). Do not forget to store the created table in the bean. In method doProcessBeforeOutput() you retrieve the table model from the bean instead of creating a new one for every request.
    Best regards,
    Martin

  • Problem in showing blank records in tableview.

    Hi All,
    The requirement is to show a tableview which is completely(contains no data in any cell) blank. The user enters data as free text.
    I managed to create an internal table with blank records and using it for the tableview so that the table view shows blank cells , where user can punch data.
    I need to do some validations if the cell is initial(user have not enterd any data and press the button)
    Now the problem is that , all cells conatin a SPACE (dont have an idea where it is coming from) and thus cells are not INITIAL.
    I tried using condense and replace all occurences of cl_abap_char_utilities=>cr_lf , but the space is not removed.
    Any one having any idea , why this space is coming or how INITIALIZE the work area.
    Regards,
    Anubhav

    Hi Vijay,
    The code is written in
    RENDER_CELL_START
    Code snipet:
    DATA: o_ip_desc TYPE REF TO cl_htmlb_inputfield,
                o_fr TYPE REF TO cl_bsp_find_and_replace,
                o_bee  TYPE REF TO cl_bsp_bee_table.
    DATA: find TYPE string.
      DATA: replace TYPE string.
    WHEN 'SLA_DESC' .
            CLEAR replace.
            CLEAR find.
            replace = `value=""` .
            find = `value=" "`  .  <---& n b s p(is displayed as space here)
            replace = replace.
            o_fr = cl_bsp_find_and_replace=>factory( find = find
                                                                      replace = replace
                                                                      mode =  `FIRST_OCCURRENCE` ).
            o_ip_desc = cl_htmlb_inputfield=>factory( id = p_cell_id
                                                      maxlength = '6'
                                                          size = '6'
            o_ip_desc->value = m_row_psc_main_ser->sla_desc.
            CREATE OBJECT o_bee.
            o_bee->add( level = 1 element = o_fr ).
            o_bee->add( level = 2 element = o_ip_desc ).
            p_replacement_bee = o_bee.
    Regards,
    Anubhav

Maybe you are looking for

  • Every time I log onto firefox it comes up in dutch. This also affects everything as it is all in dutch...why? I am english!

    For the last couple of weeks every time I log onto firefox it is in Dutch. Someone is accessing my facebook account from Amsterdam and that also appears in Dutch. Hopefully that one has been resolved but it is a big worry. I did nothing to change my

  • Internal table population

    Here in this code the internal table it_mseg and it_mbew are not being populated in the following code.Can anybody please tell me what the reason. Thanks and regards jyoti SELECT mblnr          bwart          matnr          INTO TABLE it_mseg        

  • Where to find setup.exe for BO XI 3.1 Downloaded products

    Hi, I am trying to download and install BO XI 3.1 to evaluate changes required to migrate from BO 6.5.1 but am not sure if I have downloaded the correct or all the files. I have downloaded the following files for Installing Business Objects XI 3.1 as

  • Change how timestamp displayed on Grid

    Hi folks, Whenever I run a select can I get Oracle to show my date fields as a timestamp? I dont want to have to cast the column every time and was wondering if there was in built setting that will show the time portion of the date also. Thank You fo

  • Changing the sleep screen saver?

    I'm guessing this is a stupid question, but I'm hoping I'm just missing something. Is there any way to change it so that when the backlight goes off and the screen goes to "sleep" that it doesn't goto the battery icon and clock? It doesn't make any s