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 memeory

Former Member
0 Likes
912

how can u send internal table into abap memory?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
892

Hi,

Use the export command to export the IT to memory and use import to retrieve it.

Here is the command

EXPORT obj1 ... objn TO MEMORY.

Please see the help for more info.

Here is the code from the standrad help

TYPES: BEGIN OF OBJ_LINE,

CLUSTERNAME(30),

PROGRAMNAME(10),

END OF OBJ_LINE.

DATA: OBJ_TAB TYPE STANDARD TABLE OF OBJ_LINE,

OBJ_WA TYPE OBJ_LINE.

TYPES: BEGIN OF B_LINE,

FIELD_1 TYPE I,

FIELD_2(1) TYPE N,

END OF B_LINE.

DATA: B_PROG TYPE STANDARD TABLE OF B_LINE.

DATA: A(10),

C_PROG LIKE SYST.

MOVE: 'A' TO OBJ_WA-CLUSTERNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'B' TO OBJ_WA-CLUSTERNAME,

'B_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'C' TO OBJ_WA-CLUSTERNAME,

'C_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

EXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'.

Reward for useful answers.

Regards,

Raj.

Hi,

Use the export command to export the IT to memory and use import to retrieve it.

Here is the command

EXPORT obj1 ... objn TO MEMORY.

Please see the help for more info.

Here is the code from the standrad help

TYPES: BEGIN OF OBJ_LINE,

CLUSTERNAME(30),

PROGRAMNAME(10),

END OF OBJ_LINE.

DATA: OBJ_TAB TYPE STANDARD TABLE OF OBJ_LINE,

OBJ_WA TYPE OBJ_LINE.

TYPES: BEGIN OF B_LINE,

FIELD_1 TYPE I,

FIELD_2(1) TYPE N,

END OF B_LINE.

DATA: B_PROG TYPE STANDARD TABLE OF B_LINE.

DATA: A(10),

C_PROG LIKE SYST.

MOVE: 'A' TO OBJ_WA-CLUSTERNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'B' TO OBJ_WA-CLUSTERNAME,

'B_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'C' TO OBJ_WA-CLUSTERNAME,

'C_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

EXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'.

Reward for useful answers.

Regards,

Raj.

6 REPLIES 6
Read only

Former Member
0 Likes
893

Hi,

Use the export command to export the IT to memory and use import to retrieve it.

Here is the command

EXPORT obj1 ... objn TO MEMORY.

Please see the help for more info.

Here is the code from the standrad help

TYPES: BEGIN OF OBJ_LINE,

CLUSTERNAME(30),

PROGRAMNAME(10),

END OF OBJ_LINE.

DATA: OBJ_TAB TYPE STANDARD TABLE OF OBJ_LINE,

OBJ_WA TYPE OBJ_LINE.

TYPES: BEGIN OF B_LINE,

FIELD_1 TYPE I,

FIELD_2(1) TYPE N,

END OF B_LINE.

DATA: B_PROG TYPE STANDARD TABLE OF B_LINE.

DATA: A(10),

C_PROG LIKE SYST.

MOVE: 'A' TO OBJ_WA-CLUSTERNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'B' TO OBJ_WA-CLUSTERNAME,

'B_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'C' TO OBJ_WA-CLUSTERNAME,

'C_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

EXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'.

Reward for useful answers.

Regards,

Raj.

Read only

Former Member
0 Likes
892

Hi,

Check the below:

EXPORT obj1 ... objn TO MEMORY.

If you call a transaction, report or dialog module (with CALL TRANSACTION , SUBMIT or CALL DIALOG ), the contents of ABAP/4 memory are retained, even across several levels. The called transaction can then retrieve the data from there using IMPORT ... FROM MEMORY .

Each new EXPORT ... TO MEMORY statement overwrites any old data, so no data is appended.

EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key

The database table dbtab must have a standardized structure . The database table dbtab is divided into different logically related areas ( ar , 2-character name).

You can export collections of data objects (known as data clusters ) under a freely definable key (field key ) to an area of this database.

IMPORT allows you to import individual data objects from this cluster.

EXPORT obj1 ... objn TO MEMORY.

Exports the objects obj1 ... objn (fields, structures or tables) as a data

cluster to ABAP/4 memory .

EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key. Exports the objects obj1 ... objn (fields, structures or tables) as a data cluster to the database table dbtab.

IMPORT f itab FROM MEMORY.

Imports data objects (fields or tables) from the ABAP/4 memory . Reads in all data without an ID that was exported to memory with "EXPORT ... TO MEMORY."

IMPORT f itab FROM DATABASE dbtab(ar) ID key. Imports data objects (fields, field strings or internal tables) with the ID key from the area ar of the database dbtab .

Regards

Kannaiah

Read only

Former Member
Read only

Former Member
0 Likes
892

Hi Subbareddy,

Take a look at this code from SAP Help.

PROGRAM SAPMZTS1.

DATA TEXT1(10) VALUE 'Exporting'.

DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.

DO 5 TIMES.

ITAB-BOOKID = 100 + SY-INDEX.

APPEND ITAB.

ENDDO.

EXPORT TEXT1

TEXT2 FROM 'Literal'

TO MEMORY ID 'text'.

EXPORT ITAB

TO MEMORY ID 'table'.

SUBMIT SAPMZTS2 AND RETURN.

SUBMIT SAPMZTS3.

Example for SAPMZTS2:

PROGRAM SAPMZTS2.

DATA: TEXT1(10),

TEXT3 LIKE TEXT1 VALUE 'Initial'.

IMPORT TEXT3 FROM MEMORY ID 'text'.

WRITE: / SY-SUBRC, TEXT3.

IMPORT TEXT2 TO TEXT1 FROM MEMORY ID 'text'.

WRITE: / SY-SUBRC, TEXT1.

Example for SAPMZTS3:

PROGRAM SAPMZTS3.

DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.

IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.

LOOP AT JTAB.

WRITE / JTAB-BOOKID.

ENDLOOP.

Read only

Former Member
0 Likes
892

And also check this...

You can use the EXPORT to memory and IMPORT.. command.

Here is the standrard help given for the same

codeTYPES: BEGIN OF OBJ_LINE,

CLUSTERNAME(30),

PROGRAMNAME(10),

END OF OBJ_LINE.

DATA: OBJ_TAB TYPE STANDARD TABLE OF OBJ_LINE,

OBJ_WA TYPE OBJ_LINE.

TYPES: BEGIN OF B_LINE,

FIELD_1 TYPE I,

FIELD_2(1) TYPE N,

END OF B_LINE.

DATA: B_PROG TYPE STANDARD TABLE OF B_LINE.

DATA: A(10),

C_PROG LIKE SYST.

MOVE: 'A' TO OBJ_WA-CLUSTERNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'B' TO OBJ_WA-CLUSTERNAME,

'B_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

MOVE: 'C' TO OBJ_WA-CLUSTERNAME,

'C_PROG' TO OBJ_WA-PROGRAMNAME.

APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA.

EXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'.[/code]

In the same way the import command would be

IMPORT (OBJ_TAB) FROM MEMORY ID 'ABCD'.

Read only

Former Member
0 Likes
892

thanks for all your reply . this is very help full to me