Reading bsp-variable data in iterator
I'm a junior developer and currently have a problem I can't solve....
I also couldn't find a solution by searching the forums here.
The situation so far:
I have a tableview in a bsp site.
Now I have to implement a functionality to insert new data to the database using
a new empty row in the tableview and saving that after several checks.
That works so far....
but, the problem is, that this should also work for filtered tableviews...
So I catch the filtervalues via the method get_row_filter_value and insert them in the
empty row - so it's visible even if the table is filtered.
I also implemented that.
Now the issue I can't solve is that when modifying a selected row,
not every field should be editable for the user.
But a new empty row should be editable in more fields.
I use the IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START
to check for empty fields and make them editable if they are,
assuming that this is a new row that should be editable then.
But, if I have to bypass the tableview filter, and insert the filtervalue by default,
the row isn't empty any more, and the fields won't be set editable.
I wanted to use a page attribute to mark a creation_mode,
but I can't access it in the iterator??
How can I achieve to get values of variables of the bsp in the iterator??
Hope you can help me somehow and understand my issue...
Edited by: Marcus Brandstetter on Sep 11, 2008 6:34 PM
Tanguy PARES replied
Welcome to SDN!
You can use the constructor method of your iterator to pass any ABAP variable to you iterator. For example, let's assume you have a page attribute called F_CREATION in your BSP page. When creating your iterator instance, use the following:
<% DATA: lo_iter TYPE REF TO z_your_iterator_class_name. CREATE OBJECT lo_iter EXPORTING vi_creation = me->f_creation. %>
In your Iterator class, create an instance attribute called m_creation, and a constructor method with importing parameter vi_creation. In this constructor, put the following code:
me->m_creation = vi_creation.
Now the iterator attribute m_creation is available in render_cell_start method, and has the same value as the BSP F_CREATION attribute when the iterator is created.