cancel
Showing results for 
Search instead for 
Did you mean: 

Table modify in BSP

Former Member
0 Kudos

Hello All,

I have a tableview with entries from a Database table.

I have 3 columns in this table view.

Out of all the 3 columns ,I made only one column editable ( 2nd column ).

1, Now if i change the value in the 2nd column the internal table of the table view must get modified with the changed value .

After that I'll modify the corresponding database table

I want this to be acheived without selecting any line of the tableview after the changes.

can it be done ? I want this is to be chieved after a button "SAVE' on page , not on table view.

I am able to modify internal table on a table view event but i am not able to find data on Click of SAVE button lying on Page

Please let me know how to do this

Rajiv

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

you need to get the edited data form table view and update the intenal table.

Can you paste your code that you wrote for SAVE button.

vijay

Former Member
0 Kudos

Hi Vijay

I have written following code : I am chekcing for table view and a event is fired on screen for save with event id 'SAVE'

if tv is not initial.

DATA: gv_row TYPE string,

gv_len TYPE i,

cell_id TYPE string,

wa_test LIKE LINE OF torder,

value1 type string.

LOOP AT torder INTO wa_test.

CLEAR gv_row.

gv_row = sy-tabix.

gv_len = STRLEN( gv_row ).

gv_len = gv_len - 1.

CONCATENATE 'helptable' '_' gv_row(gv_len) '_' '3'

INTO cell_id .

value1 = request->get_form_field( name = cell_id ).

IF wa_test-description value1.

CLEAR wa_test-description.

wa_test-description = value1.

MODIFY torder FROM wa_test.

ENDIF.

ENDLOOP.

endif.

rajiv

raja_thangamani
Active Contributor
0 Kudos

Search this BSP fourm with modify or update tableview, you will get plenty of threads for the same.

Raja T

Former Member
0 Kudos

What ever thread i found , I am not able to sort out issue.

Code I have writtebn is

I am chekcing for table view contents and a event is fired on screen for save button with event id 'SAVE'

if tv is not initial.

DATA: gv_row TYPE string,

gv_len TYPE i,

cell_id TYPE string,

wa_test LIKE LINE OF torder,

value1 type string.

LOOP AT torder INTO wa_test.

CLEAR gv_row.

gv_row = sy-tabix.

gv_len = STRLEN( gv_row ).

gv_len = gv_len - 1.

CONCATENATE 'helptable' '_' gv_row(gv_len) '_' '3'

INTO cell_id .

value1 = request->get_form_field( name = cell_id ).

IF wa_test-description value1.

CLEAR wa_test-description.

wa_test-description = value1.

MODIFY torder FROM wa_test.

ENDIF.

ENDLOOP.

endif.

Using this code i am able to get code on any table view event like row selection , header click but on Save Button. I do not know why. If you can help me , plz let me know how to resolve this issue.

rajiv

Former Member
0 Kudos

Hi Rajiv,

here I am giving the code that I used.

data: loc_table_event type ref to cl_htmlb_event_tableview,

lt_selectedkeytab type STRING_TABLE,

visible_first_row type STRING,

loc_ind type selectedrow,

loc_sel_rows type selectedrows.

call method cl_hrrcf_iterator=>get_tv_attr

exporting

p_tv_id = 'TV'

p_component_id = me->component_id

po_request = me->request

importing

p_visible_first_index = visible_first_row

pt_selected_keys = lt_selectedkeytab

po_tv_event = loc_table_event.

refresh loc_sel_rows.

call method loc_table_event->get_rows_selected

receiving selected_rows = loc_sel_rows

loop at loc_sel_rows into loc_ind.

///you need to write this code for each cell you want to get data form table view I wrote for 1st and 2nd fields.///

wa-field1 = loc_table_event->get_cell_value(

row_index = loc_ind-index

column_index = 1 ).

wa-field2 = loc_table_event->get_cell_value(

row_index = loc_ind-index

column_index = 2 ).

modify int_table index loc_ind-index from wa .

endloop.

Reward points if useful

vijay