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: 

EXPORT/IMPORT statements

Former Member
0 Kudos

Hi Folks

In which situations we go for IMPORT/EXPORT statements. Gimme few examples. Whatz the difference between EXPORT to MEMORY/ DATABASE n in which case we go for them?

What is the difference between SET/GET and EXPOT/IMPORT

Gimme a detailed reply on all the queries.

Thanks in advance.

Regards,

Ram

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi..

Passing Data Between Programs

There are two ways of passing data to a called program:

Passing Data Using Internal Memory Areas

There are two cross-program memory areas to which ABAP programs have access (refer to the diagram in Memory Structures of an ABAP Program) that you can use to pass data between programs.

SAP Memory

SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens (see below).

ABAP Memory

ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse. For further information, refer to Data Clusters in ABAP Memory.

Filling Input Fields on an Initial Screen

Most programs that you call from other programs have their own initial screen that the user must fill with values. For an executable program, this is normally the selection screen. The SUBMIT statement has a series of additions that you can use to fill the input fields of the called program:

Filling the Selection Screen of a Called Program

You cannot fill the input fields of a screen using additions in the calling statement. Instead, you can use SPA/GPA parameters.

7 REPLIES 7

Former Member
0 Kudos

Hi..

Passing Data Between Programs

There are two ways of passing data to a called program:

Passing Data Using Internal Memory Areas

There are two cross-program memory areas to which ABAP programs have access (refer to the diagram in Memory Structures of an ABAP Program) that you can use to pass data between programs.

SAP Memory

SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens (see below).

ABAP Memory

ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse. For further information, refer to Data Clusters in ABAP Memory.

Filling Input Fields on an Initial Screen

Most programs that you call from other programs have their own initial screen that the user must fill with values. For an executable program, this is normally the selection screen. The SUBMIT statement has a series of additions that you can use to fill the input fields of the called program:

Filling the Selection Screen of a Called Program

You cannot fill the input fields of a screen using additions in the calling statement. Instead, you can use SPA/GPA parameters.

Former Member
0 Kudos

Hi,

<b>SAP Memory</b>

SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens (see below).

<b>ABAP Memory</b>

ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse

<b>EXPORT to MEMORY/ DATABASE :</b>

EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ...

TO DATABASE <dbtab>(<ar>) [CLIENT <cli>] ID <key>.

This statement stores the data objects specified in the list as a cluster in the cluster database <dbtab>. You must declare <dbtab> using a TABLES statement. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >.

Regards

Sudheer

uwe_schieferstein
Active Contributor
0 Kudos

Hello Ram

You will use EXPORT/IMPORT if you need to transfer data from one program to another within the SAME session (e.g. a report calls another report using SUBMIT... AND RETURN statement). In this case the export data are only store <b>transiently</b>.

If you need to store the export data <b>persistantly </b>then you will do the export to DATABASE.

SET/GET parameter are globally set values that are valid for <b>all </b>sessions. For example, if you set parameter 'BUK' = '1000' then then the company code will have this preset value in all dialog applications.

Regards

Uwe

Former Member
0 Kudos

Hi..,

We know that we can open up to a max of 6 sessions , i mean the windows..

In one window suppose we are executing a program .. and in this if we are submitting a program i.e calling another program , then it opens an internal session .. we can pass data between program 1 and program 2 we use <b>ABAP memory i.e EXPORT and IMPORT options...</b>

Suppose we are working between two windows.. (not between internal sessions ).. i.e if we want to pass data from a program which is running in one window ( session ) to another program which is running in another window (session) then we use <b>SAP memory i.e</b> <b>SET/GET paramters..!</b>!

regards,

sai ramesh

Former Member
0 Kudos

Hi ram,

There are three VIEWS,you can understand very easily.

EXPORT/IMPORT statements are used for ABAP statement,

SET/GET statements are used for SAP statement.

What is the difference between SAP memory and ABAP memory?



Answer1:
data sending between main sessions using get parameter and set parameter is sap memory
data sending between internal sessions using import or export parameters is abap memory

Answer2:
sap memory is a global memory whereas abap memory is local memory.

