cancel
Showing results for 
Search instead for 
Did you mean: 

dropdownlistbox in iterator (mvc)

former_member182371
Active Contributor
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182371
Active Contributor
0 Kudos

Hi,

sorry but i don´t get it.

i´ll try to add more information.

in the RENDER_CELL_START method i do:
CASE p_column_key.
WHEN '

THEFIELDTHATDOESNOTBELONGTOROWREF

'
wa-name = 'name'.
wa-value = 'value'.
APPEND wa TO table.

GET REFERENCE OF table INTO table_ref.
p_replacement_bee = cl_htmlb_dropdownlistbox=>factory(
id = p_cell_id
selection =

selection

table = table_ref

nameofkeycolumn = 'NAME'

nameofvaluecolumn = 'VALUE' ).

i ´m still not able to get a value in field "selection"

Best regards.

Former Member
0 Kudos

Hi,

First make sure you declare the column in the <b>GET_COLUMN_DEFINITIONS</b> method...

Then Just try and put this code in <b>RENDER_CELL_START</b>.

 FIELD-SYMBOLS : <fs> type any ,
                  <l_field> type any.
 
  assign p_row_data_ref->* to <fs>.
 
      ASSIGN COMPONENT 'your_column_name' OF STRUCTURE <fs> TO <l_field>.
      if <l_field> is assigned .
        selection = <l_field> .
      endif .

the component your_column_name has to be in your table...as you will need some value in your DDLB...

Hope this helps.

<b><i>Do reward each useful answer..!</i></b>

Thanks,

Tatvagna.

Answers (1)

Answers (1)

Former Member
0 Kudos

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>

Former Member
0 Kudos

Alternatively, you can use this code snippet to get the value of any column.

 FIELD-SYMBOLS : <fs> type any ,
                  <l_field> type any.

  assign p_row_data_ref->* to <fs>.

      ASSIGN COMPONENT your_column_name' OF STRUCTURE <fs> TO <l_field>.
      if <l_field> is assigned .
        lw_rgid = <l_field> .
      endif .

There is no need to declare an additionally column...if you just want values from any other column....then you can use the above snippet....

Hope this helps.

<b><i>Do reward each useful answer..!</i></b>

Thanks,

Tatvagna.