cl_salv_table updated records are not displayed in subscreen

sap alv factory method example
cl_salv_table example
cl_salv_table user command
alv list display using cl_salv_table
cl_salv_table vs cl_gui_alv_grid
cl_salv_table editable
cl_salv_table grid display
cl_salv_table display long text

I am trying to display updated records in ALV but old records are being displayd.

Here is the code written in the screen exit of work order.

  TRY.
**// Create SALV
      cl_salv_table=>factory(
        EXPORTING
          r_container    = lo_cust_container
        IMPORTING
          r_salv_table   = lo_alv_table
        CHANGING
          t_table        = gt_wflog ).


**// Functions
      DATA(lo_alv_functions) = lo_alv_table->get_functions( ).
      lo_alv_functions->set_all( abap_true ).

**// Display Settings
      DATA(lo_alv_display) = lo_alv_table->get_display_settings( ).
      lo_alv_display->set_striped_pattern( abap_true ).

**// Layout Settings
      DATA: ls_layout_key TYPE salv_s_layout_key.
      DATA(lo_alv_layout) = lo_alv_table->get_layout( ).
      ls_layout_key-report = sy-repid.
      lo_alv_layout->set_key( ls_layout_key ).
      lo_alv_layout->set_save_restriction( cl_salv_layout=>restrict_user_independant ).
*      lo_alv_layout->set_default( abap_true ).

**// Columns
      DATA: lo_alv_column TYPE REF TO cl_salv_column_table.
      DATA(lo_alv_columns) = lo_alv_table->get_columns( ).

********* Unhide Columns
      lo_alv_column ?= lo_alv_columns->get_column( 'AUFNR' ). "lo_alv_column->set_visible( abap_true ).
      lo_alv_column ?= lo_alv_columns->get_column( 'LMTID' ). "lo_alv_column->set_visible( abap_true ).


**/ Hide columns
      lo_alv_column ?= lo_alv_columns->get_column( 'UNAME' ). lo_alv_column->set_technical( abap_true ).
*      lo_alv_column ?= lo_alv_columns->get_column( 'MANDT_RESB' ). lo_alv_column->set_technical( abap_true ).
*      lo_alv_column ?= lo_alv_columns->get_column( 'RSNUM_RESB' ). lo_alv_column->set_technical( abap_true ).

**// Display
      lo_alv_columns->set_optimize( abap_true ).

      lo_alv_table->set_data( CHANGING t_table = gt_wflog[] ).


      lo_alv_table->display( ).


    CATCH cx_salv_msg cx_salv_error INTO DATA(lx_salv_msg).
      MESSAGE lx_salv_msg->get_text( ) TYPE 'I'.
  ENDTRY.

I tried to used method refresh lo_alv_table->REFRESH( ). with option soft or full refresh but nothing happened. First time call data is ok when subscreen is called again and there is change in data then updated records are not displayed.I can see updated records in the table during debug.

More than likely you have CX_SALV_NO_NEW_DATA_ALLOWED exception which is caught by TRY clause during the second call of your instantiation. That's why display() method is not executed.

There is a note in SET_DATA method documentation:

You are not able to call these methods in an event handler. If you do you will get an error.

...

Exceptions CX_SALV_NO_NEW_DATA_ALLOWED You have called SET_DATA in an event handler.

In your context screen exit is the same as event handler as it is called by some event.

Solution is confirmed by OP: "It works perfectly"

Added to declarations in the top include.

DATA go_alv_table TYPE REF TO cl_salv_table.

Added in the code

IF go_alv_table IS NOT BOUND.
  cl_salv_table=>factory( )
  ...
ENDIF.

Added after set_data method call

go_alv_table->refresh( refresh_mode = if_salv_c_refresh=>soft ).

