cancel
Showing results for 
Search instead for 
Did you mean: 

table view modify

0 Kudos

Hai guys,

I want to modify the table values in tableview.But my modify operation not working.Could u guys help me.

Layout

<htmlb:tableView id = "tv1"

headerVisible = "true"

footerVisible = "false"

design = "ALTERNATING"

visibleRowCount = "5"

onRowSelection = "MyEventRowSelection"

selectionMode = "LINEEDIT"

table = "<%= itab %>" >

</htmlb:tableView>

<htmlb:button id = "button1"

design = "emphasized"

text = "Update"

onClick = "myClickHandler"

/>

oninput processing

DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW,

ind type i,

wa type yprojects.

DATA: event TYPE REF TO CL_HTMLB_EVENT.

event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

IF event->name = 'button1' AND event->event_type = 'click'.

DATA: button_event TYPE REF TO CL_HTMLB_EVENT_BUTTON.

button_event ?= event.

tv ?= CL_HTMLB_MANAGER=>GET_DATA(

request = runtime->server->request

name = 'tableView'

id = 'tv2' ).

IF tv IS NOT INITIAL.

DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.

tv_data = tv->data.

ind = tv_data->selectedrowindex.

IF ind IS NOT INITIAL.

READ TABLE itab INDEX ind into wa.

modify yprojects from wa .

endif.

ENDIF.

ENDIF.

Accepted Solutions (0)

Answers (5)

Answers (5)

0 Kudos

Hi Azzaz Ali,

I used ur code.When i click the save button.Its not going to store my table.

Thanks

0 Kudos

Hai guys,

Could you anyone explain me details for How to update the value in tableview.

Former Member
0 Kudos

Hi,

The sample code which i have given update the tableview when ever the changes are made and save button is clicked.

Regards,

Azaz Ali.

Former Member
0 Kudos

Hi,

The below code updates the internal table from the table view when ever the user changes the data in table view and presses update button. And the below code should be written in onInputprocesing event,

DATA: TABLE_EVENT TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW,

TABLE TYPE REF TO CL_HTMLB_TABLEVIEW .

TABLE ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = REQUEST

NAME = 'tableView'

ID = 'tview' ).

TABLE_EVENT ?= TABLE->DATA.

DATA: EVT TYPE REF TO IF_HTMLB_DATA.

EVT = CL_HTMLB_MANAGER=>GET_EVENT_EX( REQUEST ).

IF EVT IS NOT INITIAL AND EVT->EVENT_NAME = 'button' AND

EVT->EVENT_TYPE = 'click'.

DATA: COLUMNNAME TYPE STRING .

DATA: COLNO TYPE C.

DATA: ROWNO TYPE C .

DATA : CELL_VALUE TYPE STRING.

DATA : VAR_TV TYPE STRING.

VAR_TV = 'tview'.

ROWNO = '1'.

LOOP AT IT_TAB INTO WA_TAB.

COLNO = '1' .

DO 2 TIMES .

CLEAR COLUMNNAME .

CONCATENATE VAR_TV '_' ROWNO '_' COLNO INTO COLUMNNAME .

CELL_VALUE = REQUEST->GET_FORM_FIELD( NAME = COLUMNNAME ).

IF CELL_VALUE IS NOT INITIAL.

WA_TAB6-NAME = CELL_VALUE.

WA_TAB6-LASTNAME = WA_TAB-LASTNAME.

MODIFY IT_TAB FROM WA_TAB6.

CLEAR CELL_VALUE.

ENDIF.

COLNO = COLNO + 1.

ENDDO .

ROWNO = ROWNO + 1.

ENDLOOP.

ENDIF.

Regards,

Azaz Ali.

Former Member
0 Kudos

Hi forums,

I am also struggling the same problem(for modification of itab and dbtable) can any body give the sample code for modification of table.

you'r help is really appreciated.

Regards,

Ashok.

Former Member
0 Kudos

addition in layout : Function passdate()

<script language="JavaScript" type="text/javascript">

function pass_data()

{

if (top.window.dialogArguments) {

if ( document.form1.row_sel.value )

{

top.dialogArguments.document.form1.sorg.value=document.form1.row_sel.value;

top.close();

}

}

}

</script>

Former Member
0 Kudos

Hi ,

just try like this!!

In layout:

<htmlb:inputField id = "row_sel"

value = "<%= rowselected %>"

visible = "false" />

<%

if rowselected is not initial.

%>

<script type="text/javascript">

pass_data(); </SCRIPT>

<%

clear rowselected.

endif.

ONINPUT processing :

DATA: tv TYPE REF TO cl_htmlb_tableview.

tv ?= cl_htmlb_manager=>get_data(

request = runtime->server->request

name = 'tableView'

id = 'tab01' ).

IF tv IS NOT INITIAL.

DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.

tv_data = tv->data.

IF tv_data->selectedrowindex IS NOT INITIAL.

FIELD-SYMBOLS: <row> LIKE LINE OF salesorg_help.

READ TABLE salesorg_help INDEX tv_data->selectedrowindex ASSIGNING

<row>.

rowselected = <row>-sales_org.

ENDIF.

ENDIF.