Syntax Check for IMPORT part two

We have all ready discussed regarding syntax of IMPORT key word and this post is the continuation of it .

Variant 2

IMPORT f itab FROM DATABASE dbtab(ar) ID key.

Additions

1. ... TO g (for each field f to be imported)
2. ... MAJOR-ID maid (instead of ID key )
3. ... MINOR-ID miid (together with MAJOR-ID maid )
4. ... CLIENT h (after dbtab(ar) )
5. ... USING form

Effect

Imports data objects (fields, field strings or internal tables) with the ID key from the area ar of the database dbtab

The return code value is set as follows:

SY-SUBRC = 0 The data objects were successfully imported.

SY_SUBRC = 4 The data objects could not be imported, probably because an incorrect ID was used.
The contents of all objects remain unchanged.


Example

Import two fields and an internal table:

TABLES INDX.

DATA: INDXKEY LIKE INDX-SRTFD,F1(4),
F2 TYPE P,BEGIN OF TAB3 OCCURS 10, CONT(4),
END OF TAB3.

INDXKEY = 'INDXKEY'.

IMPORT F1 F2 TAB3 FROM DATABASE INDX(ST) ID

INDXKEY.

The structure of fields, field strings and internal tables to be imported must match the structure of the objects exported to the dataset. In addition, the objects must be imported under the same name used to export them. If this is not the case, either a runtime error occurs or no import takes place.

Exception: You can lengthen or shorten the last field if it is of type CHAR , or add/omit CHAR fields at the end of the structure.

Addition 1

... TO g (for each field f to be imported)

Effect

Takes the field contents stored under the name f from the database and places them in g .

Addition 2

... MAJOR-ID maid (instead of ID key )

Addition 3

... MINOR-ID miid (together with MAJOR-ID maid )

Effect

Searches for a record with an ID that matches maid in the first part (length of maid ) and - if MINOR-ID miid is also specified - is greater than or equal to miid in the second part.

Addition 4

... CLIENT h (after dbtab(ar) )

Effect

Takes the data from the client h (only with client-specific import/export databases).

Example

TABLES INDX.
DATA F1.
IMPORT F1 FROM DATABASE INDX(AR) CLIENT '002'
ID 'TEST'.

Addition 5

... USING form

Effect

Does not read the data from the database. Instead, calls the FORM routine form for each record read from the database without this addition. This routine can take the data key of the data to be retrieved from the database table work area and write the retrieved data to this work area schreiben; it therefore has no parameters.(76)

The previous post of the blog deals with SAP XI ADAPTER CONCEPT.


ERP implementation process and advantages
ERP advantages and erp project launch

No comments :

Post a Comment