Banner Image
Jürgen Bäurle
Projects  ·  Work  ·  Blog  ·  Contact

XQL - Xtract Query Language

A few years ago I developed XQL, the Xtract Query Language (XtractQL), which got integrated in various Theobald products in the meatime in order to dynamically retrieve SAP business data by using a simple query language. The XtractQL syntax combines elements from the SQL and ABAP languages and can be used on:

  • SAP tables/objects and their metadata
  • Funktion modules (BAPIs)
  • BW cubes
  • SAP queries
  • MDX statements

A XtractQL .NET Data Provider is supported by the ERPConnect library from Theobald Software.

The following examples show how XtractQL can be used.

Table

Select the first five records from table T001W where the field FABKL has a value of US.

			SELECT TOP 5 * FROM T001W WHERE FABKL = 'US'
			
Select all records from table MARA. In SAP, the XQL query is executed using the custom function module Z_XTRACT_IS_TABLE.
			SELECT * FROM MARA WITH-OPTIONS(CUSTOMFUNCTIONNAME = 'Z_XTRACT_IS_TABLE')
			
Select all records from table MAKT. The results table includes columns with the names ShortText, MANDT and Language.
			SELECT MAKTX AS [ShortText], MANDT, SPRAS AS Language FROM MAKT
			
Execute SAP Query S|ZTHEO02|ZLIKP with workspace Standard, user group ZTHEO02 and name ZLIKP. The results table will return up to 30 records. XtractQL provides expanded syntax options for SELECT statements for SAP Query executions. For example, you can specify the return fields in the form LIPS-LFIMG or you can specify a WHERE clause as you typically would in SAP 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 Module

XQL query to discover the metadata for the Export parameter collection of function module SD_RFC_CUSTOMER_GET.

 			DESCRIBE FUNCTION 'SD_RFC_CUSTOMER_GET' GET EXPORTS
			
XQL query to discover the metadata for the FIELDS of SAP Query ZTHEOSQUERY.
			DESCRIBE QUERY 'G|ZTHEO1|ZTHEOSQUERY' GET FIELDS
			
XQL query to execute SAP function module SD_RFC_CUSTOMER_GET using the Export parameter KUNNR. The SAP table CUSTOMER_Twilldurch die Syntaxbeschreibung INTO @RETVAL definiert.
			EXECUTE FUNCTION 'SD_RFC_CUSTOMER_GET' 
			  EXPORTS KUNNR='0000003340' 
			  TABLES CUSTOMER_T INTO @RETVAL;
			
See link below for more XtractQL examples.

The Syntax of XtractQL and Examples (for ERPConnect Services)