ARTICLE
Storing Data Clusters
Overview
1 Exporting data
2 Importing data
New variants of the IMPORT and
EXPORT statements are available to
support heterogeneous Unicode environments. They allow you to store
data as a cluster as an XSTRING in a cross-platform format.
1 Exporting data
EXPORT obj1 ... objn TO DATA BUFFER dbuf .
EXPORT (ObjTab) TO DATA BUFFER dbuf .
Stores the objects obj1 ... objn (fields, structures, or
tables) as a cluster in the data buffer, dbuf, which must be of
type XSTRING .
Example
TYPES:
BEGIN OF ITAB3_TYPE,
CONT(4) TYPE C,
END OF ITAB3_TYPE.
DATA:
XSTR TYPE XSTRING,
F1 TYPE C LENGTH 4,
F2 TYPE P,
ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 2.
EXPORT F1 = F1
F2 FROM F2
ITAB3 FROM ITAB3
TO DATA BUFFER XSTR.
New addition ... CODE PAGE HINT f1. This
addition to the EXPORT obj1 ...
objn TO [ DATA BUFFER | DATABASE | DATASET ] statement specifies the
codepage ,
f1 to be used to interpret the import data (used where
the codepages are ambiguous).
2 Importing data
IMPORT obj1 ... objn FROM DATA BUFFER dbuf .
IMPORT (objTab) FROM DATA BUFFER dbuf .
Imports the data objects obj1 ... objn (fields, structures,
complex structures, or tables) from a
data cluster in the data buffer
entered, dbuf � which must be of type XSTRING. The system reads
all the data that were previously stored in the data buffer dbuf using
the EXPORT ... TO DATA BUFFER statement. Again, the system does
not check that the structures match when these EXPORT and
IMPORT statements are used.
Note
The first column of the objTab table contains the object names
in the data cluster, which correspond to obj1...objn statically.
The second column contains the names used in the program (where these
differ) that is, corresponding to the name of the field when the
source field was assigned. If the table contains only one column, or if
the second column contains only blank fields, this corresponds to a
static IMPORT or EXPORT (without a source field assignment).
In any case the first and (if available) second columns of the internal
table must be of type C or STRING. In ABAP Objects, objTab must
have at least two columns, since the formal parameter is stored in the
second column. Moreover, the table must not be defined as
HASHED TABLE HASHED TABLE or
ANY TABLE ANY TABLE.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved