Entering content frame

 The DATAEXTRACT Command 

With this Loader command, you can control the unloading of application data from database tables.

Syntax

<select_expression> [OUTFIELDS] [<output_column_list>] <extract_files_spec>
| DATAEXTRACT
<restore_spec> TABLE <table_name> [<order_clause>] <extract_files_spec>

You can also use the keywords EXTRACT DATA instead of the keyword DATAEXTRACT.

Prerequisite

You must have access authorization for the tables from which you want to unload data.

You must be owner of the table to use the second variant of the DATAEXTRACT command.

Use

The Loader offers you the following variants of the DATAEXTRACT command.

Variant 1: DATAEXTRACT [OUTFIELDS]

You can use this variant of the command to:

·        Define the columns of the table that is to be unloaded

·        Link multiple tables that you want to unload

·        Specify a sort sequence for the extracted data

DATAEXTRACT cno, name, zip, address from customer
  OUTSTREAM 'customer.data'

DATAEXTRACT * from article
  OUTFIELDS  foa         01-08
             des         09-39
             stock       40-43 INTEGER
             min_ord     44-45 INTEGER
             ordered     46-49 INTEGER
             del_date    50-57
             price       58-65 DECIMAL (2)
             weight      66-69 REAL
  OUTSTREAM 'article.data' FORMATTED

Variant 2: DATAEXTRACT … TABLE

You can only use this variant of the command to unload complete single tables. You unload all application data of a table in one data stream and the table definition in the database catalog in a second data stream. You can use these two data streams to recreate the unloaded table and load all application data.

DATAEXTRACT FOR DATALOAD TABLE article
  OUTSTREAM 'article.command'
  OUTSTREAM' article.data
'

Data stream for the definition from the database catalog: article.command
Data stream for application data:
article.data

Process Flow

The Loader uses the information from the DATAEXTRACT command to generate an internal SELECT command and constructs a results table. The data in this results table is then unloaded into the target data stream, as instructed by the command.

All tables from which data is being unloaded are write-protected while the DATAEXTRACT command is being executed. This means that other users cannot make changes to this table while it is being unloaded.

Result

The data is unloaded from the tables to be unloaded into the target data stream(s).

You can use a DATALOAD or FASTLOAD command to reload the table data back into the database instance.

Errors

The unload process cannot be successfully completed. In this case, the SAP DB Loader logs the number of successfully unloaded data records in the log file.

 

Leaving content frame