Skip to Content
avatar image
Former Member

ALV grid refresh after user_command

Hi all,

i have a problem with my code, i use 2 alv grids in my code and sometimes i need to refresh the alv grids, the problem is that the method grid->REFRESH_TABLE_DISPLAY works only as long as the PAI of screen 100 is not triggerd, it means, when i click on something that has a function code and will cause the PAI of screen 100 to be triggered, i can no more change the alv grids, does any one know where the problem is? thanks in advance.
here is my code:

CALL SCREEN 100.

MODULE status_0100 OUTPUT.

SET PF-STATUS 'STATUS'.

SET TITLEBAR 'TITLE'.

IF init is initial.

CREATE OBJECT container

EXPORTING container_name = 'CUSTOM'.

CREATE OBJECT splitter

EXPORTING

parent = container

rows = 3

columns = 1.

CALL METHOD splitter->get_container

EXPORTING

row = 1

column = 1

RECEIVING

container = container_1.

CALL METHOD splitter->get_container

EXPORTING

row = 2

column = 1

RECEIVING

container = container_2.

CALL METHOD splitter->get_container

EXPORTING

row = 3

column = 1

RECEIVING

container = container_3.

CALL METHOD splitter->set_row_height

EXPORTING

id = 1

height = 57.

CALL METHOD splitter->set_row_height

EXPORTING

id = 3

height = 39.

CREATE OBJECT grid1

EXPORTING

i_parent = container_1.

CREATE OBJECT grid2

EXPORTING

i_parent = container_3.

CALL METHOD grid1->set_table_for_first_display

EXPORTING

I_SAVE = 'A'

I_DEFAULT = 'X'

I_STRUCTURE_NAME = 'TAB_1'

CHANGING

it_outtab = TAB1

it_fieldcatalog = T_FIELDALV

EXCEPTIONS

INVALID_PARAMETER_COMBINATION = 1

PROGRAM_ERROR = 2

TOO_MANY_LINES = 3

others = 4.

CALL METHOD grid2->set_table_for_first_display

EXPORTING

I_SAVE = 'A'

I_DEFAULT = 'X'

I_STRUCTURE_NAME = 'TAB_2'

CHANGING

it_outtab = TAB2

it_fieldcatalog = T_FIELDALV_2

EXCEPTIONS

INVALID_PARAMETER_COMBINATION = 1

PROGRAM_ERROR = 2

TOO_MANY_LINES = 3

others = 4.

CREATE OBJECT GR_EVENT_HANDLR.

SET HANDLER gr_event_handlr->handle_double_click FOR grid1.

CALL METHOD grid2->REFRESH_TABLE_DISPLAY.

ENDIF.

ENDMODULE.

MODULE user_command_0100 INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.

LEAVE TO SCREEN 0.

WHEN 'EXITPUSH'.

LEAVE TO SCREEN 0.

WHEN 'ADDPUSH'.

CALL SCREEN 200.

WHEN 'RADIO'.
IF r1 = 'X'.

PERFORM LOAD_GRID_TABLE1.

CALL METHOD grid1->REFRESH_TABLE_DISPLAY.

ENDIF.

IF r2 = 'X'.

PERFORM LOAD_GRID_TABLE2.

CALL METHOD grid1->REFRESH_TABLE_DISPLAY.

ENDIF.

ENDCASE.

ENDMODULE.

MODULE user_command_0200 INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.

CLEAR ok_code.

LEAVE TO SCREEN 100.

ENDCASE.

ENDMODULE.

MODULE status_0200 OUTPUT.

SET PF-STATUS 'STATUS'.

SET TITLEBAR 'TITLE'.

ENDMODULE.

CLASS event_class IMPLEMENTATION.

METHOD handle_double_click.

READ TABLE TAB1 INTO T_TAB INDEX e_row-index.

SELECT ZINSURANCE~FAMILYMEMBER ZINSURANCE~DAMAGTYPE ZINSURANCE~VISITTYPE

ZINSURANCE~XDATE ZINSURANCE~PARATYPE ZINSURANCE~PAIDVAL ZINSURANCE~CONFIRMEDVAL ZINSURANCE~PUREVAL

ZINSURANCE~FRANSHIZ PA0002~VORNA PA0002~NACHN

FROM ZINSURANCE JOIN PA0002 ON ZINSURANCE~PERNR = PA0002~PERNR

INTO TABLE TAB2

WHERE ZINSURANCE~PERNR = T_TAB-PERNR

ORDER BY ZINSURANCE~XDATE.

CALL METHOD grid2->REFRESH_TABLE_DISPLAY.

ENDMETHOD.

ENDCLASS.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Jun 05, 2012 at 09:58 AM

    Hi Masood,

    use the below satement to free the alv objects...

    if grid1 is not initial.

    CALL METHOD grid1->free

    else.

    free grid1.

    endif.

    if grid2 is not initial.

    CALL METHOD grid2->free

    else.

    free grid1.

    endif.

    if container_1 is not initial.

    CALL METHOD container_1->free

    else.

    free container_1.

    endif.

    if container_2 is not initial.

    CALL METHOD container_2->free

    else.

    free container_2.

    endif.

    if splitter is not initial.

    CALL METHOD splitter->free

    else.

    free splitter.

    endif.

    ........

    ......

    same way u must free all da object...

    Add comment
    10|10000 characters needed characters exceeded

    • bro..

      If you still facing da proble then i guss the problem is with this "IF init is initial" statement.

      bcz if "init" containing some value even after the refresh it wont go inside da condition nd display da ALV.

      So after free all objects ,make sure that the program flow go to the alv display.......).

  • avatar image
    Former Member
    Jun 12, 2012 at 06:07 AM

    it didn't solve my problem, here is what i get when i run the program,

    and when i click on any button or radio button that will cause the PAI of the screen 100 to be triggered i get the following,

    and yes, i modified my code so that there is no more "if init is initial" in the PBO of the screen 100, and i inserted at the beginning of the PBO 100 the following statement:

    if grid1 is not initial.
    CALL METHOD grid1->free.
    else.
    free grid1.
    endif.

    if grid2 is not initial.
    CALL METHOD grid2->free.
    else.
    free grid1.
    endif.

    if container_1 is not initial.
    CALL METHOD container_1->free.
    else.
    free container_1.
    endif.

    if container_2 is not initial.
    CALL METHOD container_2->free.
    else.
    free container_2.
    endif.

    if splitter is not initial.
    CALL METHOD splitter->free.
    else.
    free splitter.
    endif.

    and after that i create objects and display grids.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 06, 2012 at 05:45 AM

    Hi,

    I also had a problem with REFRESH_TABLE_DISPLAY. Instead of this I used SET_FOR_FIRST_DISLPAY again and it worked.

    Cheers,

    S

    Add comment
    10|10000 characters needed characters exceeded