SAP & ABAP Memory


ABAP MEMORY-It uses export and import parameters when an active internal session calls another internal session within a single main session .

SAP MEMORY- It uses set and get parameters to pass the data from one main session to another main session.

 

mem2

memory

*ABAP MEMORY – with export and import parameters*

REPORT  YSP_0136.
data : name1(10) type c value 'aaaaaaaaaa'.
export name1 to memory id 'MEM1'.
SUBMIT YSP_0137 AND RETURN.
WRITE 'SSSSSSSS'.

*********************************************
REPORT  YSP_0137                                                    .
DATA : NAME2(10) TYPE C.

IMPORT NAME1 TO NAME2 FROM MEMORY ID 'MEM1'.
WRITE NAME2.
 

*ABAP MEMORY – with export and import parameters*

REPORT ZPGM1.
data : text1 type char20 value 'export and import'.

export text1
       text2 from 'ex and im' to memory id 'MEM'.

SUBMIT ZPGM2 AND RETURN.
REPORT ZPGM2.
DATA : T1 TYPE CHAR20.
DATA : T2 TYPE CHAR20.
IMPORT TEXT1 TO T1 FROM MEMORY ID 'MEM'.
IMPORT TEXT2 TO T2 FROM MEMORY ID 'MEM'.
WRITE :/ T1.
WRITE :/ T2.

*************OUTPUT **************
export and import
ex and im 
 

 

*ABAP MEMORY – with export and import parameters*

data : t1 type char15 value  'ex and im'.

export t1 to memory id 'mem'.
t1 = 'xxxxxxxxxx'.
write :/ sy-subrc , t1.
import t1 from memory id 'mem'. " or free memory.
write :/ sy-subrc , t1.
t1 = 'xxxxxxxxxx'.
free memory id 'mem'.
import t1 from memory id 'mem'.
write :/ sy-subrc , t1.

*************output of program ****************

   0  xxxxxxxxxx
   0  ex and im
   4  xxxxxxxxxx

*ABAP MEMORY – with export and import parameters *

data : text(10) value '0123456789',
          iden(3) value 'xyz'.

export text to memory id iden.

text = 'xxxxxxxxxx'.

import text from memory id iden.
write :/ sy-subrc, text.

free memory . " free memory id iden.
text = 'xxxxxxxxxx'.
import text from memory id iden.
write :/ sy-subrc, text.

*SAP MEMORY – with set and get parameters*

REPORT  YSP_0138                                .

DATA TEXT1(30) TYPE C VALUE 'SET AND GET PARAMETER'.
SET PARAMETER ID 'MEM' FIELD TEXT1.

WRITE : 'SET PARAMETER'.
*************************************************
REPORT  YSP_0139                                .
DATA TEXT2(30) TYPE C .
GET PARAMETER ID 'MEM' FIELD TEXT2.
WRITE : / TEXT2.
WRITE : 'GET PARAMETER'. 
-------------------------------------------------------------------------------
Advertisements

3 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s