IMPORT SAP command

Used to define ACL tables from SAP ERP systems using Direct Link.

Syntax

IMPORT SAP PASSWORD <num> TO <table_name> SOURCE "SAP AGENT" <import_details>

Parameters

PASSWORD num

Specifies the password required to access the SAP system. The num parameter corresponds to the number of the password definition to use. For example, if you have defined two passwords in your script, PASSWORD 2 specifies that the second one should be used. If you do not define the password value in your script, a password prompt will be displayed when the script is run.

TO table_name

The name of the ACL table to import the data into.

SOURCE “SAP AGENT”

A required parameter for importing SAP data. “SAP AGENT” is the only available option.

import_details

Contains the details of the query. The import_details string must be enclosed by the <q></q> tags, and uses the tags listed in Table 1 to define the query. The physical size of this parameter can be up to 16KB.

Remarks

This command is only supported if Direct Link is installed and configured.

Table 1 describes the usage of each tag that can be included in the import_details parameter and indicates when tags are required. The Required column in the table indicates when the tag must be present using the following values:

Y = Required

N = Optional

M = Required for multi-table queries only.

B = Required, but no value should be passed.

W = Optional when filters are utilized.

Table 1. Direct Link query tags

Name

Tag

Required

Description

Table Alias

<a>

M

The alias that uniquely identifies the table within the query. This allows the same table to be used more than once.

All Rows

<ar>

Y

Indicates that all matching rows should be returned as part of the query’s result set. A value of 1 overrides the value Maximum rows. A value of 0 returns the number of records specified in the <r> tag.

This tag always appears after the <r></r> tag.

Client

<c>

N

The client within the SAP system.

Child Table Alias

<ca>

M

The alias of the child table.

Child Table Field

<cf>

M

The field in the child table that the join condition is based on.

Client Filename

<cf>

Y

Identifies the target file on the client system where the results of the query will be stored.

Child Table

<ct>

M

The child table in the join condition.

Destination

<d>

N

Identifies a destination in the saprfc.ini file that is used by the SAP RFC libraries to locate an SAP system.

Data Length

<dl>

B

The number of characters in each row, including the carriage return and line feed characters (CR+LF or the hexadecimal characters OD+

OA) that are inserted at the end of each record to indicate the end of the record.

Expected Rows

<e>

B

The expected number of rows the query will return.

Field Name

<f>

Y

The native field name.

Filter Field

<f>

W

The native field name that the filter applies to.

Fields

<fs>

Y

The list of fields in the table that will be returned as part of the query results.

High Value

<h>

W

Contains the high value when using the Between operator. Ignored when using any other operator.

Join Condition

<jc>

M

The join condition.

Job Count

<jcount>

B

Used internally by SAP to identify a Background mode query.

Job Name

<jname>

B

Used internally by SAP to identify a Background mode query.

Join Relationships

<js>

Y

The list of join conditions that link tables within the query.

Low Value

<l>

W

Contains either the lowest value when using the Between operator or the value when using any other operator.

Language

<lg>

N

Language identifier used to determine the locale of fields in the SAP database.

Mode

<m>

Y

Numeric equivalent of the submission mode enumerated type. Valid values are:

0 – Extract Now

1 – Background

Table Name

<n>

Y

The native table name.

Operator

<o>

W

Numeric equivalent of the operator enumerated type. Valid values are:

0 – Equal to (=)

1 – Not equal to (<>)

2 – Less than (<)

3 – Less than or equal to (<=)

4 – Greater than (>)

5 – Greater than or equal to (>=)

6 – Between

7 – Contains

Parent Table Alias

<pa>

M

The alias of the parent table.

Parent Table Field

<pf>

M

The field in the parent table the join condition is based on.

Parent Table

<pt>

M

The parent table in the join condition.

Query

<q>

Y

Encapsulates a query.

Maximum Rows

<r>

Y

The maximum number of rows the query should return.

Selected

<s>

Y

If the <s> tag appears below the <f> tag, it indicates whether the field will be returned as part of the query's result set.

System

<s>

Y

If the <s> tag appears below the <q> tag, it identifies the type of system this query is used against (currently only SAP is supported).

Server Filename

<sf>

B

Identifies the file on the server that holds the results of a Background mode query.

Table

<t>

Y

The table.

Table Description

<td>

Y

The table description from the SAP data dictionary. It should always appear below the <a> tag.

Tables

<ts>

Y

The list of tables from which the query will extract data.

Username

<u>

N

The user’s logon name.

Filter

<w>

W

The filter applied to the table’s data.

Filters

<wc>

W

The list of filters that will be applied to the data contained within the table.

Example

The following example illustrates a multi-table query using the IMPORT SAP command. The correct order and nesting of the tags is necessary to create a valid query string. The example includes an IMPORT SAP command with the tags nested in the correct order. Use this example to determine the required order of the query tags.

Although this example spans multiple lines, this is done for readability only. The command in your script must be entered on a single line.

Tip

The syntax for the IMPORT SAP command is typically very complex. The best way to add IMPORT SAP commands to your scripts is to copy an existing IMPORT SAP command from the Log tab in ACL, then edit the query tags as necessary.

IMPORT SAP PASSWORD 1 TO Purchasing_doc SAP SOURCE "SAP AGENT"
<q version="6.0">
  <s>0</s>
  <d>IDES</d>
  <u>mzunini</u>
  <c>800</c>
  <lg>en</lg>
  <cf>C:\ACL Data\Purchasing_doc.fil</cf>
  <sf>E:\Data\DL_JSMITH111107.DAT</sf>
  <jcount>11110701</jcount>
  <jname>DL_JSMITH111107.DAT</jname>
  <dl>75</dl>
  <m>1</m>
  <r>500</r>
  <ar>0</ar>
  <e>500</e>
  <ts>
    <t>
      <n>EKKO</n>
      <a>T00001</a>
      <td>Purchasing Document Header</td>
      <fs>
        <f>EBELN</f>
        <f>BUKRS</f>
        <f>BSTYP</f>
        <f>BSART</f>
        <f>STATU</f>
        <f>WKURS</f>
      </fs>
      <wc>
        <w>
           <f>BUKRS</f>
           <o>0</o>
           <l>1000</l>
           <h></h>
        </w>
      </wc>
    </t>
    <t>
      <n>EKPO</n>
      <a>T00002</a>
      <td>Purchasing Document Item</td>
      <fs>
        <f>EBELP</f>
        <f>WERKS</f>
        <f>MENGE</f>
        <f>BRTWR</f>
      </fs>
      <wc></wc>
    </t>
  </ts>
  <js>
    <jc>
      <pt>
        <pa>T00001</pa>
        <pf>EBELN</pf>
      </pt>
      <ct>
        <ca>T00002</ca>
        <cf>EBELN</cf>
      </ct>
    </jc>
  </js>
</q>
Related reference
RETRIEVE command


(C) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback