Dropdownlistbox in iterator (mvc)
hi,
in my bsp i display a table via mvc iterator.
in the attributes of the iterator tab i have defined <b>m_row_ref as type ref of the table displayed</b>.
i have created as well a new field that i display in a dropdownlistbox.
this new field <b>does not belong to the table displayed</b>.
the question is:
<u>do i have to add this new field to the table so that m_row_ref contains it?</u>
<u>or is there another way to know which value of the dropdownlistbox has been selected?</u>.
Best regards.
Hi,
In the Attribute of the Iterator decalre a table which hold the key and the value.
Example
LT_SEQ_NO Instance Attribute Public Type CRMT_PRT_MAP
Populate the this table where ever you feel comfortable. I would declare constructor method of the iterator and populate it there.
go to method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START
METHOD IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START .
DATA: lo_text TYPE REF TO cl_htmlb_textview,
lo_ddlb TYPE REF TO cl_htmlb_dropdownlistbox.
FIELD-SYMBOLS: <dat> TYPE ANY.
row_ref = p_row_data_ref.
CASE p_column_key.
WHEN 'SORT_NUM'.
CREATE OBJECT lo_ddlb.
GET REFERENCE OF lt_seq_no INTO lo_ddlb->table.
lo_ddlb->id = p_cell_id.
lo_ddlb->nameofkeycolumn = 'ENTRY_KEY'.
lo_ddlb->nameofvaluecolumn = 'ENTRY_VALUE'.
lo_ddlb->selection = get_column_value( p_column_key ).
p_replacement_bee = lo_ddlb.
WHEN OTHERS.
CREATE OBJECT lo_text.
lo_text->id = p_cell_id.
lo_text->wrapping = 'FALSE'.
lo_text->text = get_column_value( p_column_key ).
lo_text->design = 'STANDARD'.
p_replacement_bee = lo_text.
ENDCASE.
ENDMETHOD.
Modify the method as per your need.
Amandeep
<b><i>Do reward points for each usefule answer</i>.</b>
Similar Messages
-
Hello,
we have 2 dropdownlistboxes in a MVC based BSP Applikation. Depending the selection of the first dropdownlistbox, we want to set the attribute "disabled" of the second dropdownlistbox, so the user cannot select anymore from the second dropdownlistbox.
If we switch back the selection of the first dropdownlistbox the user should be able again to select values from the second one.
it works fine the first time we call the page, but not when we change the selection.
any help is greatly appreciated.
thx and regards from MichaelHi Mike,
glad to help.
The issue with binding to the model is that the user interaction forces a HTTP request back to the server whereas the client-side scripting technique does not.
IMHO the server callback diminishes the user experience.
Cheers
Graham Robbo -
TableView: ITERATOR in MVC
Using the MVC design pattern, ITERATOR methods (e.g. IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START) can be implemented in the Controller, in the Model or in a seprated class.
I give my vote to the CONTROLLER...
And you, which is the best place where to implement it?
SergioHi Sergio,
it depends on what exactly you want to do in your methods.
For pure tableview rendering problems I would recommend leaving it in the iterator.
I try to keep my application's methods well structured and always in the class they do belong most to - thinking about placing iterator methods somewhere else is something I have not thought of before, and I don't think I will do so anytime ...
Using the controller as you suggested ... not so appropriate imo, as a controller was introduced to separate display and application code, and the iterator is used to change display/rendering of a tableview.
Max -
Regarding instantiation of Iterator Class BSP MVC
Hi Friends,
I am trying out the MVC based BSP application using tableview iterator. I read the blog by Brain and went through the forums and tried to implement in MVC pattern. wrt to Iterator part I did the following things...
1. I created a ZClass and implemented IF_HTMLB_TABLEVIEW_ITERATOR Interface
2. I created a variable in Controller Attributes TV_ITERATOR type ref to Zclass (Interface implemented)
3. In the layout I have used the iterator attribute of Tableview assiging to TV_ITERATOR.
4. I have defined the method Column_definitions....
and in Do Handle Event I created a object for iterator "Create object tv_iterator".( i created a separate class for interface and thought would instantiate in Controller Class)
I am not getting the desired output. Hope I am clear with this....
I am just a beginer in BSP so sorry if its a silly question...
ThanksHi Mark,
Thanks for your reply. I tried that in DO_INIT and in DO_REQUEST as well. I started of this application well with the values selecting from Dropdown and then rendering the table columns. But now I have commented everything and just trying to render one column of the table....
I have one concern.
I have declared like this
tv_iterator type ref to ZITERATOR.
and in DO_INIT I have instantiated. Create Object tv_iterator.
If you have any suggestions please let me know....
Thanks -
HTMLB iterator - listbox behaving different than dropdownlistbox
So, my turn for a question again:
I've read through a lot of material, all the BSP blogs (each at least once, some of them over and over again ...), searched the forum to the best I could, but I'm still facing this problem:
In my iterator, the listbox just won't display ...
Now, using the dropdownlistbox everything works fine (like in blog 213 from Brian), but changing to listbox comes up with that empty cell ...
Is there some different behaviour between these two elements that I should not know about?
Have any of you used a listbox (not dropdown) in an iterator successfully? If so, examples would be appreciated!
Best regards,
MaxI have it working now. My problem was at first that I forgot to give the ListBox a pointer to my table that holds the values. Then while debugging I actually fixed that problem but set the listbox size to 1. Both of these options caused an error in the Runtime_IS_Valid method and stopped all rendering. And here I was thinking there was a problem in the output HTML.
I finally found it when I set a breakpoint in the DO_AT_BEGINNING method of both my listbox and my dropdown listbox. I never hit the breakpoint in the listbox. So after debugging all the way through to the IFUR=>D2~Render method I finally found it. The following code does work for me now in the Render_Cell_Start method of my Iterator class:
data listbox type ref to cl_htmlb_listbox.
create object listbox.
listbox->id = p_cell_id.
GET REFERENCE OF me->i_model->iusers_values INTO listbox->table.
listbox->nameofkeycolumn = 'key'.
listbox->nameofvaluecolumn = 'value'.
* listbox->onselect = 'OnUpdateUserClick'.
listbox->selection = get_column_value( 'BNAME' ).
listbox->width = '100%'.
listbox->size = '2'.
p_replacement_bee = listbox.
p_style = 'font-size:0.9em'.
That just goes to show you that when something is not rendering at all, you should start with a breakpoint in the Runtime_Is_Valid method. -
Hi All,,
I have 2 dropdownlist box in my view. i.e, COURSEGROUP and COURSE. When an entry in coursegroup listbox is selected , the COURSE listbox should be enabled and corresponding entries should be filled into the list items.
I have initially disabled the COURSE listbox.
I'm not using Model class for data binding.
My problem is:
When an OnSelect event occurs for COURSEGROUP list box, the control of program is going back to DO_REQUEST method and displays the same screen as earlier. The control is not entring the DO_HANDLE_EVENT method of controller..
I can also send the code if required.
Please help me out,,
Thanks in advance,,
Sachidanand.BHi,
Check out this weblog for server side operation of chained drop down list box:
/people/durairaj.athavanraja/blog/2004/12/20/bsphow-to-chained-dropdownlistbox
You can also go for client side (JS) check this link.
http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm
Regards,
Ravikiran. -
JavaScript for BSP (Dropdownlistbox in a tableview iterator)
...unfortunatly i have problems to put the generated html into the post...if anyone would like to have it i will be glad to send it to you by email.
This parameter does not actually allow you to enter your own style - I got annoyed by it myself when I started working with iterators.
If you debug a bit into the code of the method R_TXT_CELL of class CL_SAPTABLECELL you come across this part:
IF p_style IS NOT INITIAL.
SPLIT p_style AT ';' INTO TABLE styletable.
LOOP AT styletable ASSIGNING <style>.
SPLIT <style> AT ':' INTO stylename stylevalue.
TRANSLATE stylename TO LOWER CASE.
IF stylename EQ 'celldesign'.
From this (and the follow-up lines) we can learn that the only style attribute that can be used has to be called <b>'celldesign'</b>, and its allowed values are the ones in the table m_tableview->m_htmlb_tableview->mc_render_lib_d2_rt_validation->_et_stcd (runtime name of course).
For a quick reference, here are the values of this table:
STANDARD
ALTERNATING
TRANSPARENT
NEGATIVE
POSITIVE
TOTAL
SUBTOTAL
SUBTOTAL_LIGHT
BADVALUE_DARK
BADVALUE_MEDIUM
BADVALUE_LIGHT
CRITICALVALUE_DARK
CRITICALVALUE_MEDIUM
CRITICALVALUE_LIGHT
GOODVALUE_DARK
GOODVALUE_MEDIUM
GOODVALUE_LIGHT
GROUP_HIGHLIGHTED
GROUP_HIGHLIGHTED_LIGHT
KEY_MEDIUM
GROUP_LEVEL1
GROUP_LEVEL2
GROUP_LEVEL3
MARKED
FILTER
FILTERICON
POPIN
So, we have to live with this possibility - otherwise you would have to use a HTML element which you place into the cell, and which you can apply your styles to.
Cheers,
Max -
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 ). -
How to set a default value in a dropdownlistbox
Hi,
In CRM 2007 WEBUII have created a dropdownlistbox (ddlb) filled with currency codes.
Now I want the default value of the ddlb to be the currency of the country of the loggedin user, ie : 'EUR'
Anyone an creative idea how I can achieve this ?
In first place I need to know how I can set a default value of a ddlb.
--> ddlb type ref to CL_CRM_UIU_DDLB.
regards,
AbjuhHello Wolfgang,
If the method does not exist yet, you can create it in your enhanced (Z) context node.
Definition:
ATTRIBUTE_PATH Importing Type STRING
ITERATOR Importing Type Ref To IF_BOL_BO_COL_ITERATOR
VALUE Returning Type STRING
Implementation:
method GET_BP_GROUP.
DATA: current TYPE REF TO if_bol_bo_property_access.
DATA: dref TYPE REF TO data.
if iterator is bound.
current = iterator->get_current( ).
else.
current = collection_wrapper->get_current( ).
endif.
TRY.
TRY.
dref = current->get_property( 'BP_GROUP' ). "#EC NOTEXT
CATCH cx_crm_cic_parameter_error.
ENDTRY.
CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
cx_crm_genil_model_error.
RETURN.
ENDTRY.
IF dref IS NOT BOUND.
value =''
RETURN.
ENDIF.
TRY.
value = if_bsp_model_util~convert_to_string( data_ref = dref
attribute_path = attribute_path ).
CATCH cx_bsp_conv_illegal_ref.
FIELD-SYMBOLS: <l_data> type DATA.
assign dref->* to <l_data>.
* please implement here some BO specific handler coding
* conversion of currency/quantity field failed caused by missing
* unit relation
* Coding sample:
* provide currency, decimals, and reference type
* value = cl_bsp_utility=>make_string(
* value = <l_data>
* reference_value = c_currency
* num_decimals = decimals
* reference_type = reference_type
CONCATENATE <l_data> '-CURR/QUANT CONV FAILED-' INTO value
SEPARATED BY space. "#EC NOTEXT
CATCH cx_root.
value = '-CONVERSION FAILED-'. "#EC NOTEXT
ENDTRY.
if value is initial.
value = 'Your default value'.
endif.
endmethod.
Regards,
Fabian -
More than one iterator in single BSP page
Hi All,
I need to implement different tableviews in a single BSP page which is in MVC. I found in sdn & try with one of the way thro' se24. In se24 i create a class (ZTAB_ITERATOR) which is having the iterator. I dont know how to make use/implement that class in se80 ie in my existing class.
Can anyone help me regarding this?
Regards,
Anita.answered
-
Hello,
I am using mvc design pattern for my bsp application.
Could you please provide me some direction as to how to create a view that will allow the user to maintain master data (insert, update, delete, select) using htmlb extension table view?
Thanks,
ParthoHi Partho,
Here is the flow...
1. User clicks on the insert radio button.
2. The control goes to the controller from the view.
3. In the controller you will call insert view page.
Now...
Insert View has an internal table as a page attribute which will hold the database records.
In <b>DO_REQUEST method</b> method...
append a blank line into the internal table.
<i>(This will be used by the user to insert the values into the internal table.)</i>
Populate the internal table from the database...
Now the internal table has a blank line followed by records that are already present in the internal table.
Now the user sees a page containing the table view along with the save button.
Now when the user clicks the blank line then in the <b>iterator</b> use the below code
when 'REVW_CODE'.
IF p_edit_mode IS INITIAL.
p_edit_mode is not initial if the user selects a row from the table view.
First you have to indentify that user has clicked the blank line. For this you can use
if c_row_ref->REVW_CODE is initial
or alreay generated value, etc.,
Now you have two options...Since this is a primary key you can automatically
generate a primary key or leave it to the user. If your table is a foreign key table then you can
replace this cell to a drop down list box. the drop down list box contains the values from
the primary key table
endcase.
After user enters all the values....
He clicks Save button.
Now in <b>DO_HANDLE_EVENT</b> method
1. Catch this button event...
2. In the controller you can get the values that are present in the table view using the method...
GET_CELL_VALUE of cl_htmlb_event_tableview Class.
3. Check if the primary key value already exists in the database.
4. If yes. Show the user an error page with a back button. when he clicks it he will again reach the insert view page.
5.If no. Populate the user values into a work area.
6.Modify the internal table at index 1 from the work area.
7.modify the database table from the internal table.
8.Show a success page with a back button which will go to the main page with the radio buttons...
Hope it helps.
Regards,
Maheswaran.B
Message was edited by: Maheswaran B
Message was edited by: Maheswaran B -
Fileupload in Tableview Iterator
Dear Forum Members,
I am using CL_HTMLB_Fileupload Element in my Table View Iterator. I am using MVC Based solution. How can i bind filename with model data so that data is passed to model in Do_handle_data. I want to upload the same file to DMS System for creating the documents.
please post your views. This is very urgent for me.
Thanks & Regards,
Pavan Kumar Miryala.Dear Forum Members,
I got the Solution for My self. Thanks to all who has looked at my thread.
Pavan. -
Dropdown in tableview iterator doesn't show values
Hi everybody;
I'm new to BSP. I'm creating a small BSP MVC application.
I have a table with a few columns; I needed to add an extra column in which a dropdown would be shown.
I created an iterator class and implemented the following in the GET_COLUMN_DEFINITIONS in order to add the extra column:
method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS .
FIELD-SYMBOLS: <def> LIKE LINE OF p_column_definitions.
*First normal columns
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'CAMPAIGN_CD'.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'CAMPAIGN_NM'.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'COMMUNICATION_CD'.
*<def>-EDIT = 'X'.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'IDCLIENT'.
*<def>-EDIT = 'X'.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'CONTACT_DTTM'.
*<def>-EDIT = 'X'.
*Finally; our defined column for status dropdown
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'STATUS'.
<def>-TITLE = 'Status'.
endmethod.
Then I coded the following in the render_cell_start method to create the dropdown itself:
method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START .
DATA: lt_table TYPE TIHTTPNVP,
ls_table TYPE IHTTPNVP.
CASE p_column_key.
WHEN 'STATUS'.
CLEAR: ls_table, lt_table.
REFRESH lt_table.
ls_table-name = 'OK'.
ls_table-value = 'OK'.
APPEND ls_table TO lt_table.
ls_table-name = 'KO'.
ls_table-value = 'KO'.
APPEND ls_table TO lt_table.
DATA lt_stat TYPE REF TO DATA.
GET REFERENCE OF lt_table INTO lt_stat.
p_replacement_bee = CL_HTMLB_DROPDOWNLISTBOX=>FACTORY(
id = p_cell_id
table = lt_stat
nameOfKeyColumn = 'NAME'
nameOfValueColumn = 'VALUE'
ENDCASE.
endmethod.
The strange thing is that the dropdown is shown but no values at all. Can someone help me out?
Thanks
Kind regards,
AllanHi,
Yes indeed. I did not know that the table and its reference had to be declared in the attributes of the iterator.
Another question; how to set the selected value of the dropdown after choosing a value which executes an action via the event DO_HANDLE_DATA?
The right value is passed through to DO_HANDLE_DATA, but how do I have to set the dropdown to the selected value? In which event etc?
Thanks
Kind regards -
Selected line in tableview (iterator)
Hello,
I'm using a table view built whith iterator in a MVC application.
One column is a link.
When I click on the link, I would like to know in the DO_HANDLE_EVENT method, how to get the index of the internal table source.
Thank you for your help.
Bernard Pochin.Hi Bernard Pochin,
I've got the following code in 'on input processing':
if event_id = cl_htmlb_manager=>event_id.
ref_event = cl_htmlb_manager=>get_event( runtime->server->request ).
if ref_event is bound.
case ref_event->name.
when 'tableView'.
ref_tableview_event ?= ref_event.
rowselection = ref_tableview_event->rowselection.
endcase.
endif.
endif.
I hope this can help you!
Raoul -
Setting the tooltip of CL_HTMLB_DROPDOWNLISTBOX in an iterator?
Hello,
I'm new to the forum and quite new to BSP, so please bear with me if I'm asking simple questions
I tried to set the tooltip property of a CL_HTMLB_DROPDOWNLISTBOX instance in an iterator like this:
DATA: col_dropdown TYPE REF TO cl_htmlb_dropdownlistbox.
CREATE OBJECT col_dropdown.
col_dropdown->tooltip = 'Test'.
The dropdown list works ok and all is fine, but the tooltip is not displayed. However, when I use the tooltip property on a BSP page, it works fine:
<htmlb:dropdownListBox id = "SalesOrg"
table = "</= controller->CuCo->DD_SALESORG />"
nameOfKeyColumn = "TKEY"
nameOfValueColumn = "DESCRIPTION"
selection = "</= sarea />"
disabled = "</= SalesAreaDisabled />"
tooltip = "Test"
width="200" />
I'm using Design2002 as the display style. Could anybody please tell me what I have to do to make it work?
Thanks,
Leodid u try like this in th Iterator.
method if_htmlb_tableview_iterator~render_cell_start .
DATA: lo_text TYPE REF TO cl_htmlb_textview,
lo_ddlb TYPE REF TO cl_htmlb_dropdownlistbox,
FIELD-SYMBOLS: <dat> TYPE ANY.
row_ref = p_row_data_ref.
CASE p_column_key.
WHEN 'SORT_NUM'.
create object lo_ddlb.
get reference of lt_seq_no into lo_ddlb->table.
lo_ddlb->id = p_cell_id.
lo_ddlb->nameofkeycolumn = 'ENTRY_KEY'.
lo_ddlb->nameofvaluecolumn = 'ENTRY_VALUE'.
lo_ddlb->tooltip = 'My Tool tip'.
lo_ddlb->selection = get_column_value( p_column_key ).
p_replacement_bee = lo_ddlb.
WHEN OTHERS.
CREATE OBJECT lo_text.
lo_text->id = p_cell_id.
lo_text->wrapping = 'FALSE'.
lo_text->text = get_column_value( p_column_key ).
lo_text->design = 'STANDARD'.
p_replacement_bee = lo_text.
ENDCASE.
ENDMETHOD.
Maybe you are looking for
-
Windows 7 to replace Vista Home Permium
New HP Touchsmart--second generation. Have completed recovery disk creation. Want to replace Vista with Windows 7. Can I use recovery disks to restore HP and other program files? Install of Windows 7 to replace Vista Home Premium will wipe disk a
-
Unwanted visual artifacts with mastered DVD
My mastered DVD has unwanted visual artifacts resulting from a video recording of a dance recital that contained taped markings on a stage floor This visual disturbance does not appear with raw footage or compressed file but only with mastered DVD.
-
Hi, I have a standard idoc type extended with a custom segment. I have mentioned the same in the corresponding partner profile(idoc type and the extension). When I tried to import the meta data for this idoc in XI, it is taking it as ZXXXXX, instead
-
Re: Creating a CE function with dummy table
Hello LArs/Krishna; I have calculated column in which I have to insert current timestamp for more than one records in graphical calculation view, please help me in this.
-
MAC PRO KONA 3 External SATA dropped frames
Recently our company upgraded to KONA3 card with the new MAC PRO. We were not aware our External SATA drives would not be 100% compaditable with the MAC PRO. The drives do mount and seem to work fine in Standard Def and compressed HD, but start to dr