cancel
Showing results for 
Search instead for 
Did you mean: 

Update internal table through tableview

Former Member
0 Kudos

Hi!

I am looking for an example or an idea to update my internal table with the data i edit in my tableview..i can edit the cell but i cant keep the data when i select another row...updating line and modify mi internal table row by row¿? i dont know...

I think that i dont need a iterator because the type of the fields is a string and i edit them write simply, not inputfields or checkboxes...

Thanks in advance...

Best regards,

Mon

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI MON

DO LIKE THIS INSIDE YOUR OnInputprocessing

<b> CLASS CL_HTMLB_MANAGER DEFINITION LOAD.

DATA: tv type ref to CL_HTMLB_TABLEVIEW,

COL_NO TYPE INT4,

COL_VALUE TYPE STRING,

selectedRowIndex TYPE INT4,

WA LIKE SFLIGHT,

table_event type ref to CL_HTMLB_EVENT_TABLEVIEW.

tv ?= CL_HTMLB_MANAGER=>GET_DATA( request = request

name = 'tableView'

id = 'tvX' ).

IF tv IS NOT INITIAL.

table_event = tv->data.

clear selectedRowIndexTable.

selectedRowIndexTable = table_event->PREVSELECTEDROWINDEXTABLE.

LOOP AT selectedRowIndexTable INTO selectedRowIndex.

COL_NO = 1.

DO <NO OF COLOUMN> TIMES.

COL_VALUE = TABLE_EVENT->GET_CELL_VALUE( ROW_INDEX = selectedRowIndex COLUMN_INDEX = COL_NO ).

CASE COL_NO.

WHEN 1.

WA-<NAME 0F FIRST C0LOUMN> = COL_VALUE.

WHEN 2,

WA-<NAME 0F SECOND C0LOUMN> = COL_VALUE.

  • AND SO ON TILL ALL THE COLOUMNS ARE NOT FILLED IN THE WORK SPACE...

ENDCASE.

COL_NO = COL_NO + 1.

ENDDO.

CLEAR COL_NO.

ENDLOOP.

ENDIF.</b>

<i><b>If you have any problem understanding this code do reply...</b></i>

In this code i am able to get the coloumn value using

COL_VALUE = TABLE_EVENT->GET_CELL_VALUE( ROW_INDEX = selectedRowIndex COLUMN_INDEX = COL_NO ).

the above statement..by just providing the row_no and col_no..

<b>Remember this is done for selection mode MULTILINEEDIT...</b>

Answers (1)

Answers (1)

shiva_suvarna
Participant
0 Kudos

hi mon,

If you use Model Data Binding the table will be updated itself. but of course for this you have to follow MVC pattern.

Former Member
0 Kudos

Hi Shiva!

updated itself¿? Could u explain to me please? ( guide or weblog?

Thanks for answering!

Mon

shiva_suvarna
Participant
0 Kudos

Mon,

If you know <b>Model View Controller patter</b>n and data binding the code in view is the following

<htmlb:tableView id = "TBL"

allRowsEditable = "X"

design = "STANDARD"

footerVisible = "FALSE"

table = "//model/MT_SFLIGHT"

width = "100%"

selectionMode = "SINGLESELECT" />

if you don't know then try to learn those

For MVC -

http://help.sap.com/saphelp_47x200/helpdata/en/cd/101c3a1cf1c54be10000000a114084/frameset.htm

/people/sap.user72/blog/2005/03/29/bsp-howto-exploring-bsp-development-with-mvc

Applications like TUTORIAL_3_MVC, zbookshop_mvc, itmvc2

For data binding

/people/sergio.ferrari2/blog/2006/08/28/bsp-in-depth-model-data-binding