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

ABAP Memory

andrzej_97
Explorer
0 Likes
2,799

Hi guys,

I wrote some sample code to understand ABAP memory mechanism

DATA: lv_is_true TYPE BOOLEAN VALUE ABAP_TRUE, 
lv_test TYPE BOOLEAN VALUE ABAP_FALSE.

EXPORT lv_is_update = lv_is_true TO MEMORY ID 'SOMETHING'.

IMPORT lv_is_update TO lv_test FROM MEMORY ID 'SOMETHING'.

write lv_test.

DELETE FROM MEMORY ID 'SOMETHING'.

Is there any standard table where can I find this record with id 'SOMETHING'. How long this id will be accessible and what is the scope of accessibility?

Kind regards,

Andrzej

9 REPLIES 9
Read only

Sandra_Rossi
Active Contributor
2,660

There's no "standard table" for memory IDs. You can choose the names you want.

ABAP memory is valid while the ABAP session runs.

See diagram how memory is organized in ABAP documentation: https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenmemory_organizati...

Read only

matt
Active Contributor
2,660

You can view the memory ids in the debugger. I forget exactly how.

Or write a test like this:

DATA is_true TYPE abap_bool VALUE abap_true.
DATA test TYPE abap_bool VALUE abap_false.
EXPORT is_update = is_true TO MEMORY ID 'SOMETHING'.
IMPORT is_update TO test FROM MEMORY ID 'SOMETHING'.
ASSERT test EQ is_true.
DELETE FROM MEMORY ID 'SOMETHING'.
CLEAR test.
IMPORT is_update TO test FROM MEMORY ID 'SOMETHING'.
ASSERT test IS INITIAL.


Read only

2,660

In the 6.40 backend ABAP debugger > Switch or new tool > Special tools > System areas > Memories (also possible in the very first ABAP debugger, but not in the Eclipse ADT ABAP debugger)

Read only

2,660

With pics

Add a new tool

Choose MEMORIES

Read only

0 Likes
2,660

And you see your memory ID (Use the Arrow Up & Down)

Read only

matt
Active Contributor
0 Likes
2,660

I like the way it's still called "new", 20+ years later...

Read only

matt
Active Contributor
2,660

Please in future use the code button in the site editor to nicely format your abap.

Read only

andrzej_97
Explorer
0 Likes
2,660

done, thx 😉

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
2,660

The statement EXPORT "zips" ABAP data to data clusters in an SAP internal format and stores the clusters in different storage media, that are listed here:

https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapexport_data_clust...

The storage media can be program fields (BUFFER, INTERNAL TABLE), memory areas (MEMORY, SHARED MEMORY, SHARED BUFFER) and database tables (DATABASE).

The data clusters are identified by keys ID - and area (ar) for some of them.

Of course, you don't find you cluster in the database, if you store it in the ABAP Memory (https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenabap_memory_glosry.htm).

To inspect the clusters in the memory, you might use the ABAP Debugger (as already was pointed out).

Only if you export to the database, you can lookup the database table specified in the EXPORT statement and find the ID in the third column (that can have any name).

https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abenexport_data_clust...

BR

Horst