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

stefan_kagelmacher
Participant
0 Likes
1,424

hello,

I have a small report using ALV grid to display. the outputlist have many interactive actions, realized in a local class for event button_click.

example:

on button_click the report calls transaction VA02. after changing data, it returns to outputlist. I call the method refresh_table_display, but the display is still the same. but the internal table has new values.

if I set a break point, the display will be updated correctly

can anyone help?

greetz

12 REPLIES 12
Read only

Former Member
0 Likes
1,280

Hi,

Create object instance of type g_grid type ref to cl_gui_alv_grid,

Now after filling internal table with new data, cal the method as follows.

the below method will check if the data is chagned or not.

call method g_grid->check_changed_data

importing

e_valid = l_valid.

if l_valid eq 'X'.

loop at pt_outtab into ls_outtab.

perform check_lock using ls_outtab

changing l_locked.

if l_locked is initial

and not ls_outtab-checkbox eq '-'.

ls_outtab-checkbox = 'X'.

endif.

modify pt_outtab from ls_outtab.

endloop.

This method refresh the display of the output.

call method g_grid->refresh_table_display.

endif.

Read only

Former Member
0 Likes
1,280

hi

try this using Function Module 'RS_REFRESH_FROM_SELECT_OPTIONS'.

report zcoe_alv_simple.

have a button Refresh with fctcode : REF in the menu painter.

form user_command using ucomm type sy-ucomm

selfield type slis_selfield.

constants: l_c_repid type sy-repid value 'ZCOE_ALV_SIMPLE'.

data: l_i_seltab type table of rsparams.

when 'REF'.

  • Calling fm to get refresh data

call function 'RS_REFRESH_FROM_SELECTOPTIONS'

exporting

curr_report = l_c_repid

tables

selection_table = l_i_seltab

exceptions

not_found = 1

no_report = 2

others = 3.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else.

  • * Calling the screen after refreshing

submit zcoe_alv_simple with selection-table l_i_seltab.

endif.

endcase.

endform. " USER_COMMAND

Regards

Read only

Former Member
0 Likes
1,280

Hi,

In the PAI at the beginning call the method CHECK_CHANGED_DATA.

This will transfer the changed data from the grid to the internal table.

Regards,

Ankur Parab

Read only

uwe_schieferstein
Active Contributor
0 Likes
1,280

Hello Stefan

This is a well-known problem. The refreshing only takes place when you pass once PAI & PBO of your dynpro.

However, this can be achieved quite easily:


METHOD handle_button_click.
" NOTE: PAI is NOT triggered!!!

...
CALL TRANSACTION 'VA02' ...
...

" And now trigger PAI with a defined ok-code:
CALL METHOD cl_gui_cfw=>set_new_ok_code
   EXPORTING
     okcode = 'REFRESH'.

ENDMETHOD.

Now change your USER_COMMAND module (PAI) accordingly:


MODULE user_command_0100. " PAI

  CASE gd_okcode.
    WHEN 'REFRESH'. 
      PERFORM refresh_list.
...
ENDMODULE.

In the routine REFRESH_LIST you update your OUTTAB list and finally call method go_grid->refresh_table_display( ). After passing PBO the refreshed list will be displayed.

For more details please refer to:

[A Christmas Collection of Useful Classes|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/12377] [original link is broken] [original link is broken] [original link is broken];

Regards

Uwe

Regards

Uwe

Read only

stefan_kagelmacher
Participant
0 Likes
1,280

thx for answers.

same problem. if I set a break point the display will updated correctly. if I do not set a breakt point the display is still the same (old values).

I tried

flush

refresh_table_display

set new ok_code

I do not know.

Read only

stefan_kagelmacher
Participant
0 Likes
1,280

dear uwe,

thx for answer. but your version still not work (for me).

code:

method button click

case es_col_id.

when 'BUTTON_RECH'.

clear wa_bdcdata.

wa_bdcdata-program = 'SAPMV60A'.

wa_bdcdata-dynpro = '0102'.

wa_bdcdata-dynbegin = 'X'.

append wa_bdcdata to lt_bdcdata.

clear wa_bdcdata.

wa_bdcdata-fnam = 'KOMFK-VBELN(01)'.

wa_bdcdata-fval = ls_daten-vbeln_neu.

append wa_bdcdata to lt_bdcdata.

call transaction 'VF01' using lt_bdcdata.

perform check_changes_rech using ls_daten-vbeln_neu.

form check_changes_rech

data: ls_daten type ywah_s_check_apa_rm.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = p_vbeln_neu

importing

output = p_vbeln_neu.

read table gt_daten into ls_daten with key vbeln_neu = p_vbeln_neu.

check sy-subrc is initial.

select single vbeln from vbrp into ls_daten-re_nummer

where aubel = ls_daten-vbeln_neu.

modify gt_daten from ls_daten index sy-tabix.

perform set_alv_icons.

perform set_alv_line.

call method cl_gui_cfw=>set_new_ok_code

exporting

new_code = 'REFRESH'.

pai_user_command

when 'REFRESH'.

perform refresh_display.

form refresh_display

call method g_alv->check_changed_data.

call method g_alv->refresh_table_display.

list ist still the same.

Read only

0 Likes
1,280

Hello Stefan

Then place the method call go_grid->refresh_table_display( ) into a PBO module.

Regards

Uwe

Read only

stefan_kagelmacher
Participant
0 Likes
1,280

same

Read only

0 Likes
1,280

Hello Stefan

Normally it works. Alternatively, put your method call go_grid->set_table_for_first_display( ) into a PBO module.

If this does not work then you have a bug within the update of your OUTTAB list.

Regards

Uwe

Read only

stefan_kagelmacher
Participant
0 Likes
1,280

if your meaning is correct, why does the display is worthy when setting on the debugger?

Read only

0 Likes
1,280

Hello Stefan

When you work with controls you should keep in mind that we have frontend and a backend which may be in sync or not:

Frontend = Control (e.g. ALV grid)
Backend = OUTTAB itab used for the ALV list

Regards

Uwe

Read only

stefan_kagelmacher
Participant
0 Likes
1,280

call transaction MODE 'S'

and everything is ok.

what a cry.

thx uwe