cancel
Showing results for 
Search instead for 
Did you mean: 

to delete a row when selected from table view and press delete button.

Former Member
0 Kudos

dear all,

ive a requirement when we select a row from table view and press delete button it should get deleted from database

.please give me step by step procedure how to do this.ihve tried debugging using the examples from post but did not understand . i am new to bsp.please help.

View Entire Topic
Former Member
0 Kudos

Hi Sushani.

Please refer the sample code below this will delete the enteries from internal table...please replace them with ur Database table.

and importatn thing in the

Proprties tab please keep the staut as STATEFULL FROM NOW ON Enabled.

On initialization Event

IF fl_delete IS INITIAL.
  SELECT carrid
         connid
    FROM spfli
    INTO TABLE t_spfli
    WHERE carrid = 'AA'.
ENDIF.

On Input Processing Event.

DATA:
  w_event TYPE REF TO cl_htmlb_event.

CALL METHOD cl_htmlb_manager=>get_event
  EXPORTING
    request = runtime->server->request
  RECEIVING
    event   = w_event.

IF w_event IS NOT INITIAL.
  IF w_event->id = 'del'.
    DATA: table TYPE REF TO cl_htmlb_tableview.
    DATA: selectedrowindex TYPE string.

    table ?= cl_htmlb_manager=>get_data( request = request
                                       name    = 'tableView'
                                       id      = 'tab' ).

    IF table IS NOT INITIAL.
      DATA: table_event TYPE REF TO cl_htmlb_event_tableview.

      CLEAR selectedrowindex.
      table_event = table->data.
      selectedrowindex = table_event->selectedrowindex.

    DELETE t_spfli index selectedrowindex.
      fl_delete = 1.

    ENDIF.
  ENDIF.
ENDIF.

Layout Code.

<htmlb:tableView id            = "tab"
                       width         = "100%"
                       selectionMode = "SINGLESELECT"
                       table         = "<%= t_spfli %>" >
        <htmlb:tableViewColumn columnName="CARRID" >
        </htmlb:tableViewColumn>
        <htmlb:tableViewColumn columnName="CONNID" >
        </htmlb:tableViewColumn>
      </htmlb:tableView>
      <htmlb:button id      = "del"
                    text    = "delete"
Click = "OnInputProcessing()"
/>

Hope this is helpful to you, let me know if you still have any problem.

Thanks

Kalyan

Former Member
0 Kudos

thanks kalyan for your help.it helped me a lot as iam very new to bsp.

Former Member
0 Kudos

Hi ,

Any time.....

Thanks

Kalyan.