Skip to Content
author's profile photo Former Member
Former Member

Iterator in TableView

Hello,

I've seen topics about iterators many times, but couldn't find any thread for starting using an iterator.

I have a BSP whith a tabStrip and a tableView on one of them. I would like to make those lines editable (so I use selectionMode = "LINEEDIT") and to keep the values entered by the user in order to use them in further processing. Actually LINEEDIT is not even the right solution for me as I'd like to make only some cells in the row editable. I guess I should use an iterator but i couldn't get any results by applying possibilities I've found here or in the docs... I just couldn't reach my breakpoint in IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.

So I've created a Z_class_iterator, having all the necessary attributes, overwritten method RENDER_CELL_START and I declared iterator type ref to z_class_iterator in my layout. Is there something I'm missing?

N.B. I'm using Pages with flow logic, not MVC

Thanks!

Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 24, 2006 at 10:42 AM

    HI Branko Jovanovic

    For starting using an iterator.

    Just go through Weblog:

    -


    /people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators

    Other

    /people/sap.user72/blog/2004/08/27/bsp-howto-tableview-iterator--column-header-graphics

    /people/thomas.jung3/blog/2005/07/18/bsp-extension-for-downloading-a-table-applying-an-iterator

    /people/sap.user72/blog/2005/05/05/bsphowto-filter-using-dropdown-in-tableview

    If still stuck somewhere, revert back.

    Cheers,

    Vijay Raheja

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      do you have in :

      DO_INIT:

      CREATE OBJECT me->iterator

      EXPORTING model = o_model.

      DO_REQUEST:

      o_view->set_attribute( name = 'iterator' value = iterator ).

      controller attributes: iterator type ref to Z_ITERATORCLASS

      in your view:

      attributes:

      iterator type ref to Z_ITERATORCLASS

      source:

      <htmlb:tableView id = "table_id"

      selectionMode = "none"

      sort = "server"

      tableLayout = "fixed"

      table = "<%= lt_content %>"

      width = "100%"

      design = "standard"

      iterator = "<%= iterator %>" />

      also make sure you don't use the same iterator name when

      using more than one in the same (general)view.

      grtz

      Koen

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2006 at 09:23 PM

    Branko,

    Which class you have implemented the interface IF_HTMLB_TABLEVIEW_ITERATOR ?

    Is that on controller class ( ZCL_GET_CELL ) or separate iterator class ( zcl_jovanbr_iterator ) ? If you have implemented on zcl_jovanbr_iterator class,

    then you donot required to add interface IF_HTMLB_TABLEVIEW_ITERATOR methods (GET_COLUMN_DEFINITIONS,RENDER_ROW_START,RENDER_CELL_START)on controller

    class ( ZCL_GET_CELL ). Please give us some more details.

    Thanks!

    Lakshmikandh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Branko,

      I hope you have different class for iterator and controller class. Is that right ? Or you have both on one class called ZCL_JOVANBR_ITERATOR ?

      I have implemented the iterator on following method,

      I have a separate class for controller and iterator class.

      Let's take your class and attribute name as example,

      On your getcell.do controller you might have class called ZCL_JOVANBR_CONTROLLER(Make sure this should be inherited from superclass of CL_BSP_CONTROLLER2), If so, please add your ITERATOR attribute to ZCL_JOVANBR_CONTROLLER class and that should refer to IF_HTMLB_TABLEVIEW_ITERATOR. On DO_INIT method of ZCL_JOVANBR_CONTROLLER class,you should instantiate as follow,

      CREATE OBJECT Iterator type <b>ZCL_JOVANBR_ITERATOR</b>.

      On your view, you should be using ITERATOR on table view iterator attribute. Please try this way and let me know if you have issue.

      Thanks!

      Lakshmikandh

  • author's profile photo Former Member
    Former Member
    Posted on Aug 01, 2006 at 01:35 PM

    Hey,

    Well I've created a <b>separate class for my iterator</b> ZCL_JOVANBR_ITERATOR. Then in my ZCL_GET_CELL (control) class I declared an attribute iterator type ref to ZCL_JOVANBR_ITERATOR. Object iterator is created in DO_INIT: CREATE OBJECT iterator TYPE zcl_jovanbr_iterator.

    So far so good. Now I've set a breakpoint in my ZCL_JOVANBR_ITERATOR's method IF_HTMLB_TABLEVIEW_ITERATORRENDER_CELL_START which <b>never get reached</b>. I also tried for test sake to make a constructor in ZCL_JOVANBR_ITERATOR just to see if the breakpoint is reached there - and it is. I also don't see the effect of my IF_HTMLB_TABLEVIEW_ITERATORRENDER_CELL_STAR method on the table view (the effect should be - one column's title should be replaced by an icon).....

    ? ? ?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Branko,

      Try to do following changes and test it,

      On your controller class ZCL_GET_CELL ,

      change iterator type from

      iterator type ref to ZCL_JOVANBR_ITERATOR

      To

      <b>Iterator type ref to IF_HTMLB_TABLEVIEW_ITERATOR</b>

      On controller class of DO_INIT method should create object of zcl_jovanbr_iterator

      <b>CREATE OBJECT iterator TYPE zcl_jovanbr_iterator.</b>

      On your view, you should refere the controller class attribute,

      <b>iterator = <%=controller_ref->iterator%></b>

      Please set the break point on tableview and debug to verify either it's calling the iterator to load the data or not.

      Thanks!

      Lakshmikandh