Skip to Content
author's profile photo Former Member
Former Member

alv reports

Hi,

how can Refresh in alv interavctive reports using function modules?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 04:57 AM

    Hi Nagendra,

    Go thru this Link...........

    Refresh ALV GRID report

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 23, 2007 at 04:45 AM

    In the User command subroutine, you can set this parameter of the SELFIELD structure.

    RS_SELFIELD-REFRESH = 'X'.

    But you need to refresh the existing data than you need to first refresh you data with the updated values and then you can use the thsi RS_SELFIELD-REFRESH = 'X'.

    Regards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 23, 2007 at 04:46 AM

    Hi,

    Following report is the sample report for refresh alv report.

    REPORT YMS_REFRESHALV.

    TABLES :T247.

    TYPE-POOLS SLIS. "Type definitions for alv report

    DATA: IT_FIELDCAT TYPE LVC_T_FCAT,

    WA_FIELDCAT TYPE LVC_S_FCAT.

    DATA: WA_LAYOUT TYPE LVC_S_LAYO.

    DATA : BEGIN OF IT_FINAL OCCURS 0,

    CHECK(1),

    CELLTAB TYPE LVC_T_STYL, " Switch between display/change

    MNR LIKE T247-MNR,

    LTX LIKE T247-LTX,

    END OF IT_FINAL.

    DATA : WA_FINAL LIKE IT_FINAL.

    DATA : W_REPID LIKE SY-REPID.

    W_REPID = SY-REPID.

    REFRESH IT_FINAL.

    SELECT MNR LTX

    FROM T247

    INTO CORRESPONDING FIELDS OF TABLE IT_FINAL

    WHERE SPRAS EQ 'E'.

    WA_FIELDCAT-FIELDNAME = 'CHECK'.

    WA_FIELDCAT-TABNAME = 'IT_FINAL'.

    WA_FIELDCAT-CHECKBOX = 'X'.

    WA_FIELDCAT-EDIT = 'X'..

    WA_FIELDCAT-OUTPUTLEN = '3'.

    WA_FIELDCAT-COL_POS = '1'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'MNR'.

    WA_FIELDCAT-TABNAME = 'IT_FINAL'.

    WA_FIELDCAT-OUTPUTLEN = '8'.

    WA_FIELDCAT-COL_POS = '2'.

    WA_FIELDCAT-REPTEXT = 'Month'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    WA_FIELDCAT-FIELDNAME = 'LTX'.

    WA_FIELDCAT-TABNAME = 'IT_FINAL'.

    WA_FIELDCAT-OUTPUTLEN = '20'.

    WA_FIELDCAT-COL_POS = '3'.

    WA_FIELDCAT-REPTEXT = 'Month Desc'.

    APPEND WA_FIELDCAT TO IT_FIELDCAT.

    CLEAR WA_FIELDCAT.

    DATA: WA_CELLTAB TYPE LVC_S_STYL,

    IT_CELLTAB TYPE LVC_T_STYL,

    L_INDEX TYPE I.

    CLEAR : WA_CELLTAB,WA_FINAL,IT_CELLTAB.

    REFRESH IT_CELLTAB.

    *Initialize the celltab table

    LOOP AT IT_FINAL INTO WA_FINAL.

    L_INDEX = SY-TABIX.

    WA_CELLTAB-FIELDNAME = 'CHECK'.

    WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_ENABLED.

    INSERT WA_CELLTAB INTO TABLE IT_CELLTAB.

    INSERT LINES OF IT_CELLTAB INTO TABLE WA_FINAL-CELLTAB.

    MODIFY IT_FINAL FROM WA_FINAL INDEX L_INDEX.

    ENDLOOP.

    *Make the first five 5 rows as disabled

    CLEAR L_INDEX.

    LOOP AT IT_FINAL INTO WA_FINAL.

    L_INDEX = SY-TABIX.

    IF SY-TABIX LE 5.

    LOOP AT WA_FINAL-CELLTAB INTO WA_CELLTAB.

    IF WA_CELLTAB-FIELDNAME EQ 'CHECK' .

    WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

    MODIFY WA_FINAL-CELLTAB FROM WA_CELLTAB.

    MODIFY IT_FINAL INDEX L_INDEX FROM WA_FINAL TRANSPORTING CELLTAB.

    ENDIF.

    ENDLOOP.

    ENDIF.

    ENDLOOP.

    WA_LAYOUT-BOX_FNAME = 'CHECK'.

    WA_LAYOUT-NO_ROWMARK = 'X'.

    WA_LAYOUT-STYLEFNAME = 'CELLTAB'.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

    EXPORTING

    I_CALLBACK_PROGRAM = W_REPID

    I_GRID_TITLE = 'GRID DISPLAY'

    IS_LAYOUT_LVC = WA_LAYOUT

    IT_FIELDCAT_LVC = IT_FIELDCAT

    TABLES

    T_OUTTAB = IT_FINAL

    EXCEPTIONS

    PROGRAM_ERROR = 1

    OTHERS = 2.

    Thanks,

    Sankar M

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 23, 2007 at 05:01 AM

    HI

    see this report

    REPORT ZZ_ALV2.

    >********************************************************************

    • This report displays User's info (SM04) using the FM : *

    • REUSE_ALV_LIST_DISPLAY *

    • The list is auto-refreshed (refresh time : 5 seconds) *

    ----


    TYPE-POOLS: slis. " ALV Global Types

    DATA :

    gt_user LIKE uinfo OCCURS 0 WITH HEADER LINE. " User info in SM04

    ----


    START-OF-SELECTION.

    PERFORM f_read_data.

    PERFORM f_display_data.

    ----


    • Form F_LIRE_DATA

    ----


    FORM f_read_data.

    REFRESH gt_user.

    • Get User's info

    CALL FUNCTION 'THUSRINFO'

    TABLES

    usr_tabl = gt_user.

    • Wait in a task

    PERFORM f_call_rfc_wait.

    ENDFORM. " F_READ_DATA

    ----


    • Form F_DISPLAY_DATA

    ----


    FORM f_display_data.

    DEFINE m_sort.

    add 1 to ls_sort-spos.

    ls_sort-fieldname = &1.

    append ls_sort to lt_sort.

    END-OF-DEFINITION.

    DEFINE m_event_exit.

    clear ls_event_exit.

    ls_event_exit-ucomm = &1.

    ls_event_exit-after = 'X'.

    append ls_event_exit to lt_event_exit.

    END-OF-DEFINITION.

    DATA :

    ls_layout TYPE slis_layout_alv,

    lt_sort TYPE slis_t_sortinfo_alv,

    ls_sort TYPE slis_sortinfo_alv,

    lt_event_exit TYPE slis_t_event_exit,

    ls_event_exit TYPE slis_event_exit.

    • Build Sort Table

    m_sort 'ZEIT'.

    • Build Event Exit Table

    m_event_exit '&NTE'. " Refresh

    ls_layout-zebra = 'X'.

    ls_layout-colwidth_optimize = 'X'.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    i_callback_program = sy-cprog

    i_callback_user_command = 'USER_COMMAND'

    is_layout = ls_layout

    i_structure_name = 'UINFO'

    it_sort = lt_sort

    it_event_exit = lt_event_exit

    TABLES

    t_outtab = gt_user.

    ENDFORM. " F_DISPLAY_DATA

    ----


    • FORM USER_COMMAND *

    ----


    FORM user_command USING i_ucomm TYPE syucomm

    is_selfield TYPE slis_selfield. "#EC CALLED

    CASE i_ucomm.

    WHEN '&NTE'.

    PERFORM f_read_data.

    is_selfield-refresh = 'X'.

    SET USER-COMMAND '&OPT'. " Optimize columns width

    ENDCASE.

    ENDFORM. " USER_COMMAND

    ----


    • Form F_CALL_RFC_WAIT

    ----


    FORM f_call_rfc_wait.

    DATA lv_mssg(80). "#EC NEEDED

    • Wait in a task

    CALL FUNCTION 'RFC_PING_AND_WAIT' STARTING NEW TASK '001'

    PERFORMING f_task_end ON END OF TASK

    EXPORTING

    seconds = 5 " Refresh time

    busy_waiting = space

    EXCEPTIONS

    RESOURCE_FAILURE = 1

    communication_failure = 2 MESSAGE lv_mssg

    system_failure = 3 MESSAGE lv_mssg

    OTHERS = 4.

    ENDFORM. " F_CALL_RFC_WAIT

    ----


    • Form F_TASK_END

    ----


    FORM f_task_end USING u_taskname.

    DATA lv_mssg(80). "#EC NEEDED

    • Receiving task results

    RECEIVE RESULTS FROM FUNCTION 'RFC_PING_AND_WAIT'

    EXCEPTIONS

    RESOURCE_FAILURE = 1

    communication_failure = 2 MESSAGE lv_mssg

    system_failure = 3 MESSAGE lv_mssg

    OTHERS = 4.

    CHECK sy-subrc EQ 0.

    SET USER-COMMAND '&NTE'. " Refresh

    ENDFORM. " F_TASK_END

    • END OF PROGRAM Z_ALV_AUTO_REFRESH *********************

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.