Procedure documentation Loading Data to Multiple Tables Simultaneously Locate the document in its SAP Library structure

The DATALOAD command supports loading multiple tables simultaneously.

Syntax

<if_condition> ::= IF <condition> | OTHERWISE

Use

If you want to use a single DATALOAD command to load data from one source data stream into multiple tables simultaneously, you must describe each of these target tables with a separate DATALOAD specification. Use selection criteria to define which records in the source data stream you want to load into which target tables.

Note

You can only specify the OTHERWISE condition for the last table in a series of DATALOAD statements.

Unlike the usual DATALOAD command, a mass INSERT is not used for loading into multiple target tables. Instead, the data records are transferred to the target tables individually from the data file. This affects the performance of the load procedure.

Using IF <condition>

Example

You want to load those data records in the address.data source data stream that begin with the letter k to the target table with the name customer and all those data records that begin with the letter p to the target table with the name partner:

DATALOAD TABLE customer  IF POS 1 = 'k'
  cno       2
  name   3
  zip       5
  city      6
DATALOAD TABLE partner   IF POS 1 = 'p'
  cno       2
  name    3
  zip       5
  city      6
INFILE 'address.data'

Using IF <condition> | OTHERWISE

Example

You want to load all data records in the address.data source data stream that are neither customer addresses nor partner addresses into the prospects target table.

DATALOAD TABLE customer  IF POS 1 = 'k'
  cno       2
  name   3
  zip       5
  city      6
DATALOAD TABLE partner   IF POS 1 = 'p'
  cno       2
  name   3
  zip       5
  city      6
DATALOAD TABLE prospects OTHERWISE
  regno     2
  name   3
  zip       5
  city      6
INFILE 'address.data'