Skip to Content
Author's profile photo Former Member

Learning the hard way to REFRESH the internal tables

I think almost all ABAPpers would agree with me that the most boring and forgetful part of coding is to REFRESH / CLEAR the internal tables / workareas whenever the need for doing so arises.

This small little check that the internal table / workarea must be refreshed at the correct place always remains in our subconscious mind, but, we seldom take a conscious effort to actionize it.

Probably after spending about 2 hours of my life for a small bug in my program, I have learnt to keep the point “REFRESH INTERNAL TABLES / WORKAREAS” at the top of my checklist.

This learning got engraved in my mind when I created an ALV report with a header.
I created an internal table T_TOP of type SLIS_T_LISTHEADER and populated it with the details to be displayed in the header.

In the program, I declared the internal table T_TOP in the global declarations.

Now, in the subroutine TOP_OF_PAGE, I did not clear the internal table T_TOP before filling it with the details, overlooking the fact that the top of page event is called everytime we select any record in the output or select any options in the toolbar.

Now, whenever I double-clicked on the output or selected any options from the toolbar, my report header kept repeating itself and grew in size.

On debugging, I found that I had forgot to clear my internal table T_TOP at the start of the subroutine created for TOP OF PAGE.

So friends, please remember consciously to always clear / refresh the internal tables and workareas wherever necessary, else, a small bug like this can cost you hours.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Yes, I too faced this issue, while manipulating a string into an intermediate internal table(which I skipped to refresh) the input string always holds correct value and output table grows enormously.

      Further, an unnecessary clear / refresh ruins whole logic as well.

      Hence, We should take utmost care while clearing / refreshing the work area / internal table.


      Author's profile photo Former Member
      Former Member
      It is very important to refresh internal table bcoz then overlapping of data does not occur and new data gets populated which becomes easy to execute without any bug and yes it is very efficient.