VeloX Docs

Client-side plugins

SAP Read Table plugin

Query data from a single SAP table with RFC_READ_TABLE and pass the result to other plugins.

Overview

SAP Read Table plugin can be found in SAP Targets tab on the left panel of Designer Section.

Purpose: Read data from SAP ERP tables (any systems on NetWeaver)

  • Read – query data from a single SAP table

The plugin is a client (step) plugin. It reads the selected fields of one SAP table with the standard function module RFC_READ_TABLE and returns the rows as a table that following plugins can use. The selection conditions can be fixed in the plugin or built from the values of a preceding plugin, for example the fields of an HTTP JSON Server request. The plugin only reads data; it does not change anything in SAP.

Configuration

Click Configuration on the plugin. You can connect to SAP in two ways.

Connecting with Password Manager

To configure the plugin:

  1. Open the Password Manager tab and select the SAP System. See Password Manager.
  2. Select the Server Type.
  3. Enter Table Name.
  4. Specify the LogLevel.
  5. Optionally select Use Request Credentials.
  6. Click Get Metadata.

Server Type can be Application Server or Message Server. The connection data (host, system number or logon group, client, language, SAPRouter, user and password) is taken from the selected Password Manager entry.

Click Get Metadata

Connecting with Application Server

To configure the plugin, open the Application Server tab and fill the following fields:

  1. Server Host.
  2. System Number.
  3. SAPRouter - optional.
  4. User.
  5. Password.
  6. Client.
  7. Language.
  8. Enter Table Name.
  9. Specify the LogLevel.
  10. Optionally select Use Request Credentials.
  11. Click Get Metadata.

The SID field is read-only. It is filled with the SAP system ID after a successful connection.

Click Get Metadata

Direct connection through a message server is not available. To connect directly, use the Application Server tab.

Select Use Request Credentials to log on to SAP with the user name and password that come with the request (for example, Basic authentication on the HTTP JSON Server) instead of the stored user.

Options

Option Description
Table Name Name of the SAP table (or database view) to read, for example MARA. Required.
LogLevel Amount of detail written to the log: None, Short or Full. See the Log section below.
Use Request Credentials Use the user name and password received with the request instead of the user stored in the plugin. The stored user is still used for Get Metadata in the Designer.
Get Metadata Connects to SAP and reads the field list of the table: field name, description, type and length.

Settings

Settings

Expand Settings to set up the SAP connection pool:

Field Description
IDLE_TIMEOUT Time after which an idle connection in the pool is closed.
POOL_SIZE Number of idle connections kept open in the pool.
MAX_POOL_SIZE Maximum number of connections open to the SAP system at the same time.

Creating template

To create the template:

  1. Click Configuration tab on the plugin.
  2. Expand Advanced tab.
  3. Click Create Template button.
    New window will appear.
New window will appear
  1. Enter PluginName.
    Optionally fill Description, Url, Version and GroupName where the plugin will go.
  2. Click Save and locate the directory where you want to save the plugin.
  3. After that popup window will appear and will suggest you adding the plugin to the left panel of designer section.

Now you have the template of the SAP Read Table that you can use across the projects.

How to use

  1. Add SAP Read Table plugin to the canvas.
  2. Navigate to the Connection Parameters.
  3. Populate SAP connection parameters, user name and password.
  4. Specify name of the table that you would like to query.
  5. Click Get Metadata.
  6. The connection button should become green (the line under the button) that indicates that connection to SAP was established successfully.
  7. Click Fields to select the table fields to read. Use Select All to select all of them.
  8. Map import fields to any desired source (required) and subsequent target (optional).

If you click Get Metadata again and the table in SAP has new, removed or changed fields, the plugin shows the message The structure of the Table is not the same as the structure of the plugin. New fields are added to the field list, removed fields are deleted from the plugin (together with their links on the canvas), and changed fields are updated.

The plugin includes the note Notes on using. Click Notes in the Advanced section to read it.

Import fields and query editor

There are three import fields:

Field Description
OPTIONS (required) Selection entries: the WHERE condition of the query. Set it in the query editor.
ROWSKIPS (optional) Number of rows to skip before the first returned row. 0 or empty: no rows are skipped.
ROWCOUNT (optional) Maximum number of rows to return. 0 or empty: all matching rows are returned.

For additional information refer to the documentation of FM RFC_READ_TABLE.

The ROWSKIPS and ROWCOUNT fields have a Default Value: (an integer) with three options: No Default Value., Ignore Source. (use the default value and ignore the source value) and Only If Source Empty. (use the default value only if the source value is empty). If the field is linked to a source, the first value of the source is used. A value that is not a number is treated as 0. Use the two fields together to read a large table in portions (for example, ROWSKIPS = 0 and ROWCOUNT = 500 for the first 500 rows, then ROWSKIPS = 500 for the next 500).

Field "OPTIONS" has a built-in query editor. Click Editor to open it. The text that you enter in the editor is the default value of the field; OPTIONS has no default value options.

The query uses the syntax of the ABAP WHERE clause: FIELD operator 'value', joined with AND or OR. Put text values in single quotes and use the internal SAP format of the value (for example, leading zeros in material numbers and dates as YYYYMMDD).

The editor supports "=" and "LIKE" operators. The Notes on using also list the comparison operators EQ, NE, LT, LE, GT and GE.

LIKE operator supports these characters:

% - The percent sign represents zero, one, or multiple characters

_ - The underscore represents a single character

In the example below there are three fields linked to the OPTIONS field as input. Those three fields become accessible within query via variables {0}, {1}, {2}.

In the example below there are three fields linked to the OPTIONS field as input. Those three fields become accessible…

For example, with two linked fields the query MATNR = '{0}' AND WERKS = '{1}' becomes MATNR = '000000000000001234' AND WERKS = '1000' for a source row with these values. The variable number is the order in which the fields are linked to OPTIONS.

When the source sends several rows, the query is built for each row and the conditions are joined with OR. Duplicate source rows are removed first. If the query editor is empty, the values of the linked fields are joined with spaces and used as the query.

How the query is chosen:

  • OPTIONS is not linked to a source: the text from the editor is used as it is. If the editor is empty, the whole table is read.
  • OPTIONS is linked and the source has rows: the query is built from the source rows as described above.
  • OPTIONS is linked but the source has no rows: the text from the editor is used without substitution.

Values from the source are inserted into the query as they are. Make sure that they do not contain single quotes and that they are already in the SAP internal format.

Field types

In SAP Read Table plugin import parameters are always single fields.

Export parameters (result of query) is always a table.

Export parameters (result of query) is always a table

Each export field corresponds to one table field and shows its Type and Length in its details. Link export fields to following plugins to pass the rows on. A following plugin that reads a single value gets the value of the first row.

Run-time behavior

  • The plugin calls RFC_READ_TABLE. Long queries are split into several calls, and the results are combined into one table.
  • If the selected fields are longer than 512 characters in total (the row width of RFC_READ_TABLE), the plugin reads them in several calls and joins the results.
  • One log entry is created for all calls. It contains the user, host, client and SAP system ID.

In more detail, for each run the plugin:

  1. Logs on to SAP with the stored user or, with Use Request Credentials, with the user from the request.
  2. Reads ROWSKIPS and ROWCOUNT and builds the query from OPTIONS.
  3. Splits the query into lines of up to 72 characters (the line width of the OPTIONS table of RFC_READ_TABLE). Lines are split at spaces. One call takes up to 3,000 lines; a longer query is sent in several calls.
  4. Splits the selected fields into groups whose total length is 512 characters or less.
  5. Calls RFC_READ_TABLE for each part of the query and each group of fields, and cuts each returned row into field values by the field lengths from the table metadata.
  6. Appends the results of all calls to one output table.

The plugin does not use a delimiter: values are cut from the fixed-width row. Values are not trimmed, so a character value can contain trailing spaces up to the field length.

If the connection or the call fails (for example, wrong credentials, unknown table, wrong query syntax or missing authorization), the error is written to the log and the run of the project stops with the SAP error message.

Test mode

The plugin has no separate test or simulation mode. Because it only reads data, a test run of the project calls RFC_READ_TABLE in the same way as a normal run.

Log

The plugin creates one log entry for each run, even when it makes several calls. The method of the entry is the table name.

LogLevel Content
None Only the summary record; no details file.
Short Table name, user, application server host, client, SAP system ID, start and end time of each call, and errors.
Full Everything from Short, plus the import and export parameters of every RFC_READ_TABLE call (the query lines, the field list and the returned data). Calls are separated by numbered lines.

With Full the log contains the data read from SAP. Use Short for large tables or sensitive data.

See Logs Section.

Prerequisites

  • Network access from the VeloXi server to the SAP system (directly or through a SAPRouter).
  • An SAP user with authorization to call RFC_READ_TABLE (function group SDTX, authorization object S_RFC) and to display the table (authorization object S_TABU_DIS or S_TABU_NAM).

Limitations

  • Only one table per plugin. Joins are not supported; use several plugins.
  • RFC_READ_TABLE does not return fields of type FLOAT. Reading a FLOAT field can cause the ABAP exception ASSIGN_BASE_WRONG_ALIGNMENT; do not select such fields.
  • A single field longer than 512 characters (for example, long string fields) cannot be read.
  • The maximum value of ROWSKIPS and ROWCOUNT is 999999.
  • When the fields are read in several calls, the parts of a row are matched by their position in the result. Keep the query and data stable during the run.
  • When the query is sent in several calls, ROWSKIPS and ROWCOUNT apply to each call separately.
  • When the query is split into 72-character lines, repeated spaces are reduced to one. A text value that contains several spaces in a row may not match.
Esc