This website is not affiliated with, sponsored by, or approved by SAP AG.

CL_SALV_TABLE weird refresh [SOLVED]

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

CL_SALV_TABLE weird refresh [SOLVED]

Postby VLozano » Thu Aug 02, 2012 9:37 am

I'm facing a weird behaviour in some of my programs using that object. When I change the data, the screen grid doesn't refresh properly. If I use any button of the grid (sort, filter, etc) it refreshes, and my internal data is changed, giving me some nice headhaches when I try to work with unexistant or modified data.

I though it was something related with my SAPGui, but the sample programs work properly.

It's not about the FLUSH thing, because I'm calling that bloody method in each even code line and the behaviour is still there.

Any hint? Up to now I tried to:

1- destroy the referenced objects and re-create them from scratch (at both levels: the code itself* and through code**)
2- the CALL METHOD cl_gui_cfw=>flush( )
3- play lotto's until I'll win a big prize and can retire and forget all these things

None worked (sadly, the third one failed too)

It's not urgent, nobody will lose their work nor their life if I cannot fix it, but I will must change the easy cl_salv_table thing with cl_gui_alv_grid and it's a bit of work I don't like to do... and I have no time to change all my programs that use this class...

Any help will be appreciate, although I will not be able to give points.

Thanks in advance,
Vic

* I mean, I deleted/commented all code lines and made then new
** Using CLEAR, REFRESH and FREE sentences before the new CREATE OBJECT's

----------------------------------------
SOLVED: I missed to free the custom container used.

