This section shows how to use the integration type SAP Table or View.
Warning! Missing Authorization To use the Table component, access to the designated authority objects (RFC) in SAP must be available. For more information, refer to the knowledge base article SAP User Rights: Table.
Look Up an SAP Table or View #
- Create a new Service of type SAP Table or View.
- Click [Save and edit]. The Search SAP Table or View menu opens.
- Enter the name of the Table or View to be extracted in the field Search by name (1) or search for a Table description. Use wildcards ( * ) if needed.
- Click [Search] (2) to display the search results.
- Select a source file from the list of available search results (3).
The extraction settings of SAP Table and Views open automatically.
The SAP Table or View settings consist of the following subsections:
- Table or View (4) displays the name and description of the selected SAP Table or View.
- Advanced Settings (5) define how the data is extract from SAP.
- Output Columns (6) define which columns are extracted.
- WHERE Clause (7) offers an optional data filter.
- WHERE Clause Editor (8) offers a toolkit for creating WHERE clauses.
Table or View #
The Table or View section displays the name and description of the selected table or view.
To select a different source file, click Select in the upper right corner of the section.
Advanced Settings #
Specifies the name of the function module used for data extraction. This field is filled automatically depending on what function modules are installed on your SAP system. Custom function modules are supported.
The following function modules can be used to extract tables:
- RFC_READ_TABLE (TAB512)
- /BODS/RFC_READ_TABLE (TAB2048)
- /SAPDS/RFC_READ_TABLE (TAB2048)
Warning! Duplicates in the target environment!
The SAP standard modules for table extraction do not have pointers for table fields. In larger tables this may cause low performance and duplicates in the target environment. Use the function module Z_THEO_READ_TABLE from Theobald Software to ensure smooth extractions.
Note the necessary authorization for SAP tables:
S_TABU_NAM ACTVT=03; TABLE=ENLFDIR
Specifies the maximum number of extracted records. 0 extracts the entire table.
Rows per Package
The extracted data will be split into packages of the defined size. The default value is 50000 lines.
A package size between 20000 and 50000 is advisable for large amounts of data. 0 means no packaging. Not using packaging can lead to an RFC timeout for large data extracts.
Warning! RFC_ERROR_SYSTEM_FAILURE - No more storage space available for extending an internal table:
To avoid a memory overflow on the SAP source system and to avoid huge overheads, choose a package size that suits your memory capacity.
Run in background
If this checkbox is checked, the table extraction is executed as a background job in SAP. This setting is optional and is supported in combination with function module Z_THEO_READ_TABLE as of version 2.0. Activate the setting Run in background for long-running extractions with a large amounts of data that may run into a timeout error (“Time limit exceeded”), when using the foreground mode.
Tip: The extraction jobs can be found in the SAP JobLog (SM37) under the JobName theo_read_table.
Output Columns #
You can select either all or only individual columns for extraction.
Per default all columns are selected to be extracted. Deselect the columns you don’t want to extract.
WHERE Clause #
Use a WHERE clause to filter your data.
Enter a space before and after the equal sign:
Correct: YEAR = ‘1999’
Wrong: YEAR= ‘1999 ‘, YEAR =’1999’ or YEAR=’1999’
Set floating point numbers in single quotation mark:
Correct: KMENG > ‘10.3’
Wrong: KMENG > 10.3
Note: The WHERE clause doesn’t need any line break (return key).
- Values must have the internal SAP representation:
- The date 01.01.1999 has the internal representation 19990101 (YYYYMMDD)
- The year period 001.1999 has the internal representation 1999001 (YYYYPPP)
- Numbers must contain the leading zeros, e.g., customer number 1000 has the internal representation 0000001000.
|=, EQ||True if the content of operand1 is equal to the content of operand2|
|<>, NE||True if the content of operand1 is not equal to the content of operand2|
|<, LT||True if the content of operand1 is less than the content of operand2|
|>, GT||True if the content of operand1 is greater than the content of operand2|
|<=, LE||True if the content of operand1 is less than or equal to the content of operand2.|
|>=, GE||True if the content of operand1 is greater than or equal to the content of operand2|
|(NOT) LIKE||True if the value of the operand operand1 matches (does not match) the pattern in the operand operand2.|
|(NOT) BETWEEN||True if the content of the operand operand (not) lies between the values of the operands operand1 and operand2.|
For more information on the OpenSQL syntax see SAP help site - Select WHERE.
How to use the WHERE Clause in Swagger Inspector
The WHERE-Clause can be parameterized in the request body of the service. Example:
For more information on parameterizing services, refer to the following knowledge base articles:
WHERE Clause Editor #
The WHERE clause editor offers a toolkit for those who are not familiar with the syntax of the WHERE clause.
There are 2 options for adding criteria to the WHERE clause:
- [Add Criteria] adds single criteria.
The default structure for a single criteria with static values is
[Column][Operator][Value]e.g., MARC~WERKS = 1000.
- [Add Criteria Group] adds a group of criteria.
The default structure for a criteria group is
([Column1][Operator1][Value1][Boolean][Column2][Operator2][Value2])e.g., (MARC~PSTAT = ‘L’ OR MARC~PSTAT = ‘LB’).
Tip: Combine multiple criteria and criteria groups to create complex filters e.g., MARC~WERKS = 1000 AND (MARC~PSTAT = ‘L’ OR MARC~PSTAT = ‘LB’) extracts only data where the column WERKS equals 1000 and the column PSTAT equals either ‘L’ or ‘LB’.
Components of the WHERE Clause Editor
The following components are available in the editor:
|Delete row||deletes a criteria.|
|Move row up||changes the sequence of the criteria. The selected criteria moves up.
The sequence of criteria can also be changed with drag&drop.
|Move row down||changes the sequence of the criteria. The selected criteria moves down.
The sequence of criteria can also be changed with drag&drop.
|Column||adds a column. Click on the component to select a column from the available tables.|
|SQL||adds an SQL statement.|
|Operator||adds an operator e.g., =, <, >, etc.|
|Value||adds a static value of type String, Number, Flag or List. List offers a separate editor to create lists of type String, Number or Select. Select enables usage of SELECT statements.|
|Criteria||adds a new criteria after the selected criteria.|
|Group||adds a new group of criteria the selected criteria.|
When adding or editing a criteria only the relevant components are displayed e.g., Add Operator is only available if there is a column or SQL statement to use an operator on.
Editing and Deleting Components
- Click on a component to edit it. All areas that are marked green can be edited.
- To delete a component, click the icon that appears when hovering over the component.
Note: The WHERE clause is overridden when a WHERE clause is entered in the designated text field or if a WHERE clause is entered in the body of the service definition when running a service.
SAP Customizing #
Note: SAP customizing is optional. The installation of the custom function module
Z_THEO_READ_TABLE is recommended.
RFC_READ_TABLE Restrictions #
Especially with older SAP releases you may encounter a few restrictions when using the SAP standard function module (RFC_READ_TABLE) for table extraction:
- The overall width of all columns to be extracted must not exceed 512 bytes.
- Depending on the SAP version there may be other restrictions. It is not possible to extract data from tables that contain one or more columns of the data type f (FLTP, floating point), DEC (decimal, e.g. for percentage) or x (RAW, LRAW).
- Poor extraction performance with larger tables.
If the above-mentioned restrictions hinder your work, install the Theobald Software custom function module Z_THEO_READ_TABLE on your SAP system.
Warning! Error while converting value ‘*.0’ of row 1530, column 3
The SAP standard module RFC_READ_TABLE for table extraction can only extract the ABAP data type DEC to a limited extent. This leads to the mentioned example error during extraction. Use the function module from Theobald Software Z_THEO_READ_TABLE.
Installation of Z_THEO_READ_TABLE #
An SAP transport request for the installation of the function module is provided in the installation directory:
There are two transports, one for SAP systems >= 7.40 SP5 (Z_THEO_READ_TABLE.zip), and one for systems with a lower version (Z_THEO_READ_TABLE-before_740SP05.zip).
- Z_THEO_READ_TABLE-transport.zip contains version 2.x of Z_THEO_READ_TABLE - the custom function module, a number of ABAP classes and other DDIC objects.
- Z_THEO_READ_TABLE-transport-before-740SP05.zip contains version 1.x (till 1.11) of Z_THEO_READ_TABLE - the custom function module.
Note: Take a look at the README.pdf in the installation directory (e.g.,
C:\Program Files\XtractProduct\ABAP\README.pdf) before installing any custom function modules.
When importing the Z_THEO_READ_TABLE-transport-before-740SP05 on older SAP releases a syntax error may occur. Contact Theobald Support and send the dedicated error message text.
Testing the module in SAP
Warning! Generating Short Dumps
The function module Z_THEO_READ_TABLE can only be called by Theobald products due to the callback function of the module. Testing the function module on an SAP system is therefore not possible.