cancel
Showing results for 
Search instead for 
Did you mean: 

How to trigger HTMLB:tableView onRowSelection event from BSP ABAP OO program

Former Member
0 Kudos

Hi:

I wonder weather anyone knows how to trigger onRowSelction event of HTMLB:tableView BSP component (with selctionMode set to LINEEDIT) from ABAP program; e.g., when initializing first screen and then upon pressing HTMLB:button.

For example when HTMLB:tableView is displayed, the first checkbox should be set on to allow editing the first row. Then when pressing Select Next Row for Editing button the next checkbox should be selected allowing the second row to be edited.

I have developed a sample BSP program ZAWB_TEST_TV03 on CU6 (tsphl841) that consist of HTML:tableView and 2 buttons: Select Next Row for Editing and Select Previous Row with no code for click event on button.

Could you please let me know what should be placed in click button events to make it working the way that I have described.

This is a test application but functionality that I have described could be used in real life application. Do I have to trigger there onRowSelection event? How?

Your help will be appreciated.

Cheers,

Adam

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I wonder weather anyone knows how to trigger onRowSelction event of HTMLB:tableView BSP component (with selctionMode set to LINEEDIT) from BSP ABAP OO program; e.g., when initializing first screen and then upon pressing HTMLB:button?

athavanraja
Active Contributor
0 Kudos

Look at

Grid Layout1 and Grid Layout2 under Composite Samples in the HTMLB samples BSP application provided by SAP.

http://<server>:<port>/sap/bc/bsp/sap/htmlb_samples/samplelist.htm

Regards

Raja

Former Member
0 Kudos

Hi Raja:

Thank you for you reply.

However, those examples do not do what I want to do.

What I need is to place checkmark on HTMLB:tableView row programatically from ABAP OO code rather than by user clicking on it.

Best Regards,

Adam

athavanraja
Active Contributor
0 Kudos

You can try with

CL_HTMLB_MANAGER=>DISPATCH_EVENT .

Sorry i am little busy, i couldnt try it myself. The above method should trigger the event you specify.

Regards

Raja

Former Member
0 Kudos

Hi Raja:

I still have a small problem - I do not know how to call the method in my specific case.

Let assume that row is already selected and I want to force the next or previous row to be selected from ABAP OO program upon user pressing NEXT or PREVIOUS button; e.g., from method called from OnInputProcessing event.

=====================================================================

I wrote a test program where I have HTMLB:tableView and 2 HTMLB:buttons. The layout looks as shown below:

=====================================================================

<%@page language="abap" %>

<%@extension name="htmlb" prefix="htmlb" %>

<htmlb:content design="classicdesign2002design2003" >

  do_request

     changing xt_table = pt_table.

=====================================================

The esential part of do_request method of the application class looks as follows:

=====================================================

METHOD DO_REQUEST .

  DATA:

    lo_runtime TYPE REF TO cl_bsp_runtime,

    lo_event TYPE REF TO cl_htmlb_event.

*-Get EVENT & RUNTIME objects----

-


  lo_runtime = cl_bsp_runtime=>get_runtime_instance( ).

  lo_event = cl_htmlb_manager=>get_event( lo_runtime->server->request ).

  ...

*-Get updated Liaisons' data container from HHTP request----

-


  DATA: lo_htmlb_tv TYPE REF TO cl_htmlb_tableview.

  lo_htmlb_tv ?= cl_htmlb_manager=>get_data(

                    request = lo_runtime->server->request

                    name = 'tableView'

                    id = 'pt_table' ).

  ...

*-Get table view event data--

-


    DATA: lo_event_tv TYPE REF TO cl_htmlb_event_tableview.

    lo_event_tv = lo_htmlb_tv->data.

    ...

*-Row was selected before so NEXT or PREVIOUS could be selected-----

    IF lo_event_tv->prevselectedrowindex > 0.

      ...

*---Now process events--

-


      CASE lo_event->id.

*----


Select next row. If no row selected, select 1-st row----

-


         WHEN 'edit_next'.

           li_row = lo_event_tv->prevselectedrowindex + 1.

           " I guess row selection event has to be raised here

           " but I do not know how

*-----Select previous row. If no row selected, select the last row--

        WHEN 'edit_prev'.

           li_row = lo_event_tv->prevselectedrowindex - 1.

           " I guess row selection event has to be raised here

           " but I do not know how

      ENDCASE.

      ...

   ENDIF.

  ...

ENDMETHOD.

=====================================================

I wonder how to call (how to build/get parameters that should be used)CL_HTMLB_MANAGER=>DISPATCH_EVENT  from there?

The previously selected row index is available in lo_event_tv->prevselectedrowindex  attribute.

Best Regards,

Adam