cancel
Showing results for 
Search instead for 
Did you mean: 

Edit a tableview and store...

Former Member
0 Kudos

Hello Forum...

I have a problem when i try to edit a tableview..

Well, I have a few of input fields in my page, with these input fields i choose some parameters and when i click on the button i do a query in the event oninputprocessing and appears my results on a tableview i draw on the layout.

Until here everything works perfectly.

Now, i have to edit a field of this tableview and store the whole structure of this query in a z table of the dictionary.

I use iterator to do it..but when i am going to save the result once editing i havent value on the cells...

data:

register type ztable,
table_event type ref to CL_HTMLB_EVENT_TABLEVIEW.

tv ?= CL_HTMLB_MANAGER=>GET_DATA( request = request
name = 'tableView'
id = 'results' ).

IF tv IS NOT INITIAL.
table_event = tv->data.
clear selectedRowIndex.
SelectedRowIndex = table_event->PREVSELECTEDROWINDEX.

  if selectedRowIndex <> 0.

   register-MANDT = SY-MANDT.

  COL_NO = 1.
  DO 9 TIMES.

  COL_VALUE = TABLE_EVENT->GET_CELL_VALUE( ROW_INDEX = selectedRowIndex COLUMN_INDEX = COL_NO ).
  CASE COL_NO.
  WHEN 1.
   register-year = COL_VALUE.
  WHEN 2.
.
.
   endcase.

  COL_NO = COL_NO + 1.

  ENDDO.
  endif.
  endif.

I have an example and it works perfectly but between them there is a diference, first one is a table of the dictionary and the second one is a query on a tableview to edit and save..

When i debug i see the next: (Method get_cell_value)

name = me->GET_CELL_ID( row_index = row_index column_index = column_index).

value = request->get_form_field( name ).

The parameter name has value each loop of my tableview but the parameter value is empty...i dont know why!¿?

Any suggestion or idea¿?

Thanks in advance and regards...

Mon.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Mon

Just check out this weblog..

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

......it will solve your problem....

Otherwise do revert back..

Cheers:)

Mithlesh

Former Member
0 Kudos

Hello again!

I solve the problem because now i can update and modify my z table. The problem was that i habe to include the property edit to every column of my tableview..so only i can modify the fields that arent key of my table.

But i want to set that columns with no edition..but the with this property i cant get any value of these cells when i am debuging and doing the request...

My question is: Can i edit only one column and set the property edit = "FALSE" in the rest of columns¿?

Thanks in advence and regards.

Mon

Message was edited by: Mon

Former Member
0 Kudos

hai,

ya you can definately make few as editable and others as non-editable.

if you are using iteratormathod for tableview see the method

"GET_COLUMN_DEFINITIONS" here while building the indivial column you can set the filed edit = 'X' if you require.

cheers

athavanraja
Active Contributor
0 Kudos

if you are not using iterator,

use the ColumnDefinition attribute of the tableview to do this.

code sample

page attribute:

col_control_tab TYPE TABLEVIEWCONTROLTAB

col_wa TYPE TABLEVIEWCONTROL

layout

   <%
  clear col_wa .
  move: 'CARRID' to col_wa-columnname ,
  '<B>Carrier id</B>' to col_wa-title ,
  'LEFT' to col_wa-horizontalalignment ,
  'X' to col_wa-edit ,
  'X' to col_wa-encode .
  append col_wa to col_control_tab .
  clear col_wa .
  clear col_wa .
  move: 'CONNID' to col_wa-columnname ,
  '<B>Connection</B>' to col_wa-title ,
  'X' to col_wa-sort ,
  'mycellclick' to col_wa-ONCELLCLICK ,
  'LEFT' to col_wa-horizontalalignment ,
  'X' to col_wa-encode .
  append col_wa to col_control_tab .
  clear col_wa .
      %>

  <htmlb:tableView id                  = "tv2"
                       selectionMode       = "MULTISELECT"
                       onRowSelection      = "MYROWSELECTION"
                       table               = "<%= flights %>"
                       columnDefinitions   = "<%= col_control_tab %>" 
                       columnHeaderVisible = "true"
                       sort                = "SERVER"/>

Regards

Raja

Former Member
0 Kudos

Hi Forum!,

I solved the problem. Only i set edit = "TRUE" to the field will be edited.

Later oninputprocessing:

 if selectedRowIndex <> 0.

   register-MANDT = SY-MANDT.

  COL_NO = 1.
  DO 9 TIMES.

  COL_VALUE = TABLE_EVENT->GET_CELL_VALUE( ROW_INDEX = selectedRowIndex COLUMN_INDEX = COL_NO ).
  CASE COL_NO.
  WHEN 1.
   clear register.
  read table t_register into register index selectedRowIndex.
   register_mod-year = register-year.
  WHEN 2.
   clear register.
  read table t_register into register index selectedRowIndex.
   register_mod-name = register-name.
.
.
  WHEN 9.
* THIS FIELD IS EDITABLE.
* Change the type string to p.
  clear: number1, number2.
  split col_value at ',' into number1 number2.
  if number1 cs '.'.
  replace all occurrences of '.' in number1 with ''.
  endif.
  if number2 is not initial.
  concatenate number1 number2 into col_value.
  divide col_value by 100.
  else.
  concatenate number1 number2 into col_value.
  endif.

  register_mod-number = COL_VALUE.
  ENDCASE.
  COL_NO = COL_NO + 1.

  ENDDO.


  MODIFY ztable_register FROM register_mod.
  COMMIT WORK AND WAIT.
  CLEAR COL_NO.
  endif.

Thanks to everybody..and regards,

Mon

Former Member
0 Kudos

HI mon

IN CELL RENDERING OF ITERTOR .

JUST ADD : VALUE = PCELL_BINDING

NEW VALUE WILL BE RETAINED...

***********************************

p_replacement_bee = CL_HTMLB_INPUTFIELD=>FACTORY(

id = p_cell_id

type = 'DATE'

showhelp = 'TRUE'

VALUE = DELIV_DATE

VALUE = PCELL_BINDING ).

CHEERS,

VIJAY RAHEJA