cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting the server side cookie on the selection of a row.

Former Member
0 Kudos

hi all

I have a requirement as follows:-

I have a table with many rows. I select one row and click the button which takes me to another page. From that page when i click the back button which takes me back to previous page but the problem is that the row is no longer selected.

I am able to keep the selected row intact but when i select another row when i come back to the main screen, I am not able to do so.the rows which were previously selected are remaining intact and i am unable to deselect them also.

I have used the server side cookie concept for keeping the selected row intact.

Can anyone help me in this regard???

Regards,

Chandana.

Accepted Solutions (1)

Accepted Solutions (1)

raja_thangamani
Active Contributor
0 Kudos

Look at the below thread..Same issue discussed & solved...

<i>* Reward each useful answer</i>

Raja T

Former Member
0 Kudos

Hi Raja,

I have gone thru this thread already and wrote the code as suggested by you in the thread.Now I am able to keep the selected rows intact on the main screen.But when i try to deselect those rows or select any other row in the tableview after this I am not able to do so.i.e I am not able to proceed further and carry out other functions in that page.

Even if i execute the application again the rows remain selected.

I have tried deleting the cookies in the onInitialization event handler as suggested by you but then I am not able to view the selected rows when I come back to the main screenafter navigating back.

Can u plz suggest me a way out?

Thanks and Regards,

Chandana.

raja_thangamani
Active Contributor
0 Kudos

Post your entire code here..

Raja T

Former Member
0 Kudos

Hi Raja ,

Here is my code:-


<u>In OnInputProcessing of mainpage</u>

WHEN 'COPYREC'.

        DATA: tv1 TYPE REF TO CL_HTMLB_TABLEVIEW.
        DATA: tv_data1 TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.

        tv1 ?= CL_HTMLB_MANAGER=>GET_DATA(
                        request      = runtime->server->request
                        name         = 'tableView'
                        id           = 'tv' ).

        IF tv1 IS NOT INITIAL.


          tv_data1 = tv1->data.
******************To retain selected rows**************************************************
          clear selectedRowIndexTable.
      selectedRowIndexTable = tv_data1->PREVSELECTEDROWINDEXTABLE.
      if tv_data1->event_type eq CL_HTMLB_EVENT_TABLEVIEW=>CO_ROW_SELECTION.
        read table selectedRowIndexTable with key table_line = tv_data1->ROW_INDEX
          transporting no fields.
        if sy-subrc eq 0.
          delete selectedRowIndexTable index sy-tabix.
        else.
          field-symbols <i> type i.
          append initial line to selectedRowIndexTable assigning <i>.
          <i> = tv_data1->ROW_INDEX.
        endif.
      endif.


            CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>SET_SERVER_COOKIE
        EXPORTING
          NAME                  = 'select_row'
          APPLICATION_NAME      = 'NONE'
          APPLICATION_NAMESPACE = 'NONE'
          USERNAME              = SY-UNAME
          SESSION_ID            = 'NONE'
          DATA_VALUE            = selectedRowIndexTable
          DATA_NAME             = 'sbsp'
          EXPIRY_TIME_REL       = 0.

ENDIF.

In onIntialization of main page:-

 CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>GET_SERVER_COOKIE
        EXPORTING
          NAME                  = 'select_row'
          APPLICATION_NAME      = 'NONE'
          APPLICATION_NAMESPACE = 'NONE'
          USERNAME              = SY-UNAME
          SESSION_ID            = 'NONE'
          DATA_NAME             = 'sbsp'
          CHANGING
          DATA_VALUE            = selectedRowIndexTable.


In layout:-

<htmlb:tableView       id               = "tv"
                       width            = "500"
                       headerVisible    = "false"
                       design           = "alternating"
                       visibleRowCount  = "15"
                       fillUpEmptyRows  = "true"
                       selectionMode    = "multilineedit"
                       selectedRowIndex = "<%= row_index %>"
                       selectedRowIndexTable = "<%= selectedRowIndexTable %>"
                       onRowSelection   = "MyEventRowSelection"
                       showNoMatchText  = "true"
                       filter           = "server"
                       sort             = "server"
                       onHeaderClick    = "MyEventHeaderClick"
                       table            = "<%= it_aett %>"
                       iterator         = "<%= my_iterator %>" >
      </htmlb:tableView>




Regards ,

Chandana

raja_thangamani
Active Contributor
0 Kudos

The reason why you can not select new rows or de-select the row is, everytime its getting the selected rows from Server side cookie..

Look at the correction:

<b>InInputprocessing:</b>

daTA: Temp_RowIndexTable TYPE INT4_TABLE.

Temp_RowIndexTable = selectedRowIndexTable.
            CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>SET_SERVER_COOKIE
        EXPORTING
          NAME                  = 'select_row'
          APPLICATION_NAME      = 'NONE'
          APPLICATION_NAMESPACE = 'NONE'
          USERNAME              = SY-UNAME
          SESSION_ID            = 'NONE'
          DATA_VALUE            = Temp_RowIndexTable
          DATA_NAME             = 'sbsp'
          EXPIRY_TIME_REL       = 0.

<b>OnInitialization:</b>


daTA: Temp_RowIndexTable TYPE INT4_TABLE.

 CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>GET_SERVER_COOKIE
        EXPORTING
          NAME                  = 'select_row'
          APPLICATION_NAME      = 'NONE'
          APPLICATION_NAMESPACE = 'NONE'
          USERNAME              = SY-UNAME
          SESSION_ID            = 'NONE'
          DATA_NAME             = 'sbsp'
          CHANGING
          DATA_VALUE            = Temp_RowIndexTable.

