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

Refresh table display is not working

Former Member
0 Likes
3,966

Hi Experts ,

In my pgm i am displaying an ALV grid in the container . When the user double clicks on some fields above the ALV container , i am modifying the same internal table with some other records and iam displaying the same in the ALV . But it is showing the same old data . I tried Refrsh_table_display also .but it is not working . In the debugging i saw that the data are populated exactly .

I have pasted my code here . Kindly help me . Points will be rewarded .

&----


*& Module STATUS_9015 OUTPUT

&----


  • PBO for 9015 Screen

----


MODULE status_9015 OUTPUT.

SET PF-STATUS 'SC9015'.

SET TITLEBAR 'T05' WITH g_title .

  • Creating the Container

CREATE OBJECT custom_container

EXPORTING

container_name = 'SLOT_DET'

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Create and Assign the Grid to Container

CREATE OBJECT alv_grid

EXPORTING

i_parent = custom_container

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Form for building the field catalog

PERFORM build_fieldcatalog.

  • For Layout

g_layout-sel_mode = 'A'.

g_layout-ctab_fname = 'CELLCOL'.

g_layout-info_fname = 'ROWCOLL'.

  • For dispalying the ALV Grid in the Container

CALL METHOD alv_grid->set_table_for_first_display

EXPORTING

is_variant = gs_variant

i_save = x_save

is_layout = g_layout

CHANGING

it_outtab = tb_slots_det[]

it_fieldcatalog = tb_fcat_slot[].

IF sy-subrc <> 0.

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

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

ENDIF.

CREATE OBJECT event_trigger .

SET HANDLER event_trigger->handle_toolbar FOR alv_grid.

    • Raise event toolbar to show the modified toolbar

CALL METHOD alv_grid->set_toolbar_interactive.

  • CREATE OBJECT event_trigger.

SET HANDLER event_trigger->handle_double_click FOR alv_grid.

ENDMODULE. " STATUS_9015 OUTPUT

&----


*& Module USER_COMMAND_9015 INPUT

&----


  • PAI of 9015 Screen

----


MODULE user_command_9015 INPUT.

DATA : l_flag2 TYPE c .

DATA: ls_stable TYPE lvc_s_stbl.

ls_stable-row = 'X'.

ls_stable-col = 'X'.

CASE sy-ucomm .

WHEN 'BACK' OR 'EXIT' OR 'CANC' .

SET SCREEN 0 .

LEAVE SCREEN .

  • When Shipment Status button selected

WHEN 'INFO'.

GET CURSOR FIELD g_fieldname .

IF g_fieldname = 'G_LIVE' OR g_fieldname = 'G_DROP'

OR g_fieldname = 'G_HR1' .

l_flag2 = 'X' .

TB_SLOTS_DET1[] = TB_SLOTS_DET .

ELSE .

CALL SCREEN 9201 STARTING AT 5 5

ENDING AT 60 16.

ENDIF .

ENDCASE .

IF l_flag2 = 'X' .

IF g_fieldname = 'G_LIVE'.

REFRESH tb_slots_det .

LOOP AT tb_slots_det1 INTO wa_slots_det1 WHERE zzlive = 'L' .

MOVE wa_slots_det1 TO wa_slots_det .

APPEND wa_slots_det TO tb_slots_det .

CLEAR wa_slots_det .

ENDLOOP .

ENDIF .

IF g_fieldname = 'G_DROP'.

REFRESH tb_slots_det .

LOOP AT tb_slots_det1 INTO wa_slots_det1 WHERE zzlive = 'D' .

MOVE wa_slots_det1 TO wa_slots_det .

APPEND wa_slots_det TO tb_slots_det.

CLEAR wa_slots_det .

ENDLOOP .

ENDIF .

IF g_fieldname = 'G_HR1'.

REFRESH tb_slots_det .

LOOP AT tb_slots_det1 INTO wa_slots_det1 WHERE tknum IS NOT INITIAL AND load_time => 0 AND load_time <= 1 .

MOVE wa_slots_det1 TO wa_slots_det .

APPEND wa_slots_det TO tb_slots_det.

CLEAR wa_slots_det .

ENDLOOP .

ENDIF .

  • Refreshing the ALV Grid .

CALL METHOD alv_grid->refresh_table_display

EXPORTING

is_stable = ls_stable

i_soft_refresh = 'X'.

CLEAR l_flag2 .

ENDIF .

*

ENDMODULE. " USER_COMMAND_9015 INPUT

Hi Experts ,

In my pgm i am displaying an ALV grid in the container . When the user double clicks on some fields above the ALV container , i am modifying the same internal table with some other records and iam displaying the same in the ALV . But it is showing the same old data . I tried Refrsh_table_display also .but it is not working . In the debugging i saw that the data are populated exactly .

I have pasted my code here . Kindly help me . Points will be rewarded .

&----


*& Module STATUS_9015 OUTPUT

&----


  • PBO for 9015 Screen

----


MODULE status_9015 OUTPUT.

SET PF-STATUS 'SC9015'.

SET TITLEBAR 'T05' WITH g_title .

  • Creating the Container

CREATE OBJECT custom_container

EXPORTING

container_name = 'SLOT_DET'

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Create and Assign the Grid to Container

CREATE OBJECT alv_grid

EXPORTING

i_parent = custom_container

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Form for building the field catalog

