Application Development 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: 

Problem in GRID display

Former Member
0 Kudos

Hi All,

I have a screen where i have to display data in a grid(Using set_table_for_first_display).

I have a button 'Display' on the application toolbar and two screen input fields.

Assume at the first instance

user fills the input fields as below and presses display

Selection screen option 1: ABC

Selection screen option 1: 123

then the GRID is displaying the data correctly for the table (Note my table is dynamic).

now if the user change the input selection as below

Selection screen option 1: XYZ

Selection screen option 1: 444

then i need to set the grid again with new values(Table will also change if the input option is changed)

This should happen on the same screen 100.

to achive this everytime when the sy-ucomm is display i am freeing the object and creating new istance.

The data getting passed to set_table_for_first_display is correct but the display is showing me the old data

How i can set the display again.

Regards/Ajay

8 REPLIES 8

former_member188685
Active Contributor
0 Kudos

are you calling method REFRESH_TABLE_DISPLAY...??

Former Member
0 Kudos

Hi,

use

data : lif_alv type ref to cl_gui_alv_grid.

call method lif_alv->refresh_table_display.

Regards

Former Member
0 Kudos

Hi ,

No need to create a new instance every time.

Check if the instance is already created then do refresh_table_display.

Thanks,

Keerthi

krishnannarayanan_nampoot
Active Participant
0 Kudos

Hi Praveen,

I understand from your description that when user changes the input you are not destructing the instance of grid but only changing the data. This however will not change the screen with gird.

The correct practice or rather one of the good practices is :

Say your grid is in screen 8000.

In PBO, say module INIT_DISPLAY takes care of Grid Display.

MODULE init_display.
 IF cc_grid IS INITIAL.
    CREATE OBJECT cc_grid
        EXPORTING 
          parent = 'CC_GRID'.
  ENDIF.

 IF grid IS INITIAL.
   CREATE OBJECT grid 
        EXPORTING
          parent = cc_grid.
   
"Set Table for First Display.

 ELSE.
   if gv_fcat_changed is not initial.
      " Call method SET_FRONTEND_FIELDCATALOG
   endif.
   " call method REFRESH_TABLE_DISPLAY.
 ENDIF.

Please note that the flag gv_fcat_changed is to be set when user changes results in change in Field catalog(as u said ur screen is dynamic). If so then only when you call the method the new fieldcatalog considered. If any sort / filter also has changed then you need to set that also EXPLICTLY as Field catalog is done above.

Then you need to refresh table display.

IF fieldcatalog/sort/filter has changed, you simply call REFRESH_TABLE_DISPLAY method..else.you can additionally add parameter I_SOFT_REFRESH = 'X'..this will reduce fliker of screen if you are on same screen..

Please revert if any doubts...I am not pasting any sample code as you can easily implement this and learn alv display concepts....still any issues are there, you reply..i will put sample code.....

Hope this helps.

0 Kudos

Hi,

I have tried doing it the way you have asked me ...

In PAI i am checking if the object is already created and sy-ucomm is display.

if yes then i am doing below.

if not gr_alvgrid is initial.

CALL METHOD gr_alvgrid->set_frontend_fieldcatalog

expORTING

it_fieldcatalog = p_field_catalog .

CALL METHOD gr_alvgrid->refresh_table_display

EXPORTING

i_soft_refresh = ' '

EXCEPTIONS

finished = 1

OTHERS = 2.

endif.

0 Kudos

Write Refresh display method in PBO

Regards

Pavan

Former Member
0 Kudos

Hi Praveen,

No need to create instance every time, Create instance only when object is initial. Use this method REFRESH_TABLE_DISPLAY for refreshing the display

Regards

Pavan

krishnannarayanan_nampoot
Active Participant
0 Kudos

Hi Praveen,

As said above, these are meant to be written in PBO only. These are screen related manipulations which are used before displaying screen. I've never tried in PAI...

The Best Example could be:

If you want to disable a field you write the code for looping on screen..now as you know this screen is a run-time structure by system which has all the elements on screen with their properties which is used before GUI writes the screen for you......

likewise REFRESH_TABLE_DISPLAY is for the display. ...PAI is meant for data level changes...as in ur variables and all....

I am away from system....i will get some code and paste ASAP..sorry ..meanwhile you can try this code in PBO. ....