SOLVED AGAIN (01/31/2017: You can still use the bloody CL_SALV_TABLE if you just refresh, clears and frees all the items you are using.
SAP SUX.
Last edited by VLozano on Tue Jan 31, 2017 11:10 am, edited 4 times in total.
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby Rich » Fri Aug 03, 2012 3:56 am

Hi Vic,

Do youi get an event raised when you change the data ? If so, do uyou then call the Refresh method of the object ? (or call the Refresh method anyway ??)
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Re: CL_SALV_TABLE weird refresh

Postby VLozano » Fri Aug 03, 2012 4:11 am

Which shall be the difference? I have all kind of cases, I guess... In one of my failures, the user just leaves the screen where the table shows, change some data and call again (not a return) the grid. The data has been changed, but the old data is shown until you use any of the grid's menu buttons (sort, filter, etc). Then the screen refreshes showing the new data.

And the option where you click a button and then the data refreshes doesn't work too, if my memory doesn't fail. But I had a hurry and decided to move from CL_SALV_TABLE to CL_GUI_ALV_GRID (is the current guideline for now: keep my programs away from CL_SALV_TABLE :( )
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby VLozano » Fri Aug 03, 2012 7:30 am

More weird behavior: in the last grid I'm using, I declare a user command with it (a button added to the toolbar). My program calls the same screen (with the same container who will get the same CL_SALV_TABLE object with different settings and data) from two points.
If I call it from point A it shows ONE BUTTON and ONE ROW (for example). Then I change the selection (let's say it must show now TWO ROWS), and my calling routine adds another button to the toolbar... when the screen is called, it shows... ONE BUTTON and ONE ROW with old data... if I press the sort button, and accept the current sorting (none), the screen refreshes and OH! now it shows TWO ROWS (with the new data) and... ONE BUTTON.

I'm absolutely lost :oops:
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby Rich » Mon Aug 06, 2012 1:25 am

Post your code Vic.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Re: CL_SALV_TABLE weird refresh

Postby VLozano » Mon Aug 06, 2012 1:48 am

Table creation: in a FORM called from the PBO module of a dynnpro:
Code: Select all
      CALL METHOD cl_salv_table=>factory
        EXPORTING
          r_container    = gest_cont_1003
          container_name = 'GEST_CONT_1003'
        IMPORTING
          r_salv_table   = act_tab
        CHANGING
          t_table        = t_activ.
    CATCH cx_salv_msg .
  ENDTRY.

  columns = act_tab->get_columns( ).
  columns->set_optimize( ' ' ).

  column ?= columns->get_column( 'DATA_GROUP' ).
  column->set_output_length( 12 ).
  column ?= columns->get_column( 'SEQUENCE' ).
  column->set_output_length( 4 ).
  column ?= columns->get_column( 'DESCRIPTION' ).
  column->set_output_length( 40 ).

  l_selects = act_tab->get_selections( ).
  l_selects->set_selection_mode( if_salv_c_selection_mode=>multiple ).

  functions = act_tab->get_functions( ).
  functions->set_all( 'X' ).
  TRY.
      l_text = text-bt2.
      IF g_mode = 'A'.
        functions->add_function( name     = 'ACTIVATE'
                                 icon     = '@B_ROBJ@'
                                 text     = l_text
                                 tooltip  = l_text
                                 position = if_salv_c_function_position=>right_of_salv_functions ).
      ENDIF.
      l_text = text-bt5.
      functions->add_function( name     = 'CANCEL_ACT'
                               icon     = '@DEFECT@'
                               text     = l_text
                               tooltip  = l_text
                               position = if_salv_c_function_position=>right_of_salv_functions ).
    CATCH cx_salv_wrong_call cx_salv_existing.
  ENDTRY.

  lr_events = act_tab->get_event( ).
  CREATE OBJECT gr_events.
  SET HANDLER gr_events->on_user_command FOR lr_events.
  SET HANDLER gr_events->on_double_click FOR lr_events.

  act_tab->display( ).

PAI when leaving:
Code: Select all
  CASE sy-ucomm.
    WHEN 'END'.
      REFRESH t_activ.
      CALL METHOD act_tab->set_data
        CHANGING
          t_table = t_activ.
      act_tab->display( ).
      cl_gui_cfw=>flush( ).

      LEAVE TO SCREEN '9999'.
    WHEN OTHERS.
  ENDCASE.

In the meantime, the program does some work without changing tha table data. The user leaves the screen (activating the last piece of code I posted) and shall return again. The data table is refreshed, refilled and shown again. But until I do something like sort its contents, the object still shows the old data :evil:
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby Rich » Mon Aug 06, 2012 1:50 am

I don't see an act_tab->Refresh( ) any where.....
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Re: CL_SALV_TABLE weird refresh

Postby VLozano » Mon Aug 06, 2012 1:59 am

o! It's BEFORE the object creation... :oops:
Code: Select all
      IF act_tab IS BOUND.
        act_tab->refresh( ).
      ELSE.
        CALL METHOD cl_salv_table=>factory
          EXPORTING
            r_container    = gest_cont_1002
            container_name = 'GEST_CONT_1002'
          IMPORTING
            r_salv_table   = act_tab
          CHANGING
            t_table        = t_activ.
      ENDIF.

But it's my last try... I cannot tell you at how many places I've put the refresh method... Do you think I must add it before the flush? Just where I saw I've put a "display" and not a "refresh"? Will try while waiting...

EDITED: did it and still doesn't working
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby Rich » Mon Aug 06, 2012 2:09 am

VLozano wrote:o! It's BEFORE the object creation... :oops:
Code: Select all
      IF act_tab IS BOUND.
        act_tab->refresh( ).
      ELSE.
        CALL METHOD cl_salv_table=>factory
          EXPORTING
            r_container    = gest_cont_1002
            container_name = 'GEST_CONT_1002'
          IMPORTING
            r_salv_table   = act_tab
          CHANGING
            t_table        = t_activ.
      ENDIF.

But it's my last try... I cannot tell you at how many places I've put the refresh method... Do you think I must add it before the flush? Just where I saw I've put a "display" and not a "refresh"? Will try while waiting...

EDITED: did it and still doesn't working


Use Excel.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Re: CL_SALV_TABLE weird refresh

Postby VLozano » Mon Aug 06, 2012 2:46 am

:shock:

What do you mean? Must I forget the CL_SALV_TABLE and continue changing all my tables to CL_GUI_ALV_GRID? I cannot use Excel, because the user must launch events for selected lines :cry:
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby Rich » Mon Aug 06, 2012 2:49 am

VLozano wrote::shock:

What do you mean? Must I forget the CL_SALV_TABLE and continue changing all my tables to CL_GUI_ALV_GRID? I cannot use Excel, because the user must launch events for selected lines :cry:


No, I mean I'm out of ideas at the moment. Launching RFC's from excel is no hardship though Vic.

Have you system debugged what happens when you click a button that works and one where it doesn't ?
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Re: CL_SALV_TABLE weird refresh

Postby VLozano » Mon Aug 06, 2012 3:01 am

I debugged the system, but wasted too much time I had not. The problem is not the buttons are not working but the object itself doesn't. All my buttons (once the displayed data is the right one) work fine.

I tried to find an OSS Note related with that object, but found none that seemed relevant. I'm stuck and I spent all my available "investigation" time. I must decide now, and it seems my next move will be forget that object and use the classical CL_GUI one. Shit! I loved the simplicity of the CL_SALV :(

Thanks for your time, Rich. If I'll retrieve more information during the tests, of if I'll have additional (and unexpected) time to mess with this thing, I'll refresh (sigh) this thread.

Again, thanks mate.
Vic
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby Rich » Mon Aug 06, 2012 3:08 am

VLozano wrote:debugged the system


Nope, used /HS instead of /H ?
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Re: CL_SALV_TABLE weird refresh

Postby VLozano » Mon Aug 06, 2012 3:19 am

I'm used to use /hs to debug my code and /h to debug SAP's one... As I supposed the fail was mine, I think I used /hs... I will give /h a chance if I'll have some spare time, thanks Rich.
Tuly Idiots
Because we know we are part of the problem
VLozano
 
Posts: 5140
Joined: Mon Sep 13, 2004 8:17 am
Location: Idiocity

Re: CL_SALV_TABLE weird refresh

Postby Rich » Mon Aug 06, 2012 3:34 am

VLozano wrote:I'm used to use /hs to debug my code and /h to debug SAP's one... As I supposed the fail was mine, I think I used /hs... I will give /h a chance if I'll have some spare time, thanks Rich.


Use /HS - it shows more code and gives more insight.
Regards

Rich

Image
Abap KC:http://www.richard-harper.me.uk/Kb
SFMDR:http://www.se37.com
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Next

Return to ABAP

Who is online

Users browsing this forum: Google Adsense [Bot] and 12 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.