Application Development 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: 

Memory functions in ABAP

Former Member
0 Kudos
292

Hi All , I am very much new to ABAP so can anyone guide me how to retrive the memory details in ABAP ? We can do same in JAVA using getRuntime().freeMemory , getRuntime().totalmemory() .

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos
67

Hi Ravindra..

There are 2 types of Cross program memory areas in ABAP

1. ABAP Memory and 2. SAP memory

<b>ABAP MEMORY:</b>To transfer the Data between the Programs Running in the Same Session We can use.

Eg:

Calling Report.

REPORT ZREP1.

DATA : ITAB TYPE TABLE OF MARA.

SELECT * FROM MARA INTO TABLE ITAB.

EXPORT TEMPTAB FROM ITAB TO MEMORY ID 'M1'.

SUBMIT ZREP2 AND RETURN.

Called report

REPORT ZREP2.

DATA: IT_MARA TYPE TABLE OF MARA.

DATA WA TYPE MARA.

IMPORT TEMPTAB TO IT_MARA FROM MEMORY ID 'M1'

LOOP AT IT_MARA INTO WA.

WRITE:/ WA-MATNR.

ENDLOOP.

<b>SAP Memory:</b>

It is used to pass the Data to Screen fields or Read data from Screen Fields.

It can be used to Transfer data from one Session(window) to another within the Login.

DATA : V_KUNNR TYPE KNA1-KUNNR VALUE 1000.

SET PARAMETER ID 'KUN' FIELD V_KUNNR.

CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.

<b>reward if Helpful.</b>

4 REPLIES 4

varma_narayana
Active Contributor
0 Kudos
68

Hi Ravindra..

There are 2 types of Cross program memory areas in ABAP

1. ABAP Memory and 2. SAP memory

<b>ABAP MEMORY:</b>To transfer the Data between the Programs Running in the Same Session We can use.

Eg:

Calling Report.

REPORT ZREP1.

DATA : ITAB TYPE TABLE OF MARA.

SELECT * FROM MARA INTO TABLE ITAB.

EXPORT TEMPTAB FROM ITAB TO MEMORY ID 'M1'.

SUBMIT ZREP2 AND RETURN.

Called report

REPORT ZREP2.

DATA: IT_MARA TYPE TABLE OF MARA.

DATA WA TYPE MARA.

IMPORT TEMPTAB TO IT_MARA FROM MEMORY ID 'M1'

LOOP AT IT_MARA INTO WA.

WRITE:/ WA-MATNR.

ENDLOOP.

<b>SAP Memory:</b>

It is used to pass the Data to Screen fields or Read data from Screen Fields.

It can be used to Transfer data from one Session(window) to another within the Login.

DATA : V_KUNNR TYPE KNA1-KUNNR VALUE 1000.

SET PARAMETER ID 'KUN' FIELD V_KUNNR.

CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.

<b>reward if Helpful.</b>

paruchuri_nagesh
Active Contributor
0 Kudos
67

hi

There is a local ABAP memory for each external session. You

can use it to exchange any ABAP variables (fields, structures, internal tables, complex objects)

between the internal sessions in any one external session.

When the user exits an external session (/i in the command field), the corresponding ABAP

memory is automatically initialized or released.

Use the EXPORT … TO MEMORY statement to copy any number of ABAP variables with their current

values (data cluster) to ABAP memory. The ID… addition (maximum 32 characters long) enables you

to identify different clusters.

If you use a new EXPORT TO MEMORY statement for an existing data cluster, the new one will

overwrite the old.

The IMPORT… FROM MEMORY ID… statement allows you to copy data from ABAP memory into

the corresponding fields of your ABAP program. In the IMPORT statement, you can also restrict the

selection to a part of the data cluster.

The variables into which you want to read data from the cluster in ABAP memory must have the same

types in both the exporting and the importing programs.

To release a data cluster, use the FREE MEMORY ID… statement.

Remember when you call programs using transaction codes that you can only use the ABAP memory to

pass data to the transaction.

reward for use ful points

regards

Nagesh.Paruchuri

Former Member
0 Kudos
67

There are 2 types memory areas in ABAP

1) ABAP Memory: Data sending between internal sessions is called abap memory using <b>import and expor</b>t parameters.

2) SAP Memory:

Data sending between main sessions using spa/gpa ie (<b>set /get</b>) parameters called sap memory.

Reward me if helpful.

0 Kudos
67

Hi All thanks for reply but I want some ABAP functions which can retrive the memory detail for system as in JAVA we have getRuntime().freeMemory() this will return the freememory for JAVA system .I am looking for the same functions in ABAP ...