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 Display Refresh

Former Member
0 Likes
611

Hello Experts,

I'm having an issue with a ALV report. I have a screen where the user will input some data, based on that data the ALV will generated once that first ALV Report is generated I have one column with the hotspot functionality if the user clicks on the hotspot another ALV will be generated based on the record they clicked on the first one, my problem comes when they hit the back button the second ALV stays with the data from the first click so I need a way of how like refresh the second alv everytime they hit BACK or click on the hotspot, the internal table that has the values is changing properly so I'm assuming is a problem with the method that generates the ALV or with the screen, any help on this will be very appreciated, have deadline on this tomorrow, thanks again.

My Logic in the PBO:


CALL METHOD grid2->set_table_for_first_display
EXPORTING
I_STRUCTURE_NAME = 'ZDM_CA_OKTOMKT_STR'
i_save = 'A'
is_layout = gv_layout 
is_variant = lw_variant
CHANGING
it_outtab = lt_ca_oktomkt_final
it_fieldcatalog = it_fctab2 " it_sort = IT_SORT
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF

Logic when hit hotspot:


METHOD handle_hotspot_click .
v_row = e_row_id.
v_column = e_column_id.
v_row_num = es_row_no.
clear: lt_ca_oktomkt_final, lw_ca_oktomkt.
READ TABLE lt_final_rec INTO lw_final_rec INDEX v_row.
  LOOP AT lt_ca_oktomkt INTO lw_ca_oktomkt WHERE zportion = lw_final_rec-zportion.
      APPEND lw_ca_oktomkt TO lt_ca_oktomkt_final.
  ENDLOOP.
clear: v_row.
DELETE ADJACENT DUPLICATES FROM lt_ca_oktomkt_final COMPARING zcontract.

CALL SCREEN '0200'." this is the second screen with ALV after clicked on hotspot
ENDMETHOD.

I tried this on the PAI when they hit the back button didn't work eaither:


CALL METHOD grid2->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
525

Hi,

Am guessing Please try in this way.

METHOD handle_hotspot_click .

v_row = e_row_id.

v_column = e_column_id.

v_row_num = es_row_no.

clear: lt_ca_oktomkt_final, lw_ca_oktomkt.

READ TABLE lt_final_rec INTO lw_final_rec INDEX v_row.

LOOP AT lt_ca_oktomkt INTO lw_ca_oktomkt WHERE zportion = lw_final_rec-zportion.

APPEND lw_ca_oktomkt TO lt_ca_oktomkt_final.

ENDLOOP.

clear: v_row.

DELETE ADJACENT DUPLICATES FROM lt_ca_oktomkt_final COMPARING zcontract.

CALL SCREEN '0200'." this is the second screen with ALV after clicked on hotspot

CALL METHOD grid2->refresh_table_display.

ENDMETHOD.

3 REPLIES 3
Read only

Former Member
0 Likes
526

Hi,

Am guessing Please try in this way.

METHOD handle_hotspot_click .

v_row = e_row_id.

v_column = e_column_id.

v_row_num = es_row_no.

clear: lt_ca_oktomkt_final, lw_ca_oktomkt.

READ TABLE lt_final_rec INTO lw_final_rec INDEX v_row.

LOOP AT lt_ca_oktomkt INTO lw_ca_oktomkt WHERE zportion = lw_final_rec-zportion.

APPEND lw_ca_oktomkt TO lt_ca_oktomkt_final.

ENDLOOP.

clear: v_row.

DELETE ADJACENT DUPLICATES FROM lt_ca_oktomkt_final COMPARING zcontract.

CALL SCREEN '0200'." this is the second screen with ALV after clicked on hotspot

CALL METHOD grid2->refresh_table_display.

ENDMETHOD.

Read only

0 Likes
525

hii try this,

PERFORM free.

*Creating object of container

CREATE OBJECT c_container1

EXPORTING

container_name = 'CONTAINER1'.

*Creating object of alv

CREATE OBJECT c_alv1

EXPORTING

i_parent = c_container1.

wa_layout1-zebra = 'X'.

CALL METHOD c_alv1->set_table_for_first_display

EXPORTING

is_layout = wa_layout1

CHANGING

it_outtab = <dyn_table3>

it_fieldcatalog = it_fieldcat2.

___________________________form free. for second grid.

IF c_alv1 IS NOT INITIAL.

CALL METHOD c_alv1->free

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

OTHERS = 3.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

FREE c_alv1.

ENDIF.

ENDIF.

IF c_container1 IS NOT INITIAL.

CALL METHOD c_container1->free

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

OTHERS = 3.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

FREE c_container1.

ENDIF.

ENDIF.

Read only

0 Likes
525

Hello,

Thank you veeeeery much, this worked perfect exactly what I needed, I really appreciate your help.