if Temp_RowIndexTable is not initial.
selectedRowIndexTable = Temp_RowIndexTable.
      CALL METHOD cl_bsp_server_side_cookie=>delete_server_cookie
        EXPORTING
          name                  = 'select_row'
          application_namespace = runtime->application_namespace
          application_name      = runtime->application_name
          username              = SY-UNAME
          session_id            = runtime->session_id.

endif.

This will solve your problem.

<i>*Reward each useful answer</i>

Raja T

Former Member
0 Kudos

Hi Raja,

I have tried putting the code given by you but still I am facing the same problem.My code now is as given below:-


1. In OnInputprocessing:-
 clear selectedRowIndexTable.
      selectedRowIndexTable = tv_data1->PREVSELECTEDROWINDEXTABLE.
      if tv_data1->event_type eq    CL_HTMLB_EVENT_TABLEVIEW=>CO_ROW_SELECTION.
        read table selectedRowIndexTable with key table_line = tv_data1->ROW_INDEX
          transporting no fields.
        if sy-subrc eq 0.
          delete selectedRowIndexTable index sy-tabix.
        else.
          field-symbols <i> type i.
          append initial line to selectedRowIndexTable assigning <i>.
          <i> = tv_data1->ROW_INDEX.
        endif.
      endif.

Temp_RowIndexTable = selectedRowIndexTable.
            CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>SET_SERVER_COOKIE
        EXPORTING
          NAME                  = 'select_row'
          APPLICATION_NAME      = 'NONE'
          APPLICATION_NAMESPACE = 'NONE'
          USERNAME              = SY-UNAME
          SESSION_ID            = 'NONE'
          DATA_VALUE            = Temp_RowIndexTable
          DATA_NAME             = 'sbsp'
          EXPIRY_TIME_REL       = 100.

2. In OnIntialization
 
 CALL METHOD CL_BSP_SERVER_SIDE_COOKIE=>GET_SERVER_COOKIE
        EXPORTING
          NAME                  = 'select_row'
          APPLICATION_NAME      = 'NONE'
          APPLICATION_NAMESPACE = 'NONE'
          USERNAME              = SY-UNAME
          SESSION_ID            = 'NONE'
          DATA_NAME             = 'sbsp'
          CHANGING
          DATA_VALUE            = Temp_RowIndexTable.

if Temp_RowIndexTable is not initial.
selectedRowIndexTable = Temp_RowIndexTable.
      CALL METHOD cl_bsp_server_side_cookie=>delete_server_cookie
        EXPORTING
          name                  = 'select_row'
          application_namespace = runtime->application_namespace
          application_name      = runtime->application_name
          username              = SY-UNAME
          session_id            = runtime->session_id.

endif.

3. In layout:-
   <htmlb:tableView       id               = "tv"
                       width            = "500"
                       headerVisible    = "false"
                       design           = "alternating"
                       visibleRowCount  = "15"
                       fillUpEmptyRows  = "true"
                       selectionMode    = "multilineedit"
                       selectedRowIndex = "<%= row_index %>"
                       selectedRowIndexTable = "<%= selectedRowIndexTable%>"
                       onRowSelection   = "MyEventRowSelection"
                       showNoMatchText  = "true"
                       filter           = "server"
                       sort             = "server"
                       onHeaderClick    = "MyEventHeaderClick"
                       table            = "<%= it_aett %>"
                       iterator         = "<%= my_iterator %>" >
      </htmlb:tableView>

Regards,

Chandana.

raja_thangamani
Active Contributor
0 Kudos

Try to put the break-point in Oninitialization & check that when you come back from another page to main page, <i>Temp_RowIndexTable</i> should be filled..

And in other case, <i>Temp_RowIndexTable</i> should be initial....

<i>* Reward each useful answer</i>

Raja T

Former Member
0 Kudos

Hi Raja,

I have tested putting a breakpoint in onInitialization event .When I come back from another page to main page, Temp_RowIndexTable is filled.

How do I proceed with??

Can you plzz suggest me a way out??

Regards,

Chandana.

raja_thangamani
Active Contributor
0 Kudos

But also check when you do other processing, (not naginvating to other pages) <i>Temp_RowIndexTable</i> should <b>not</b> be populated.

<i>* Reward each useful answer</i>

Raja T

Former Member
0 Kudos

Hi Raja,

Actually I am not able to process any event after navigating back to the main page.I am not even able to select another row nor deselect the already selected one.Therefore I am unable to check whether the Temp_RowIndexTable is populated or not.

How can I solve this problem??

Is there any other way out??

Regards,

Chandana.

raja_thangamani
Active Contributor
0 Kudos

I understand you can't click any rows, But when you click, <b>is it triggering event</b>?

If so contorl will go to Oninputprocessing & then it will goto OnInitialization. Here it should not fill <i>Temp_RowIndexTable</i>.

Raja T

Former Member
0 Kudos

Hi Raja,

I have put the breakpoint in OnInitialization event and tried to select another row(i.e I have checked for other processing, apart from naginvating to other pages). When I tried to process other events I still find the Temp_RowIndexTable filled with the same index values as before bcoz of which the rows remain selected.So how do I go about this???

Thanks and Regards ,

Chandana

raja_thangamani
Active Contributor
0 Kudos

It means the server side cookie which you set is, still alive. its not getting deleted..

Check out the below thread....

<i>* Reward each useful answer</i>

Raja T

Answers (0)