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 OO doesn't refresh the displayed data

Marcos_F_Dotta
Participant
0 Likes
5,640

Hi guys,

I developed a report using ALV and when I select an Item and press the button another ALV OO is started. So the details are displayed. But when I back and select another Item to show its details the ALV OO shows only the first details displayed before... I can't find the problem. I used the method to refresh the table when I leave the screen, but it didn't work.

So, can someone help me with any suggestion or know this problem and solved it before??

The code is attached.

Thanks!

Regards,

Marcos Fernando Dotta

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
3,143

Try flushing the ALV in PBO of second ALV using the method  CALL METHOD cl_gui_cfw=>flush.

Or you can Free both ALV gird object and Container and recreate them all the time you call the 2nd ALV.

Regards,
Naimesh Patel

Hi guys,

I developed a report using ALV and when I select an Item and press the button another ALV OO is started. So the details are displayed. But when I back and select another Item to show its details the ALV OO shows only the first details displayed before... I can't find the problem. I used the method to refresh the table when I leave the screen, but it didn't work.

So, can someone help me with any suggestion or know this problem and solved it before??

The code is attached.

Thanks!

Regards,

Marcos Fernando Dotta

7 REPLIES 7
Read only

naimesh_patel
Active Contributor
3,144

Try flushing the ALV in PBO of second ALV using the method  CALL METHOD cl_gui_cfw=>flush.

Or you can Free both ALV gird object and Container and recreate them all the time you call the 2nd ALV.

Regards,
Naimesh Patel

Read only

0 Likes
3,143

Hi Namesh,

I tried with the method, but it didn't work. I already clear and free the objects, but it doesn't work too.

What could be the problem??

Thanks!!

Regards,

Marcos Fernando Dotta

Read only

0 Likes
3,143

Hi,

If you are using FREE abap statement for free the container and alv objects  doesn't works.

You should use the methods FREE for each class before to close the second ALV and create the objects again all the times you call it...

 

   CALL METHOD v_grid->free
  EXCEPTIONS
    cntl_error        = 1
    cntl_system_error = 2
    others            = 3.

CALL METHOD v_container->free
  EXCEPTIONS
    cntl_error        = 1
    cntl_system_error = 2
    others            = 3.

Read only

0 Likes
3,143

Hi,

Marcos Fernando Dotta wrote:

Hi Namesh,

I tried with the method, but it didn't work. I already clear and free the objects, but it doesn't work too.

What could be the problem??

Thanks!!

Regards,

Marcos Fernando Dotta

You first have to free the ressources used by your object before actually clearing it

Don't know if this can solve your issue but I would give this a try...

Regards,

Manu.

Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
3,143

You may like to check this post. It may be helpful.

http://scn.sap.com/people/uwe.schieferstein/blog/2010/10/12/against-all-odds--programming-of-communi...

Or else post your program in .txt file so that we can try to find out the problem

Read only

0 Likes
3,143

I checked the code and it seems like there is no need for the OO-ABAP code to refresh the ALV display.

You already have an ALV Display with a FM Call for 'REUSE_ALV_GRID_DISPLAY' and then at the back button again the container and grid objects are being instantiated etc etc.

ALV Table Data can refreshed by just using these steps:

Step 1. Set slis_selfield-refresh = 'X' in the user_command module on REFRESH User Command (in your case BACK or whatever)

Step 2.  Add this user command to the Callback function - ZF_ALV_USER_COMMAND

The report will get refreshed with the data on Back button.

Regards,

Shyam

Read only

Former Member
0 Likes
3,143

Have you checked if you have cleared the internal table before using it the second time?

Have you tried refreshing in the following manner:

IF o_grid_item IS INITIAL.

    CREATE OBJECT O_CONTAINER_ITEM

      EXPORTING

        CONTAINER_NAME              = 'CONTAINER_ITEM'

        REPID                       =  sy-repid

        DYNNR                       = sy-dynnr

      EXCEPTIONS

        CNTL_ERROR                  = 1

        CNTL_SYSTEM_ERROR           = 2

        CREATE_ERROR                = 3

        LIFETIME_ERROR              = 4

        LIFETIME_DYNPRO_DYNPRO_LINK = 5

        others                      = 6

        .

    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 O_GRID_ITEM

     EXPORTING

       I_PARENT          = o_container_item

     EXCEPTIONS

       ERROR_CNTL_CREATE = 1

       ERROR_CNTL_INIT   = 2

       ERROR_CNTL_LINK   = 3

       ERROR_DP_CREATE   = 4

       others            = 5

       .

   IF SY-SUBRC <> 0.

    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ENDIF.

   CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

    EXPORTING

      I_STRUCTURE_NAME             = 'TY_FINAL2'

     CHANGING

       CT_FIELDCAT                  = it_fieldcat2

    EXCEPTIONS

      INCONSISTENT_INTERFACE       = 1

      PROGRAM_ERROR                = 2

      OTHERS                       = 3

             .

   IF SY-SUBRC <> 0.

  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ENDIF.

   CALL METHOD O_GRID_ITEM->SET_TABLE_FOR_FIRST_DISPLAY

     EXPORTING

       I_STRUCTURE_NAME              =   'TY_FINAL2'

       IS_LAYOUT                     = wa_layout

     CHANGING

       IT_OUTTAB                     = it_final2

       IT_FIELDCATALOG               = it_fieldcat2

     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.

   ELSE.

     CALL METHOD O_GRID_ITEM->REFRESH_TABLE_DISPLAY

*      EXPORTING

*        IS_STABLE      =

*        I_SOFT_REFRESH =

       EXCEPTIONS

         FINISHED       = 1

         others         = 2

             .

     IF SY-SUBRC <> 0.

      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

     ENDIF.

   ENDIF.