ALV Grid is not refreshed












1















I have two screens (screen A and screen B) in my module pool program. Screen A displays ALV grid and has 1 button on the toolbar and Screen B also displays ALV grid and 1 button on the toolbar.

When I press the button "Show orders" on screen A, I am directed to the screen B. Then I do some edit operations on screen B, click 'Save' button on the toolbar and then 'Back' button.
When I press the button "Show orders" on screen A for a different row, I am directed to the screen B again, but ALV grid still shows data from the first material, i.e. it doesn't display new data, but displays old data.
Does it have to do with cl_gui_cfw=>flush method somehow? If yes, then where exactly in the code should I call it in order to display correct data?



PBO module of Screen B.



CREATE OBJECT zclmz_pp_md_create=>go_container_charg
EXPORTING
parent = cl_gui_container=>screen0
side = cl_gui_docking_container=>dock_at_top
extension = 800.

CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
EXPORTING
i_parent = zclmz_pp_md_create=>go_container_charg.

zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
charg it_fieldcatalog = lt_fieldcat ).


PAI module of Screen B.



zclmz_pp_md_create=>go_alv_charg->refresh_table_display( EXPORTING is_stable = ls_stable ).

CALL METHOD cl_gui_cfw=>flush.









share|improve this question





























    1















    I have two screens (screen A and screen B) in my module pool program. Screen A displays ALV grid and has 1 button on the toolbar and Screen B also displays ALV grid and 1 button on the toolbar.

    When I press the button "Show orders" on screen A, I am directed to the screen B. Then I do some edit operations on screen B, click 'Save' button on the toolbar and then 'Back' button.
    When I press the button "Show orders" on screen A for a different row, I am directed to the screen B again, but ALV grid still shows data from the first material, i.e. it doesn't display new data, but displays old data.
    Does it have to do with cl_gui_cfw=>flush method somehow? If yes, then where exactly in the code should I call it in order to display correct data?



    PBO module of Screen B.



    CREATE OBJECT zclmz_pp_md_create=>go_container_charg
    EXPORTING
    parent = cl_gui_container=>screen0
    side = cl_gui_docking_container=>dock_at_top
    extension = 800.

    CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
    EXPORTING
    i_parent = zclmz_pp_md_create=>go_container_charg.

    zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
    is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
    charg it_fieldcatalog = lt_fieldcat ).


    PAI module of Screen B.



    zclmz_pp_md_create=>go_alv_charg->refresh_table_display( EXPORTING is_stable = ls_stable ).

    CALL METHOD cl_gui_cfw=>flush.









    share|improve this question



























      1












      1








      1








      I have two screens (screen A and screen B) in my module pool program. Screen A displays ALV grid and has 1 button on the toolbar and Screen B also displays ALV grid and 1 button on the toolbar.

      When I press the button "Show orders" on screen A, I am directed to the screen B. Then I do some edit operations on screen B, click 'Save' button on the toolbar and then 'Back' button.
      When I press the button "Show orders" on screen A for a different row, I am directed to the screen B again, but ALV grid still shows data from the first material, i.e. it doesn't display new data, but displays old data.
      Does it have to do with cl_gui_cfw=>flush method somehow? If yes, then where exactly in the code should I call it in order to display correct data?



      PBO module of Screen B.



      CREATE OBJECT zclmz_pp_md_create=>go_container_charg
      EXPORTING
      parent = cl_gui_container=>screen0
      side = cl_gui_docking_container=>dock_at_top
      extension = 800.

      CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
      EXPORTING
      i_parent = zclmz_pp_md_create=>go_container_charg.

      zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
      is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
      charg it_fieldcatalog = lt_fieldcat ).


      PAI module of Screen B.



      zclmz_pp_md_create=>go_alv_charg->refresh_table_display( EXPORTING is_stable = ls_stable ).

      CALL METHOD cl_gui_cfw=>flush.









      share|improve this question
















      I have two screens (screen A and screen B) in my module pool program. Screen A displays ALV grid and has 1 button on the toolbar and Screen B also displays ALV grid and 1 button on the toolbar.

      When I press the button "Show orders" on screen A, I am directed to the screen B. Then I do some edit operations on screen B, click 'Save' button on the toolbar and then 'Back' button.
      When I press the button "Show orders" on screen A for a different row, I am directed to the screen B again, but ALV grid still shows data from the first material, i.e. it doesn't display new data, but displays old data.
      Does it have to do with cl_gui_cfw=>flush method somehow? If yes, then where exactly in the code should I call it in order to display correct data?



      PBO module of Screen B.



      CREATE OBJECT zclmz_pp_md_create=>go_container_charg
      EXPORTING
      parent = cl_gui_container=>screen0
      side = cl_gui_docking_container=>dock_at_top
      extension = 800.

      CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
      EXPORTING
      i_parent = zclmz_pp_md_create=>go_container_charg.

      zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
      is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
      charg it_fieldcatalog = lt_fieldcat ).


      PAI module of Screen B.



      zclmz_pp_md_create=>go_alv_charg->refresh_table_display( EXPORTING is_stable = ls_stable ).

      CALL METHOD cl_gui_cfw=>flush.






      sap abap alv






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 hours ago









      Suncatcher

      3,82722554




      3,82722554










      asked Dec 29 '18 at 10:55









      Azat NuriakhmetovAzat Nuriakhmetov

      234




      234
























          2 Answers
          2






          active

          oldest

          votes


















          2














          Method refresh_table_display should be called in the PBO of screen B, not in the PAI.



          IF zclmz_pp_md_create=>go_alv_charg is NOT BOUND.
          CREATE OBJECT zclmz_pp_md_create=>go_container_charg
          EXPORTING
          parent = cl_gui_container=>screen0
          side = cl_gui_docking_container=>dock_at_top
          extension = 800.

          CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
          EXPORTING
          i_parent = zclmz_pp_md_create=>go_container_charg.

          zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
          is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
          charg it_fieldcatalog = lt_fieldcat ).
          ELSE.
          zclmz_pp_md_create=>go_alv_charg->refresh_table_display( ).
          ENDIF.





          share|improve this answer































            1














            That's a well-known issue with controls. If you instantiate a control (your ALV) inside a container in which there was already a control which has not been freed up, then the old control still shows up.



            Two solutions :




            • Either you keep instantiating the control, but then you must free the previous control. For this, you must use the method FREE, which is available for all kinds of controls (even the container itself can be freed, all its inner controls are then freed up).


            • Or you change the logic by instantiating the control only once, and you refresh its contents, like Laurens said.



            (the issue is not related to cl_gui_cfw=>flush by the way)






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53968887%2falv-grid-is-not-refreshed%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              Method refresh_table_display should be called in the PBO of screen B, not in the PAI.



              IF zclmz_pp_md_create=>go_alv_charg is NOT BOUND.
              CREATE OBJECT zclmz_pp_md_create=>go_container_charg
              EXPORTING
              parent = cl_gui_container=>screen0
              side = cl_gui_docking_container=>dock_at_top
              extension = 800.

              CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
              EXPORTING
              i_parent = zclmz_pp_md_create=>go_container_charg.

              zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
              is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
              charg it_fieldcatalog = lt_fieldcat ).
              ELSE.
              zclmz_pp_md_create=>go_alv_charg->refresh_table_display( ).
              ENDIF.





              share|improve this answer




























                2














                Method refresh_table_display should be called in the PBO of screen B, not in the PAI.



                IF zclmz_pp_md_create=>go_alv_charg is NOT BOUND.
                CREATE OBJECT zclmz_pp_md_create=>go_container_charg
                EXPORTING
                parent = cl_gui_container=>screen0
                side = cl_gui_docking_container=>dock_at_top
                extension = 800.

                CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
                EXPORTING
                i_parent = zclmz_pp_md_create=>go_container_charg.

                zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
                is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
                charg it_fieldcatalog = lt_fieldcat ).
                ELSE.
                zclmz_pp_md_create=>go_alv_charg->refresh_table_display( ).
                ENDIF.





                share|improve this answer


























                  2












                  2








                  2







                  Method refresh_table_display should be called in the PBO of screen B, not in the PAI.



                  IF zclmz_pp_md_create=>go_alv_charg is NOT BOUND.
                  CREATE OBJECT zclmz_pp_md_create=>go_container_charg
                  EXPORTING
                  parent = cl_gui_container=>screen0
                  side = cl_gui_docking_container=>dock_at_top
                  extension = 800.

                  CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
                  EXPORTING
                  i_parent = zclmz_pp_md_create=>go_container_charg.

                  zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
                  is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
                  charg it_fieldcatalog = lt_fieldcat ).
                  ELSE.
                  zclmz_pp_md_create=>go_alv_charg->refresh_table_display( ).
                  ENDIF.





                  share|improve this answer













                  Method refresh_table_display should be called in the PBO of screen B, not in the PAI.



                  IF zclmz_pp_md_create=>go_alv_charg is NOT BOUND.
                  CREATE OBJECT zclmz_pp_md_create=>go_container_charg
                  EXPORTING
                  parent = cl_gui_container=>screen0
                  side = cl_gui_docking_container=>dock_at_top
                  extension = 800.

                  CREATE OBJECT zclmz_pp_md_create=>go_alv_charg
                  EXPORTING
                  i_parent = zclmz_pp_md_create=>go_container_charg.

                  zclmz_pp_md_create=>go_alv_charg->set_table_for_first_display( EXPORTING
                  is_layout = ls_layout CHANGING it_outtab = zclmz_pp_md_create=>gs_plz-
                  charg it_fieldcatalog = lt_fieldcat ).
                  ELSE.
                  zclmz_pp_md_create=>go_alv_charg->refresh_table_display( ).
                  ENDIF.






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 29 '18 at 12:55









                  Laurens DeprostLaurens Deprost

                  968114




                  968114

























                      1














                      That's a well-known issue with controls. If you instantiate a control (your ALV) inside a container in which there was already a control which has not been freed up, then the old control still shows up.



                      Two solutions :




                      • Either you keep instantiating the control, but then you must free the previous control. For this, you must use the method FREE, which is available for all kinds of controls (even the container itself can be freed, all its inner controls are then freed up).


                      • Or you change the logic by instantiating the control only once, and you refresh its contents, like Laurens said.



                      (the issue is not related to cl_gui_cfw=>flush by the way)






                      share|improve this answer




























                        1














                        That's a well-known issue with controls. If you instantiate a control (your ALV) inside a container in which there was already a control which has not been freed up, then the old control still shows up.



                        Two solutions :




                        • Either you keep instantiating the control, but then you must free the previous control. For this, you must use the method FREE, which is available for all kinds of controls (even the container itself can be freed, all its inner controls are then freed up).


                        • Or you change the logic by instantiating the control only once, and you refresh its contents, like Laurens said.



                        (the issue is not related to cl_gui_cfw=>flush by the way)






                        share|improve this answer


























                          1












                          1








                          1







                          That's a well-known issue with controls. If you instantiate a control (your ALV) inside a container in which there was already a control which has not been freed up, then the old control still shows up.



                          Two solutions :




                          • Either you keep instantiating the control, but then you must free the previous control. For this, you must use the method FREE, which is available for all kinds of controls (even the container itself can be freed, all its inner controls are then freed up).


                          • Or you change the logic by instantiating the control only once, and you refresh its contents, like Laurens said.



                          (the issue is not related to cl_gui_cfw=>flush by the way)






                          share|improve this answer













                          That's a well-known issue with controls. If you instantiate a control (your ALV) inside a container in which there was already a control which has not been freed up, then the old control still shows up.



                          Two solutions :




                          • Either you keep instantiating the control, but then you must free the previous control. For this, you must use the method FREE, which is available for all kinds of controls (even the container itself can be freed, all its inner controls are then freed up).


                          • Or you change the logic by instantiating the control only once, and you refresh its contents, like Laurens said.



                          (the issue is not related to cl_gui_cfw=>flush by the way)







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 29 '18 at 13:09









                          Sandra RossiSandra Rossi

                          2,6031416




                          2,6031416






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53968887%2falv-grid-is-not-refreshed%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Monofisismo

                              Angular Downloading a file using contenturl with Basic Authentication

                              Olmecas