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

ALV Refresh?

Former Member
0 Likes
1,421

Dear All,

I have gone through some of the ealier threads on ALV refresh issue, but they don't exactly solve my problem.

Here's what I have developed:

Design:

1. Created a custom container in screen 100.

2. With this custom container as a parent, created a splitter container of 2 rows.

3. Splitter container row1 is used to create ALV grid1

4. Splitter container rwo2 is used to created ALV grid 2, which is editable.

Scenario:

When user changes some field values in Grid 2, the data in Grid 1 has to be changed as well.

For this I had registered event cl_gui_alv_grid=>mc_evt_enter for Grid2 and in the handler method, I'm modifying the contents of internal table displayed in Grid1. Then I'm calling method grid1->refresh_table_display.

Problem:

This doesn't seem to be refreshing the data in Grid1 although the data is changed in the underlying internal table.

There are some derived columns in Grid2 that are getting updated alright when the data changes after I call grid2->refresh_table_display, but Grid1 is completely unresponsive.

I have tried calling Grid1->check_data_changed before refresh, but no effect.

Why is Grid1 not getting refreshed?

Can you pls help?

Thanks!

Arthi

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
1,053

ALV refresh creates lots of confusions for many developers. Quick check if triggering an application event solves the issue. You can register events as the one mentioned with two ways:

1) while creating ALV set I_APPL_EVENTS = 'X' parameter

2) while registering event (method SET_REGISTERED_EVENTS) pass your events setting flag APPL_EVENT of structure CNTL_SIMPLE_EVENT

This will cause dialog step to be executed once event is triggered, which will likely refresh your data on screen.

Regards

Marcin

4 REPLIES 4
Read only

MarcinPciak
Active Contributor
0 Likes
1,054

ALV refresh creates lots of confusions for many developers. Quick check if triggering an application event solves the issue. You can register events as the one mentioned with two ways:

1) while creating ALV set I_APPL_EVENTS = 'X' parameter

2) while registering event (method SET_REGISTERED_EVENTS) pass your events setting flag APPL_EVENT of structure CNTL_SIMPLE_EVENT

This will cause dialog step to be executed once event is triggered, which will likely refresh your data on screen.

Regards

Marcin

Read only

0 Likes
1,053

Thanks Marcin, I tried setting I_APPL_EVENTS while creating grid2, but it did not refresh my other grid.

I'm calling method register_edit_event of cl_gui_alv_grid and it has only the event id as input.

Read only

0 Likes
1,053

Hi ,

After you set I_APPL_EVENTS , event will trigger pai . In the PAI create a module refresh.

And create a global variable gv_modified.

Inside the alv data changed event set

gv_modified = 'X'.

This will trigger pai and by the help of variable your code block will update data and alv.

MODULE refresh.

CHECK gv_modified = 'X'.

Change Table....

Refresh ALV's.

" Clear Variable

gv_modifided = ''.

ENDMODULE.

Read only

0 Likes
1,053

Thank you Hüseyin.

I tried doing CALL METHOD cl_gui_cfw=>set_new_ok_code( lv_fcode ) in the handler method as well to trigger PAI.

What I found was that this triggered the PBO (?!)

As Marcin and you mentioned, I_APPL_EVENTS is triggering a PAI but before the handler method executes.

So the sequence seems to be:

1. Change data in Grid2

2. If I_APPL_EVENTS is set, PAI is triggered.

3. Handler method for event data_changed is triggered.

4. If Method cl_gui_cfw=>set_new_ok_code( lv_fcode ) is called inside the above handler method, the PBO of the screen is triggered.

I have later found that a grid2->refresh_table_display in the handler method works fine. I identified my mistake: I hadn't refreshed the data for the grid. I had been changing the main internal table from which this data is derived.

However, I have learnt something new today.

Thanks!