XQL – Xtract Query Language

2012 · Theobald Software · .NET · C# · Compiler Techniques

A query language for SAP business data that got integrated into several Theobald products over the years, with a syntax inspired by SQL and ABAP.

XQL runs against SAP tables and objects and their metadata, function modules (BAPIs), BW cubes, SAP queries and MDX statements. ERPConnect ships an XQL .NET data provider.

Tables and SAP queries

The first five records of table T001W where the field FABKL has the value US:

SELECT TOP 5 * FROM T001W WHERE FABKL = 'US'

All records of table MARA. On the SAP side the query runs through the custom function module Z_XTRACT_IS_TABLE:

SELECT * FROM MARA WITH-OPTIONS(CUSTOMFUNCTIONNAME = 'Z_XTRACT_IS_TABLE')

All records of table MAKT. The result table has the columns ShortText, MANDT and Language:

SELECT MAKTX AS [ShortText], MANDT, SPRAS AS Language FROM MAKT

The SAP query S|ZTHEO02|ZLIKP with workspace Standard, user group ZTHEO02 and name ZLIKP, limited to 30 records. For SAP queries the SELECT statement has a wider syntax: return fields can be written as LIPS-LFIMG, and the WHERE clause is written as in ABAP:

SELECT TOP 30 LIPS-LFIMG, LIPS-MATNR, TEXT_LIKP_KUNNR AS Kundennummer
  FROM QUERY 'S|ZTHEO02|ZLIKP'
  WHERE SP$00002 BT '0080011000' AND '0080011999'

Function modules

The metadata of the export parameters of function module SD_RFC_CUSTOMER_GET:

DESCRIBE FUNCTION 'SD_RFC_CUSTOMER_GET' GET EXPORTS

The metadata of the fields of SAP query ZTHEOSQUERY:

DESCRIBE QUERY 'G|ZTHEO1|ZTHEOSQUERY' GET FIELDS

A call of function module SD_RFC_CUSTOMER_GET with the export parameter KUNNR. The SAP table CUSTOMER_T becomes the result through INTO @RETVAL:

EXECUTE FUNCTION 'SD_RFC_CUSTOMER_GET'
  EXPORTS KUNNR='0000003340'
  TABLES CUSTOMER_T INTO @RETVAL;

Screenshots

The XQL explorer
The XQL explorer.
The XQL query browser
The query browser.

Posts about XQL