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

IMPORT Statement

Former Member
0 Likes
3,164

hi all ,

can anyone explain the IMPORT.......FROM DATABASE.......ID...... statment and what are the values to be passed for this. Any pointer would be highly appreciated.

thanks and regards,

uday

Moderator message - Please search before asking basic questions - post locked

Edited by: Rob Burbank on Jun 2, 2009 9:27 AM

7 REPLIES 7
Read only

Former Member
0 Likes
1,778
Read only

Former Member
Read only

Former Member
0 Likes
1,778

.

Edited by: krupa jani on Jun 2, 2009 11:52 AM

Read only

gautam_totekar
Active Participant
0 Likes
1,778

EXPORT :-

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>.

IMPORT :-

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.

for syntax : check the link.

http://help.sap.com/abapdocu/en/ABAPIMPORT_MEDIUM.htm

Read only

Former Member
0 Likes
1,778

Hi,

IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... FROM DATABASE

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

The IMPORT statement reads the contents of the user fields from the database

table. If the database does not contain any objects that correspond to the key <ar>,

<key>, and <cli>, SY-SUBRC is set to 4. If, on the other hand, there is a data cluster in

the database with the same key, SY-SUBRC is always 0, regardless of whether it

contained the data object <fi>. In this statement, the system does not check whether

the structure of the object in the database is compatible with the structure into which

you are reading it. If this is not the case, a runtime error occurs.

Regards,

Dhavalshree.

Read only

Former Member
0 Likes
1,778

Hello,


IMPORT <f1> [TO <g 1>] <f 2> [TO <g 2>] ... 
 FROM DATABASE <dbtab>(<ar>) 
[CLIENT <cli>] ID <key>|MAJOR-ID <maid> [MINOR-ID <miid>].

Regards,

Sachinkumar Mehta

Read only

Former Member
0 Likes
1,778

Hi

IMPORT obj1 ... objn FROM SHARED BUFFER itab(ar) ID key.

The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas.

See Cannot Use Implicit Fieldnames in Clusters und Cannot Use Table Work Areas.

Effect

Imports data objects obj1 ... objn (fields or

tables) from the cross-transaction application buffer. The data objects are read in the application buffer using the ID key of the area ar of the buffer area for the table itab (see EXPORT TO SHARED BUFFER). You must use dbtab to specify a database table although the system reads from a memory table with an appropriate structure.

Example

Import two fields and an internal table from the application buffer with the structure INDX:

TYPES: BEGIN OF ITAB3_LINE,

CONT(4),

END OF ITAB3_LINE.

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

F1(4),

F2(8) TYPE P DECIMALS 0,

ITAB3 TYPE STANDARD TABLE OF ITAB3_LINE,

INDX_WA TYPE INDX.

  • Import data.

IMPORT F1 = F1 F2 = F2 ITAB3 = ITAB3

FROM SHARED BUFFER INDX(ST) ID INDXKEY TO INDX_WA.

Notes

You must declare the table dbtab, named after DATABASE using a TABLES statement.

The structure of the fields, structures, and internal tables to be imported must match the structure of the objects exported to the dataset. Moreover, the objects must be imported with the same name used to export them. Otherwise, the import is not performed.

The maximum total key length is 64 bytes. It must include: a client if the table is client-specific (3 characters); an area (2 characters); identification; and line counter (4 bytes). This means that the number of characters available for the identification of a client-specific table is 55 characters.

The key, key, must be a character-type data object (but not a string).