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: 

refresh in alv report

Former Member
0 Kudos

hi masters,

i m working on alv report where i have to change the data. after changing the data i have to do the refresh for that i m using the method below

wa_STBL-ROW = 'X'.

wa_STBL-COL = 'X'.

CALL METHOD grid_obj->refresh_table_display

EXPORTING

IS_STABLE = wa_stbl

I_SOFT_REFRESH = 'X '

EXCEPTIONS

finished = 1

OTHERS = 2.

but after executing this method its giving run time error saying that ' Access via 'NULL' object reference not possible. You attempted to use a 'NULL' object reference (points to 'nothing') access a component (variable: "GRID_OBJ").'. can u plz help me where i m going wrong. and how to implement the refresh in alv report in details..

thanks in advance.

regards,

vicky

14 REPLIES 14

Sm1tje
Active Contributor
0 Kudos

According to this message, you have not created an instance of this object grid_obj. Upon displaying this ALV grid the first time, what variable have you used to instantiate the ALV object? This should be them same, so also grid_obj. After instantiating, you shouldn't not initialize it anymore during the run of the program.

Former Member
0 Kudos

thanks for reply. this is my code.

data: grid_obj type ref to cl_gui_alv_grid.

data : gs_stbl type lvc_s_stbl.

wa_stbl-row = 'X'.

wa_stbl-col = 'X'.

append wa_stbl to gs_stbl.

call method grid_obj->refresh_table_display

exporting

  • IS_STABLE = wa_stbl

i_soft_refresh = ' '

exceptions

finished = 1

others = 2.

i defined the grid_obj as a cl_gui_alv_grid any other assigments i have to do for the same?

can u further clarify ur answer?

Edited by: vicky on May 15, 2009 12:46 PM

Sm1tje
Active Contributor
0 Kudos

Ok, we have already seen this part of the coding. But if I read the message (Null Object) it is obvious that when doing the refresh, GRID_OBJ is not yet instantiated. So, somewhere along the line, you have cleared it so now it is not pointing to any instance any more, hence, no ALV grid can be refreshed. Check your coding and find out where it is instantiated and where it is initialized again.

Otherwise, paste some more coding here.

Former Member
0 Kudos

thanks mickey for ur reply.

but i m not getting which table is null in that program. because when i reached to this method i have the values in all table like fielcatlog, internal table which i m passing for display. and i m not refreshing the 'grid_obj'. then whats the problem? in which table i should have the data? pl clarify this.

0 Kudos

Hi,

Just try

if not grid_obj is initial.

CALL METHOD grid_obj->refresh_table_display.

endif.

Former Member
0 Kudos

thanks jayanthi,

this GRID_OBJ is initial. but can u explain me why it is initial? and how to solve this problem? after calling this method i have to display the alv report again. can i do this with same 'CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' or i have to call new? plz help me.

0 Kudos

Hi,

You might have refreshed this grid somewhere.

Just check in debugging after set_table_for_first_display where exactly it is initial.

Sm1tje
Active Contributor
0 Kudos

The only one who can tell why it is initial is you. We don't know the program flow, but it looks like you have initialized it somewhere along the line.

Are you using FM 'REUSE_ALV_GRID_DISPLAY' to display the data in the first place, or are you using the OO approach with CREATE OBJECT grid_obj?

I get the impression that you are mixing OO approach and 'procedural' approach.

Past the 'full' code here, and we might be able to help you.

Former Member
0 Kudos

i checked the program in debug from initial to last that GRID_OBJ is initial for entire time. i have not cleared this GRID_OBJ anywhere in program. i m doing this for ALV report refresh. when i clicked on refresh button it is going to pf-status and it fetching the data also after that its executing the CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' but this time its not showing anything. its again to intial position. why it is happening? pl help me..

Sm1tje
Active Contributor
0 Kudos

What method are you using to display the ALV grid in the first place? Looks to me that you are using

'REUSE_ALV_GRID_DISPLAY' (procedural approach) and next the refresh method from the OO approach.

former_member183990
Active Contributor
0 Kudos

u can use REUSE_ALV_GRID_DISPLAY for this purpose

just replace the existing ALV tool bar with the this by copying this

program : SAPLKKBL

status : STANDARD_FULLSCREEN

this has the refresh button by default

and copy to ur zprogram and its status

now add extra buttons whatever u want

cheers

s.janagar

0 Kudos

hi,

when i clicked on refresh button it is going to pf-status after that as i shown in below code it goes to refresh_report. but in this 'form refresh_report' it won't display the data. it goes into the infinite loop. within that form- endform. plz can u give me solution for this problem?

set pf-status 'STANDARD_FULLSCREEN'.

case sy-ucomm.

when '&REFRESH'.

perform refresh_report.

endcase.

form refresh_report .

perform build_fieldcatlog.

perform event_call.

perform populate_event.

perform data_retrieval.

perform build_listheader using it_listheader.

perform display_alv_report_fm.

endform. " REFRESH_REPORT

Former Member
0 Kudos

Hi,

You can refresh the ALV if you have done it using classes & methods. This can be done by using the following two method by setting the two parameters in the layout as shown below.

It will refresh the ALV screen with the updated values

i_layout-sel_mode = 'D'.

i_layout-cwidth_opt = 'X'.

call method alv1->refresh_table_display.

call method alv1->set_frontend_layout

exporting is_layout = i_layout.

Rgds,

Sachin.

0 Kudos

The last solution works fine. Thanks.