For example, we have four programs in abap memory and assigned some varibles to a particular program in abap memory then those varibles can't be used by anyother program in abap memory i.e., the variables are only for that program and also local to that memory,whereas sap memory can access all the abap memory or else it can perform any kind of modifications.

Answer3:
SAP memory is available to the user during the entire terminal session.
ABAP memory is available to the user during life time of external session.

Reward,if helpful.

Regards,

V.Raghavender.

Former Member
0 Kudos

hi

ABAP memory is independent of the ABAP program or program module from which it was generated. In other words, an object saved in ABAP memory can be read from any other ABAP program in the same call chain. ABAP memory is not the same as the cross-transaction global SAP memory.

This allows you to pass data from one module to another over several levels of the program hierarchy. For example, you can pass data

From an executable program (report) to another executable program called using SUBMIT.

From a transaction to an executable program (report).

Between dialog modules.

From a program to a function module.

and so on.

The contents of the memory are released when you leave the transaction.

<u><i><b>To save data objects in ABAP memory, use the statement EXPORT TO MEMORY

Saving Data Objects in Memory</b></i></u>

To read data objects from an ABAP program into ABAP memory, use the following statement:

Syntax

EXPORT <f1> [FROM <g 1>] <f 2> [FROM <g 2>] ... TO MEMORY ID <key>.

This statement stores the data objects specified in the list as a cluster in memory. If you do not use the option FROM <f i >, the data object <f i > is saved under its own name. If you use the FROM <g i > option, the data objet <g i > is saved under the name <f i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.

The EXPORT statement always completely overwrites the contents of any existing data cluster with the same name <key>.

If you are using internal tables with header lines, you can only store the table itself, not the header line. In the EXPORT statement, the table name is interpreted as the table. This is an exception to the general rule, under which statements normally interpret the table name as a table work are

<u><i><b>

To read data objects from memory, use the statement IMPORT FROM MEMORY.</b></i></u>

To read data objects from ABAP memory into an ABAP program, use the following statement:

Syntax

IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM MEMORY ID <key>.

This statement reads the data objects specified in the list from a cluster in memory. If you do not use the TO <g i > option, the data object <f i > in memory is assigned to the data object in the program with the same name. If you do use the option, the data object <f i > is read from memory into the field <g i >. The name <key> identifies the cluster in memory. It may be up to 32 characters long.

You do not have to read all of the objects stored under a particular name <key>. You can restrict the number of objects by specifying their names. If the memory does not contain any objects under the name <key>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in memory with the name <key>, SY-SUBRC is always 0, regardless of whether it contained the data object <f i >. If the cluster does not contain the data object <f i >, the target field remains unchanged.

In this statement, the system does not check whether the structure of the object in memory is compatible with the structure into which you are reading it. The data is transported bit by bit. If the structures are incompatible, the data in the target field may be incorrect.

regards

navjot

reward points for all helpfull answers

Former Member
0 Kudos

Hi Ram,

Within a main session, when ever you start an application program, it opens up an internal sessions with in the main session. The internal session has a memory area that contains the ABAP program and its associated data. So when ever you want to pass data between two internal sessions, then you can use ABAP Memory (i.e import, export).

When comes to SAP memory (also known as global memory), if the data has to be passed b/w two main sessions, we can use SAP Memory(SPA/GPA Parameters). SAP Memory can also be used to pass data b/w internal sessions.

<b>SAP Memory</b>

SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens

<b>ABAP/4 Memory</b>

ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data

to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse.

<b>SAP memory </b>

The SAP memory, otherwise known as the global memory, is available to a user during the entire duration of a terminal session. Its contents are retained across transaction boundaries as well as external and internal sessions. The SET PARAMETER and GET PARAMETER statements allow you to write to, or read from, the SAP memory.

<b>ABAP/4 memory</b>

The contents of the ABAP/4 memory are retained only during the lifetime of an external session (see also Organization of Modularization Units). You can retain or pass data across internal sessions. The EXPORT TO MEMORY and IMPORT FROM MEMORY statements allow you to write data to, or read data from, the ABAP memory.

I think you have got some idea about these.

If so then dont forget to award the points.

Thanks and regards

Vipin Das