Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CL_SALV_TABLE - refresh sometimes does nothing

jrgkraus
Active Contributor
7,079

I wrote about this already 12 years ago (!) - https://answers.sap.com/questions/5704968/index.html - no solution so far.

I have a very strange issue with CL_SALV_TABLE regarding the refresh of a table. Since my program is very big (~100 classes) I can not paste the coding here. I will try to describe the issue with screen shots

My SALV is this table on the screen. Now, I delete the line we see and do a refresh afterwards

The delete( ) deletes the row from the database using a BAPI call. It then reloads the data in the model.

Now I step into the refresh( ) method

init_alv( ) does nothing, because the ALV object is already instantiated.

Now I step into get_data( ).

time_confirmations is the output table of my ALV. As we can see, it now is empty.

Now let's go on to the refresh:

I do a display - but also a refresh causes the same problem. Pressing F8, the table is NOT refreshed:

However, if I do a simple sort operation:

Voilà - the table is refreshed!

Now the same class has also a function (the "all confs" button), that does something very similar:

This call sets up a filtering in the model, so a different set of lines will be passed during refresh. Surprisingly, this call works perfect...

It's making me mad. I can not deliver my program like this, and I have no idea about a workaround.

Any help is welcome.

1 ACCEPTED SOLUTION
Read only

jrgkraus
Active Contributor
6,451

I found out, that the problem relates to the fact that I do a PAI/PBO turn afterwards (with leave screen). If the leave screen is not performed, the refresh works.

I tried to change the leave screen into a CL_GUI_CFW=>SET_NEW_OK_CODE( 'ENTER' ). This resolved the problem.

4 REPLIES 4
Read only

FredericGirod
Active Contributor
0 Likes
6,451

The reaction of the program seems to be a syncrhonous problem between ABAP / SAPGui, but ... you have put a flush ..

Does the table corresponding to the SALV grid is global & in the same class ?

Read only

jrgkraus
Active Contributor
0 Likes
6,451

Yes, the table is in the final class, the ALV object in its abstract super class.

Read only

jrgkraus
Active Contributor
6,452

I found out, that the problem relates to the fact that I do a PAI/PBO turn afterwards (with leave screen). If the leave screen is not performed, the refresh works.

I tried to change the leave screen into a CL_GUI_CFW=>SET_NEW_OK_CODE( 'ENTER' ). This resolved the problem.

Read only

Sandra_Rossi
Active Contributor
6,451

I have no issue with this minimal (non-)reproducible code (double-click the line to delete):

REPORT.
CLASS lcl_app DEFINITION.
  PUBLIC SECTION.
    METHODS main.
    METHODS on_double_click
      FOR EVENT double_click OF cl_salv_events_table
      IMPORTING row.
    DATA salv TYPE REF TO cl_salv_table.
    DATA flights TYPE TABLE OF sflight.
ENDCLASS.
CLASS lcl_app IMPLEMENTATION.
  METHOD main.
    SELECT * FROM sflight INTO TABLE @flights.
    cl_salv_table=>factory(
      EXPORTING
        r_container  = cl_gui_container=>screen0
      IMPORTING
        r_salv_table = salv
      CHANGING
        t_table      = flights ).
    salv->get_functions( )->set_all( ).
    DATA lo_events TYPE REF TO cl_salv_events_table.
    lo_events = salv->get_event( ).
    SET HANDLER on_double_click FOR lo_events.
    salv->get_sorts( )->add_sort( columnname = 'CARRID' subtotal = 'X' ).
    salv->get_aggregations( )->add_aggregation( columnname = 'PRICE' ).
    salv->display( ).
  ENDMETHOD.
  METHOD on_double_click.
    DELETE flights INDEX row.
    salv->refresh( refresh_mode = if_salv_c_refresh=>full ).
  ENDMETHOD.
ENDCLASS.
PARAMETERS dummy.
DATA app TYPE REF TO lcl_app.
AT SELECTION-SCREEN OUTPUT.
  IF app IS NOT BOUND.
    app = NEW lcl_app( ).
    app->main( ).
  ENDIF.