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

When are internal tables initialized?

gerhard_hangoebl2
Discoverer
0 Likes
1,082

Hello!

I noticed that my internal tables are cleared when I return to the selection screen from my report with help of the "back" button!

Has this behaviour changed (we use 7.31)?

Is there a possability to keep data within an internal table when I return to selection screen? Due to performance issues this internal tables should only  be built up once!

Regards,

Gerhard

Hello!

I noticed that my internal tables are cleared when I return to the selection screen from my report with help of the "back" button!

Has this behaviour changed (we use 7.31)?

Is there a possability to keep data within an internal table when I return to selection screen? Due to performance issues this internal tables should only  be built up once!

Regards,

Gerhard

5 REPLIES 5
Read only

Former Member
0 Likes
959

Use Import and export parameters to acheive this

Read only

Former Member
0 Likes
959

Put data retrieval logic inside function module which has internal table in top include.

Global internal table will retain values on subsequent calls.

Do fresh selections only when:

  1. Internal table is empty
  2. Internal table has values but importing parameters of function module have changed.
Read only

RaymondGiuseppi
Active Contributor
0 Likes
959

It depends on how the BACK action is coded, if it performs a LEAVE TO SCREEN 0 (and no cleaning in first PBO), data is kept, if it use a LEAVE TO TRANSACTION sy-tcode or more recent LEAVE TO CURRENT TRANSACTION (release 6.40), data is cleared. And there are more and more program that use those statements.

Regards,

Raymond

Read only

0 Likes
959

Hello Raymond!

My experience is different, the coding of my BACK button is LEAVE TO SCREEN 0! When I return to selection screen and start execution immedialty again, the data are not kept (internal table is initial)!

Regards,

Gerhard

Read only

0 Likes
959

Hi Gerhard,

Even I when through this problem when I was in training period. Then I got to know the reason after 2 days.

The reason is whenever you go back to selection screen from the output screen, the program will be reloaded i.e the program execution starts from beginning, it re-initializes all the declarations. So there is no way you can retain the values. All the values will be lost once you go to selection screen.

If you want to retain the values then, before leaving the output screen, use the ABAP memory, export the values and use these values.

Before LEAVE TO SCREEN 0. Add this one line code.

EXPORT itab TO MEMORY ID 'ABC'.

Import wherever you want using this statement.

IMPORT itab FROM MEMORY ID 'ABC'.