on 04-16-2007 12:40 PM
Hi all,
Can anyone suggest how to save multiple records at a time. i.e I select multiple rows edit them and click on save then the selected records should get saved with edited values.
Thanks and Regards,
Sneha.
Message was edited by:
Puppala Sneha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sneha,
Please try following code.
Layout:
-
<htmlb:tableView id = "tv_kna1"
table = "<%= t_kna1 %>"
selectionMode="MULTILINEEDIT"
/>
<htmlb:button text = "Save"
id = "btn_save"
onClick = "myClickHandler" />
onCreate:
-
SELECT * FROM KNA1 INTO TABLE T_KNA1 UP TO 10 ROWS.
onInputProcessing:
-
data: tab1 type ref to cl_htmlb_tableview,
tv type ref to cl_htmlb_event_tableview,
t_rows type selectedrows,
w_row type selectedrow,
w_value type string.
DATA: event TYPE REF TO if_htmlb_data.
event = cl_htmlb_manager=>get_event( runtime->server->request ).
if event->event_id = 'btn_save'.
tab1 ?= cl_htmlb_manager=>get_data(
request = runtime->server->request
name = 'tableview'
id = 'tv_kna1'
).
tv = tab1->data.
t_rows = tv->get_rows_selected( ).
loop at t_rows into w_row.
call method tv->get_cell_value
exporting
row_index = w_row-index
column_index = 11
receiving
value = w_value
.
read table t_kna1 into w_kna1 index w_row-index.
w_kna1-telf1 = w_value.
modify t_kna1 index w_row-index from w_kna1 .
endloop.
endif.
i think this may help you...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raja,
Here is my code.
In Oninitialization
select from dbtable into corresponding fields of table itab1.
In Oninputprocessing.
WHEN 'SAVE'.
if event->event_type = 'click'.
tv ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'tableView'
id = 'tv' ).
IF tv IS NOT INITIAL.
tv_data = tv->data.
refresh itab2.
refresh it_selected.
refresh itab.
refresh it_selectedrws.
call method tv_data->GET_ROWS_SELECTED
RECEIVING
selected_rows = itab2.
if itab2 is not initial.
loop at itab2 into ind.
READ TABLE itab1 INDEX ind-index into
rw.
if rw is not initial.
row_s = rw.
append row_s to it_selected.
endif.
endloop.
endif.
loop at it_selected into wa.
COL_NO = 1.
DO 4 TIMES.
COL_VALUE = tv_data->GET_CELL_VALUE( ROW_INDEX = ind-index COLUMN_INDEX = COL_NO ).
CASE COL_NO.
WHEN 1.
WA-partner = COL_VALUE.
WHEN 2.
WA-product = COL_VALUE.
WHEN 3.
WA-division = COL_VALUE.
WHEN 4.
WA-account = COL_VALUE.
ENDCASE.
COL_NO = COL_NO + 1.
ENDDO.
modify dbtable from wa.
modify itab from wa transporting partner.
modify itab from wa transporting product.
modify itab from wa transporting division.
modify itab from wa transporting account.
endloop.
endif.
Thanks and Regards,
Sneha.
Look at the corrected code:
loop at itab2 into ind.
READ TABLE itab1 INDEX ind-index into
rw.
if rw is not initial.
COL_NO = 1.
DO 4 TIMES.
COL_VALUE = tv_data->GET_CELL_VALUE( ROW_INDEX = ind-index COLUMN_INDEX = COL_NO ).
CASE COL_NO.
WHEN 1.
WA-partner = COL_VALUE.
WHEN 2.
WA-product = COL_VALUE.
WHEN 3.
WA-division = COL_VALUE.
WHEN 4.
WA-account = COL_VALUE.
ENDCASE.
COL_NO = COL_NO + 1.
ENDDO.
modify itab from wa transporting partner.
modify itab from wa transporting product.
modify itab from wa transporting division.
modify itab from wa transporting account.
endloop.
modify dbtable from itab.
endif.
<i>* Reward each useful answer</i>
Raja T
Hi Raja,
I have corrected the code as u gave, but now i could save only first selected row temporarily into internal table, i.e dbtable is not getting effected with the changes. the other changed rows(if i select more than 1 row) are not getting saved at all even in internal table.
Thanks and Regards,
Sneha.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.