Display ALV List easily in ABAP using CL_SALV_TABLE Part I , Updated on 17.11.2015. In this post series, I show you how to display a simple list with a flight schedule. I used to get headache even if I had to implement a simple ALV list, since it's not simple as the 1x1. the database table, SPFLI and save the received records into an internal table, flight_schedule. DATA: gr_table1 TYPE REF TO cl_salv_table. DATA: gr_table2 TYPE REF TO cl_salv_table. “Some data used for DB query DATA: gt_mara TYPE STANDARD TABLE OF mara. DATA: gt_mard TYPE STANDARD TABLE OF mard. START-OF-SELECTION. SELECT * FROM mara INTO TABLE gt_mara UP TO 200 ROWS. SELECT * FROM mard INTO TABLE gt_mard UP TO 200 ROWS. CALL SCREEN 2000.

ALV grid in a Subscreen - SAP Q&A, Hi, I have a problem with the display of a ALV grid in a subscreen. I have changed the subscreen into screen and I have added the status and so on and by itself it also works. SELECT * FROM sflight INTO TABLE gt_sflight UP TO 10 ROWS. is displayed in the sub screenif the main screen no. and prog. name is not� SELECT * UP TO 10 ROWS FROM spfli INTO TABLE gt_spfli. *Generate an instance of the ALV table object CALL METHOD cl_salv_table=>factory IMPORTING r_salv_table = gr_table CHANGING t_table = gt_spfli. *Display the ALV table. gr_table->display( ). Output. You can display the simple ALV table in the following ways:

Just an addition to @suncatcher's answer. Firstly checks whether a reference variable contains a valid reference: 'IF go_alv_grid IS BOUND'.

Example:

SELECT * FROM zemployees BYPASSING BUFFER INTO TABLE it_zemployees.

IF go_alv_grid IS BOUND. 
  go_alv_grid->refresh( ).

ELSE.
  cl_salv_table=>factory(
EXPORTING
  r_container    = NEW cl_gui_custom_container( 'CONTAINER_NAME' ) 
  container_name = 'CONTAINER_NAME'
IMPORTING
  r_salv_table   = go_alv_grid
CHANGING
  t_table        = it_zemployees
  ).

  "Style the table
  go_alv_grid->get_functions( )->set_all( ).
  go_alv_grid->get_columns( )->set_optimize( ).
  go_alv_grid->get_display_settings( )->set_striped_pattern( abap_true ).


  go_alv_grid->display( ).
ENDIF.

ALV grid in a Subscreen, I have changed the subscreen into screen and I have added the status and so on and by itself not to display ALV screen as subscreen when user interacts SELECT * FROM sflight INTO TABLE gt_sflight UP TO 10 ROWS. Hi, I have a problem with the display of a ALV grid in a subscreen. I am going to try to explain my problem and maybe somebody knows any solution. In a regular screen I have a subscreen that should show the ALV, I am following all the steps like call

Code Snippet Popup using SALV, Popup generated using the SALV Model in ABAP. By Naimesh Patel | Last Updated on September 23, 2013 | 6,540 SELECT * FROM t100 INTO TABLE t_t100 UP TO 10 ROWS. Display o_popup_alv->display( ). the main screen no. instead of the sub screen no. while creating the Container Object(I didn't know this,� Like for the simple table dispaly we must call the method CL_SALV_TABLE=>FACTORY to get the instance of the ALV. In this post we will see how we can cretae a simple table output just by calling two methods. Base Program. Code Snippet to generate ALV using class CL_SALV_TABLE *&-----*

SALV Show Count of Displayed Records, Delete the records from table which are not in the range; Get the number of rows to display. SAP doesn't support the Dynamic WHERE condition� Get FREE Access to the CL_SALV_TABLE Bonus Content. Updated on 17.11.2015. In this post series, I show you how to display a simple list with a flight schedule. I also show you the most common ALV settings that you might need. However, I don't show you how to handle events in CL_SALV_TABLE, and how to add custom buttons at the top of your ALV.

Source codes from Z_ABAP_BOOK in alphabetical order , CREATE OBJECT splitter EXPORTING parent = docking rows = 2 columns = 1. TRY. cl_salv_table=>factory( IMPORTING r_salv_table = alv CHANGING t_table MESSAGE 'ALV display not possible' TYPE 'I' DISPLAY LIKE 'E'. Selection Screen with TabStrips and Subscreens SELECTION-SCREEN: BEGIN OF� Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.