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 ALV Report after return from dialog screen

Former Member
0 Kudos
2,345

Hi All,

I have developed an alv report which lists new products, when user clicks on a product it will take to custom dialog screen where user makes neccessary changes. Once the changes are done user clicks back the control comes back to the ALV report.

My question is when they come back to ALV report it should refresh and list the new products. Basically I want to know is it possible to refresh the report when control is coming back from dialog screen to ALV report.

Pls provide me a best way to handle this scenario.

Regards,

Anand

7 REPLIES 7

Former Member
0 Kudos
508

Hi,

Just modify the internal table contents and refresh the internal table when u come back to that screen from dialog.

Regards,

Archna

0 Kudos
508

Hi Archna

This is the code I am using

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

i_callback_user_command = 'USER_COMMAND'

i_callback_top_of_page = 'TOP_OF_PAGE'

i_grid_title = i_title

it_fieldcat = it_fcat

it_events = v_events

i_save = 'A'

TABLES

t_outtab = it_alv_cvg.

FORM user_command USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN '&IC1'.

READ TABLE it_alv_map INTO wa_alv INDEX rs_selfield-tabindex.

IF sy-subrc = 0.

SET PARAMETER ID 'ZCR' FIELD wa_alv-product.

CALL TRANSACTION 'ZSD_PRODUCT_DIV' AND SKIP FIRST SCREEN.

ENDIF.

ENDCASE.

ENDFORM.

After it goes to dialog when I clcik back it comes back to the alv report.

Now can you Pls tell me where to use the refresh.

Regards,

Anand

0 Kudos
508

Hi Anand,

In the user command callback, set


rs_selfield-refresh = 'X'.

that will reload the ALV content (and use rs_selfield-row_stable = 'X' to keep the list displayed from the same row)

Sandra

Former Member
0 Kudos
508

On click BACK, fetch the data again and use CALL METHOD grid->refresh_table_display.

Regards

Aravind.

0 Kudos
508

I have not use method to display the alv report. I dont know how to incorporate this in my logic. When it is coming from dialog, I am not getting sy-ucomm = BACK. Dnt know how to get the control from dialog.

Former Member
0 Kudos
508

Hi,

You have to combine the comments. Firstly internal table has to be updated with changed data then On click BACK, data needs to be fetched again with CALL METHOD grid->refresh_table_display.

Regards,

Aabha

former_member213437
Active Participant
0 Kudos
508

Hi Araj Fallow this..


IF IT_OUTBOUND[] IS INITIAL AND C_ALVGD_110 IS NOT INITIAL.  "c_alvg_110 is an object

    CALL METHOD C_ALVGD_110->FREE.
    CALL METHOD C_OUT->FREE.
    CLEAR C_OUT.
    CLEAR C_ALVGD_110.
    CALL METHOD CL_GUI_CFW=>FLUSH.

  ENDIF.

  IF C_ALVGD_110 IS INITIAL.

    CREATE OBJECT C_OUT
      EXPORTING
        CONTAINER_NAME = 'C_OUT_1'.

    CREATE OBJECT C_ALVGD_110
      EXPORTING
        I_PARENT      = C_OUT
        I_APPL_EVENTS = 'X'.
  ENDIF.



  IF IT_OUTBOUND[] IS NOT INITIAL AND SY-UCOMM <> 'BACK'.

    CALL METHOD C_ALVGD_110->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
        IS_LAYOUT                     = IT_LAYOUT_110
        IT_TOOLBAR_EXCLUDING          = LT_EXCLUDE
      CHANGING
        IT_OUTTAB                     = IT_OUTBOUND[]
        IT_FIELDCATALOG               = IT_FCAT_110
      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.


with Regards

Murthy.