PERFORM build_fieldcatalog.

  • For Layout

g_layout-sel_mode = 'A'.

g_layout-ctab_fname = 'CELLCOL'.

g_layout-info_fname = 'ROWCOLL'.

  • For dispalying the ALV Grid in the Container

CALL METHOD alv_grid->set_table_for_first_display

EXPORTING

is_variant = gs_variant

i_save = x_save

is_layout = g_layout

CHANGING

it_outtab = tb_slots_det[]

it_fieldcatalog = tb_fcat_slot[].

IF sy-subrc <> 0.

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

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

ENDIF.

CREATE OBJECT event_trigger .

SET HANDLER event_trigger->handle_toolbar FOR alv_grid.

    • Raise event toolbar to show the modified toolbar

CALL METHOD alv_grid->set_toolbar_interactive.

  • CREATE OBJECT event_trigger.

SET HANDLER event_trigger->handle_double_click FOR alv_grid.

ENDMODULE. " STATUS_9015 OUTPUT

&----


*& Module USER_COMMAND_9015 INPUT

&----


  • PAI of 9015 Screen

----


MODULE user_command_9015 INPUT.

DATA : l_flag2 TYPE c .

DATA: ls_stable TYPE lvc_s_stbl.

ls_stable-row = 'X'.

ls_stable-col = 'X'.

CASE sy-ucomm .

WHEN 'BACK' OR 'EXIT' OR 'CANC' .

SET SCREEN 0 .

LEAVE SCREEN .

  • When Shipment Status button selected

WHEN 'INFO'.

GET CURSOR FIELD g_fieldname .

IF g_fieldname = 'G_LIVE' OR g_fieldname = 'G_DROP'

OR g_fieldname = 'G_HR1' .

l_flag2 = 'X' .

TB_SLOTS_DET1[] = TB_SLOTS_DET .

ELSE .

CALL SCREEN 9201 STARTING AT 5 5

ENDING AT 60 16.

ENDIF .

ENDCASE .

IF l_flag2 = 'X' .

IF g_fieldname = 'G_LIVE'.

REFRESH tb_slots_det .

LOOP AT tb_slots_det1 INTO wa_slots_det1 WHERE zzlive = 'L' .

MOVE wa_slots_det1 TO wa_slots_det .

APPEND wa_slots_det TO tb_slots_det .

CLEAR wa_slots_det .

ENDLOOP .

ENDIF .

IF g_fieldname = 'G_DROP'.

REFRESH tb_slots_det .

LOOP AT tb_slots_det1 INTO wa_slots_det1 WHERE zzlive = 'D' .

MOVE wa_slots_det1 TO wa_slots_det .

APPEND wa_slots_det TO tb_slots_det.

CLEAR wa_slots_det .

ENDLOOP .

ENDIF .

IF g_fieldname = 'G_HR1'.

REFRESH tb_slots_det .

LOOP AT tb_slots_det1 INTO wa_slots_det1 WHERE tknum IS NOT INITIAL AND load_time => 0 AND load_time <= 1 .

MOVE wa_slots_det1 TO wa_slots_det .

APPEND wa_slots_det TO tb_slots_det.

CLEAR wa_slots_det .

ENDLOOP .

ENDIF .

  • Refreshing the ALV Grid .

CALL METHOD alv_grid->refresh_table_display

EXPORTING

is_stable = ls_stable

i_soft_refresh = 'X'.

CLEAR l_flag2 .

ENDIF .

*

ENDMODULE. " USER_COMMAND_9015 INPUT

2 REPLIES 2
Read only

Former Member
0 Likes
918

Hi Senthil,

Try this :


if alv_grid is initial.
  CALL METHOD alv_grid->set_table_for_first_display
    EXPORTING
      is_variant = gs_variant
      i_save = x_save
      is_layout = g_layout
    CHANGING
      it_outtab = tb_slots_det[]
      it_fieldcatalog = tb_fcat_slot[].
else.
  CALL METHOD alv_grid->refresh_table_display
    EXPORTING
      is_stable = ls_stable
      i_soft_refresh = 'X'.
endif.

remove the CALL METHOD alv_grid->refresh_table_display from the PAI.

Hope this works.

Regards

Anil Madhavan

Read only

Former Member
0 Likes
918

Hi Senthil,

A small mistake..try this one.

if custom_container is initial.

CREATE OBJECT custom_container

EXPORTING

container_name = 'SLOT_DET'

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Create and Assign the Grid to Container

CREATE OBJECT alv_grid

EXPORTING

i_parent = custom_container

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Form for building the field catalog

PERFORM build_fieldcatalog.

  • For Layout

g_layout-sel_mode = 'A'.

g_layout-ctab_fname = 'CELLCOL'.

g_layout-info_fname = 'ROWCOLL'.

CALL METHOD alv_grid->set_table_for_first_display

EXPORTING

is_variant = gs_variant

i_save = x_save

is_layout = g_layout

CHANGING

it_outtab = tb_slots_det[]

it_fieldcatalog = tb_fcat_slot[].

IF sy-subrc <> 0.

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

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

ENDIF.

else.

CALL METHOD alv_grid->refresh_table_display

EXPORTING

is_stable = ls_stable

i_soft_refresh = 'X'.

endif.

This should work.

Regards

Anil Madhavan