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

Refresh the oops ALV display

bhargava_dns
Participant
0 Likes
6,092

Hi everybody,

I am using the oops ALV to display a report based on the some input data, for the first time the data is getting displayed correctly,

when the back button is pressed and the input data is changed the content displayed is not getting changed i am getting the previous content display only.

can anyone help me how to do display updated data in the ALV for the changed input data.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,909

Hello, when you press BACK button, you have to free the objects relationed to ALV into the MODULE PAI

PROCESS AFTER INPUT.

  MODULE user_command.

MODULE user_command.

  CASE sy-ucomm.

    WHEN 'BACK'.

      LEAVE .....       -> Return to previous screen

* Free objects

      go_grid->free( ).                       -> DATA: go_grid TYPE REF TO cl_gui_alv_grid.

      go_custom_container->free( ).

                                             -> DATA: go_custom_container TYPE REF TO cl_gui_custom_container.

* Clean objects

      CLEAR: go_grid, go_custom_container.

  ENDCASE.

ENDMODULE.

I hope this help you.

Regards

David Carballido

Hello, when you press BACK button, you have to free the objects relationed to ALV into the MODULE PAI

PROCESS AFTER INPUT.

  MODULE user_command.

MODULE user_command.

  CASE sy-ucomm.

    WHEN 'BACK'.

      LEAVE .....       -> Return to previous screen

* Free objects

      go_grid->free( ).                       -> DATA: go_grid TYPE REF TO cl_gui_alv_grid.

      go_custom_container->free( ).

                                             -> DATA: go_custom_container TYPE REF TO cl_gui_custom_container.

* Clean objects

      CLEAR: go_grid, go_custom_container.

  ENDCASE.

ENDMODULE.

I hope this help you.

Regards

David Carballido

8 REPLIES 8
Read only

former_member188827
Active Contributor
0 Likes
2,909

Try using "CHECK_CHANGED_DATA" to check if data is changed. Following link may be useful for you:

http://scn.sap.com/thread/3295165

Regards

Read only

0 Likes
2,909

Hi.

use this method

            CALL METHOD gr_table->refresh

              EXPORTING

                s_stable     = ld_stable

                refresh_mode = if_salv_c_refresh=>soft.

Regards

Miguel

Read only

Former Member
0 Likes
2,909

Hi,

Check Method REFRESH_TABLE_DISPLAY of Class CL_GUI_ALV_GRID.

You can see Demo Programs provided by SAP by going to SE38 and see programs starting with BCALV.

Thanks

Gaurav

Read only

Former Member
0 Likes
2,910

Hello, when you press BACK button, you have to free the objects relationed to ALV into the MODULE PAI

PROCESS AFTER INPUT.

  MODULE user_command.

MODULE user_command.

  CASE sy-ucomm.

    WHEN 'BACK'.

      LEAVE .....       -> Return to previous screen

* Free objects

      go_grid->free( ).                       -> DATA: go_grid TYPE REF TO cl_gui_alv_grid.

      go_custom_container->free( ).

                                             -> DATA: go_custom_container TYPE REF TO cl_gui_custom_container.

* Clean objects

      CLEAR: go_grid, go_custom_container.

  ENDCASE.

ENDMODULE.

I hope this help you.

Regards

David Carballido

Read only

Former Member
0 Likes
2,909

Hi,

Few points to confirm.

1. Probably the output table is not cleared after each display. There must be some condition in your program like,

if it_data is initial.

    fetch data.

endif.

If, so remove that condition.

If still not working, at start of selection, after the user inputs data, before fetching data from database, clear the data table.

start of selection.

clear it_data.

select  .....

2. The call for ALV display should be something like this.

  if CONT1 is initial.

     create object cont1 exporting container_name = 'CONT1'.

    create object grid1 exporting i_parent       = CONT1.

    call method grid1->set_table_for_first_display

      exporting

        i_structure_name = 'itab'

        is_layout        = s_layo

      changing

        it_outtab        = it_data

        it_fieldcatalog  = it_fieldcat.

  else.

    call method grid1->refresh_table_display.

  endif.

3. In the PAI, use this code to return to initial screen.

MODULE user_command.

  CASE sy-ucomm.

    WHEN 'BACK'.

     LEAVE  to screen 0.

Read only

former_member576008
Active Participant
0 Likes
2,909

try this code.

data : ref_grid type ref to cl_gui_alv_grid.

* to reflect the data changed into internal table
         if ref_grid is initial.
           call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
             importing
               e_grid = ref_grid.
         endif.
         if not ref_grid is initial.
           call method ref_grid->check_changed_data.
         endif.

Read only

Former Member
0 Likes
2,909

Hi,

Try using the method refresh_table_display of class cl_gui_alv_grid.

o_grid->refresh_table_display

Here o_grid is same as the ref which you are using for display the data.

Read only

bhargava_dns
Participant
0 Likes
2,909

Hi everyone,

i have solved the issue.

Both the answers given by  Susmitha Susan Thomas and David Carballido worked for me.

By freeing the memory and by adding the refresh function worked for me.

Thanks for your instant replys.