Notation options

 The GuiXT call statement supports two distinct notations for passing parameters:

The Open Call notation is often more flexible and better suited for complex applications. It also allows us to bundle requests: Multiple call requests can be grouped into a single Remote Function Call, reducing overhead and improving efficiency.

Note: Open Call notation requires the installation of the function module /guixt/call, which is included in the GuiXT utilities package together with /guixt/dbselect.

To demonstrate both notations, consider the following scenario: We want to retrieve the name and address of a plant from the SAP table T001W.

 

GuiXT, Standard Call notation
// plant  
Set V[plant] "1710"

// result structure
CreateStructure V[plantdata] name street city

// clear result text variable
Clear V[r]

// execute database Select
Call /guixt/dbselect cache="session" _
  in.table="T001W" _
  in.condition="WERKS = '&V[plant]'" _
  in.fields="name1,stras,ort01" _
  table.values="r"

// copy text variable into structure
CopyText fromText="r" toStructure="V[plantdata]"

// display data
Box	(3,10) (7,40)	"Supplying Plant: &V[plant]"
Text (4,11) "&V[plantdata.name]"
Text (5,11) "&V[plantdata.street]" 
Text (6,11) "&V[plantdata.city]"


GuiXT, Open Call notation
// plant 
Set V[plant] "1710"

// result table
CreateTable V[plantdata] name street city

// create SQL parameters
Set V[table] "T001W"
Set V[fields] "name1,stras,ort01"
Set V[condition] "WERKS = '&V[plant]' " 

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="plantdata"

// display data
Box	(3,10) (7,40)	"Supplying Plant: &V[plant]"
Text (4,11) "&V[plantdata.name.1]"
Text (5,11) "&V[plantdata.street.1]" 
Text (6,11) "&V[plantdata.city.1]"

For the following examples we will use the Open Call notation.
Retrieve a set of rows from a single table
GuiXT
// create result table 
CreateTable V[customers] account name city country

// create SQL parameters
Set V[table] "KNA1"
Set V[fields] "kunnr,name1,ort01,land1"
Set V[condition] "land1 = 'CA' "

// execute database select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="customers"

// display result
Table (1,1) (15,76) name="customers"
Column "Account" size=10 name="account"
Column "Name" size=20 name="name"
Column "City" size=20 name="city"
Column "Country" size=20 name="country"
Formatting the field output The returned database values are automatically formatted according to the user's settings:

 
GuiXT
// result table
CreateTable V[orders] vbeln auart audat kunnr netwr

// create SQL parameters
Set V[table] "VBAK"
Set V[fields] "vbeln,auart,audat,kunnr,netwr"
Set V[condition] "audat between '20240101' and '20240131' 
                and vbak~vbtyp = 'C' " 

// execute database Select
Call "/guixt/dbselect" -currentuser_
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="orders"

// display result
Table (1,1) (10,66) name="orders"  title="Orders" fixedColumns=5
Column "Order" size=12 name="vbeln" -readOnly
Column "Type" size=8 name="auart" -readOnly
Column "Date" size=12 name="audat" -readOnly
Column "Customer" size=12 name="kunnr" -readOnly
Column "Value" size=16 name="netwr" -alignRight -readOnly

For another user with the following SAP user settings

 

and who logs in in French, the table looks as follows:



We see that the document type is shown as "CMD" language dependent, and the values are shown with a decimal comma.

Group separators are not normally inserted into the returned values, but there is a parameter called UseGroupSeparator that allows you to insert group separators (period, comma, or, with the user settings mentioned above, a space):

 

 
GuiXT
Set V[usegroupseparator] "X"
...
// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  export.usegroupseparator="usegroupseparator" _
  import.values="orders"
In some cases, you may need unformatted values, for example, if you need the values for further database access. You can obtain these by placing an asterisk in front of a field name:

 

 
GuiXT
Set V[fields] "*vbeln,*auart,*audat,kunnr,netwr"

Document numbers are now displayed with leading zeros, the document type is displayed in the internal format "TA" without language-dependent conversion, and the date is displayed in the raw format YYYYMMDD.

Decimal values, internally represented as packed decimals, are shown with a decimal point independent of the user settings.
Adding text columns When accessing the database, it is often necessary to retrieve not only the key value stored in a column but also the corresponding descriptive text. In SAP systems, such texts are typically maintained in separate, language‑dependent tables. You can obtain them either by performing a database join (explained in a later section) or by using a special feature of /guixt/dbselect: appending @text to a column name automatically retrieves the associated text, provided that the relevant assignment is available in the SAP Repository.

Example:

 
GuiXT
// result table
CreateTable V[orders] vbeln auart audat kunnr company netwr 

// create SQL parameters
Set V[table] "VBAK"
Set V[fields] "vbeln,auart@text,audat,kunnr,kunnr@text,netwr"
Set V[condition] "audat between '20240101' and '20240131' and vbtyp = 'C' " 

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="orders"

// display result
Table (1,1) (10,93) name="orders"  title="Orders" fixedColumns=7
Column "Order" size=8 name="vbeln" -readOnly
Column "Order type" size=20 name="auart" -readOnly
Column "Account" size=8 name="kunnr" -readOnly
Column "Customer" size=30 name="company" -readOnly
Column "Date" size=12 name="audat" -readOnly
Column "Value" size=12 name="netwr" -alignRight -readOnly


You can use the @text suffix in the FIELDS clause but not in CONDITION, ORDERBY, GROUPBY or HAVING. If you wish to order the result table by a text column, use the GuiXT SORT command after retrieving the data. The @text feature can be used for reading group texts as shown in the following example. In this case, use the @text in the FIELDS list but omit it in GROUPBY:

 

GuiXT
// result table
CreateTable V[customers] countryname customercount

// create SQL parameters
Set V[table] "KNA1"
Set V[fields] "land1@text,count(*)"
Set V[groupby] "land1"

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.groupby="groupby" _
  import.values="customers"

// order by country name
Sort V[customers] orderBy="countryname"

// display result
Table (1,1) (9,41) name="customers"  _
                title="Customer count per country" fixedColumns=2
Column "Country" size=30 name="countryname" -readOnly
Column "Count" size=8 name="customercount" -readOnly -alignRight

Texts stored in the SAP data dictionay, for example for the order status which internally is stored as A, B, C, can also be addressed with the @text notation. Example:

 

 
GuiXT
// result table
CreateTable V[orders] vbeln audat kunnr customer status  

// create SQL parameters
Set V[table] "VBAKUK"
Set V[fields] "vbeln,audat,kunnr,kunnr@text,gbstk@text"
Set V[condition] "audat between '20240101' and '20240131' and vbtyp = 'C' " 

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="orders"

// display result
Table (1,1) (10,93) name="orders"  title="Orders" fixedColumns=5
Column "Order" size=8 name="vbeln" -readOnly
Column "Date" size=12 name="audat" -readOnly
Column "Account" size=10 name="kunnr" -readOnly
Column "Customer" size=34 name="customer" -readOnly
Column "Status" size=20 name="status" -readOnly

Formatting values in the condition clause The comparison values specified in the condition clause always refer to the database format of the respective column. Let us consider the following result table as an example:

 
GuiXT
// result table
CreateTable V[items] order ordertype item product quantity unit 

// create SQL parameters
Set V[table] "VBAK join VBAP on VBAP~VBELN = VBAK~VBELN"
Set V[fields] "vbap~vbeln,vbak~auart,vbap~posnr,vbap~matnr,
                vbap~kwmeng,vbap~vrkme"
Set V[condition] "vbak~vbtyp = 'C' and audat EQ '20251105' " 

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="items"

// display result
Table (1,1) (10,72) name="items" _
  title="&V[items.rowcount] order items selected" fixedColumns=2
Column "Order" size=10 name="order" -readOnly
Column "Type" size=6 name="ordertype" -readOnly
Column "Item" size=8 name="item" -readOnly
Column "Product" size=20 name="product" -readOnly
Column "Quantity" size=10 name="quantity" -readOnly -alignRight
Column "Unit" size=10 name="unit" -readOnly

We now select order number 14764:
GuiXT
Set V[condition] "vbak~vbeln = '14764' " 

No more order items appear in the table.:

 

We must specify the document number in the internal format, adding leading zeros:
GuiXT
Set V[condition] "vbak~vbeln = '0000014764' " 


 

Next, we add a condition for the unit "KG":
GuiXT
Set V[condition] "vbak~vbeln = '0000014764' and vbap~vrkme = 'KG' " 

 

Excellent. Let's also try unit "PC":
GuiXT
Set V[condition] "vbak~vbeln = '0000014764' and vbap~vrkme = 'PC' " 

 

No item is selected. The reason for this is that the units are stored in the database as KG and ST and are then displayed according to the language; for English, these are KG and PC. Therefore, KG works, but PC does not. Similar problems occur with the order type, where the displayed order type OR is stored internally as TA.

For fixed selection criteria, you can specify the correct database value, e.g., ST as the unit or TA as the order type. However, if the user enters these values, you need automatic conversion to the corresponding database values.

For this purpose, /guixt/dbselect allows you to specify an SAP domain name that is used to find the correct conversion rule to apply to a value in the condition clause. Example:
GuiXT
// result table
CreateTable V[items] order ordertype item product quantity unit 

// create SQL parameters
Set V[table] "VBAK join VBAP on VBAP~VBELN = VBAK~VBELN"
Set V[fields] "vbap~vbeln,vbak~auart,vbap~posnr,vbap~matnr,
                vbap~kwmeng,vbap~vrkme"

// use SAP domains for value conversion
Set V[domname1] "VBELN"
Set V[domvalue1] "14674"
Set V[domname2] "MEINS"
Set V[domvalue2] "PC"
Set V[domname3] "AUART"
Set V[domvalue3] "OR"

Set V[condition] "vbak~vbeln = @VBELN and vbap~vrkme = @MEINS and 
                vbak~auart = @AUART "


// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.domname1="domname1" _
  export.domvalue1="domvalue1" _
  export.domname2="domname2" _
  export.domvalue2="domvalue2" _
  export.domname3="domname3" _
  export.domvalue3="domvalue3" _
  export.condition="condition" _
  import.values="items"

// display result
Table (1,1) (10,72) name="items" _
  title="&V[items.rowcount] order items selected" fixedColumns=2
Column "Order" size=10 name="order" -readOnly
Column "Type" size=6 name="ordertype" -readOnly
Column "Item" size=8 name="item" -readOnly
Column "Product" size=20 name="product" -readOnly
Column "Quantity" size=10 name="quantity" -readOnly -alignRight
Column "Unit" size=10 name="unit" -readOnly

 


You can find the correct domain names using SAP transaction SE11. Alternatively, you can use a GuiXT script that displays the fields with conversion exits and the corresponding domain names for a specific table name:
GuiXT
CreateTable V[convfields] fieldname fieldtext domain convexit

// table name
Set V[tabname] "VBAK"

// create SQL parameters
Set V[table] "DD03M"
Set V[fields] "fieldname,ddtext,domname,convexit"
Set V[condition] "tabname = '&V[tabname]'  and convexit NE '' 
                and ddlanguage = '&V[_language]' "
Set V[orderby] "fieldname"


// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  export.orderby="orderby" _
  import.values="convfields"

// display result
Table (1,1) (22,84) name="convfields" _
  title="Table &V[tabname]: &V[convfields.rowcount] fields 
                with conversion exit" fixedColumns=4
Column "Field" size=16 name="fieldname" -readOnly
Column "Text" size=30 name="fieldtext" -readOnly
Column "Domain" size=16 name="domain" -readOnly
Column "Conversion exit" size=16 name="convexit" -readOnly

 


 

Using RANGE tables in the condition

To process a variable number of key values, the SAP Open SQL interface allows values to be passed to the database using RANGE tables.

A RANGE table consists of four fields: SIGN, OPTION, LOW, and HIGH.

For single-value queries, only the LOW field is required; HIGH may be omitted. Using /guixt/dbselect, you can construct ranges in table variables and pass them directly to the database.

In the example below, material numbers are first read from a text file and then transferred to the database via the CONDITION clause. The text file looks as follows: 

 

Since the material numbers in the input text file are given in external format, e.g. 31 and not 000000000000000031, we specify the SAP domain MATNR as parameter DOMRANGE1. The /guixt/dbselect function then automatically converts all LOW and HIGH values in the RANGE table from external to internal format.

We read the stock data for each material and output the following table:

GuiXT
// read material numbers from text file into range table
Set V[inpfile] "C:\guixt\materialnumbers.txt"
OpenFile "&V[inpfile]"

// create range table
CreateStructure V[matrangeline] sign option low high
CreateTable V[matrange] include=V[matrangeline]

// default values for material range selection
Set V[matrangeline.sign] "I"
Set V[matrangeline.option] "EQ"

label next_matnr
ReadFile "&V[inpfile]" matrangeline.low
if Q[ok]
  AppendRow V[matrangeline] table=V[matrange]
  goto next_matnr
endif

CloseFile "&V[inpfile]"


// result table
CreateTable V[materials] matnr mattext lgort lgorttext labst  

// create SQL parameters
Set V[table] "MARD"
Set V[fields] "matnr,matnr@text,lgort,lgort@text,labst"
Set V[domrange1] "MATNR"
Set V[condition] "werks = '1710' AND matnr in @RANGE1 AND labst > 0" 
Set V[orderby] "matnr,lgort" 

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.range1="matrange" _
  export.domrange1="domrange1" _
  export.condition="condition" _
  export.orderby="orderby" _
  import.values="materials"

// display result
Table (1,1) (10,93) name="materials"  title="Stock Overview" fixedColumns=5
Column "Material" size=10 name="matnr" -readOnly
Column "Text" size=40 name="mattext" -readOnly
Column "StLoc" size=5 name="lgort" -readOnly
Column "Storage Location" size=20 name="lgorttext" -readOnly
Column "Stock" size=12 name="labst" -readOnly -alignRight


Size restrictions

When SAP Open SQL processes RANGE tables, it generates an SQL statement whose length is limited by the maximum statement size allowed by the database. On SAP HANA, this limit can be configured via the parameter dbs/hdb/stmtlng.

In practice, this means:




With the increased limit in modern S/4HANA systems, it should be possible to handle over 3 million material numbers in a single statement.

Join two tables (inner join)
GuiXT
// create result table
CreateTable V[customers] account name city country

// create SQL parameters
Set V[table] "KNA1 join T005T 
                      on T005T~LAND1 = KNA1~LAND1 
                         and T005T~SPRAS = '&V[_language]' "
Set V[fields] "kna1~kunnr,kna1~name1,kna1~ort01,t005t~landx"
Set V[condition] "kna1~ort01 like 'M%' "

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="customers"

// display result
Table (1,1) (15,76) name="customers"
Column "Account" size=10 name="account"
Column "Name" size=20 name="name"
Column "City" size=20 name="city"
Column "Country" size=20 name="country"

Common syntax errors
Wrong table name:

Set V[table] "KNA1 join T005TX ... "




You can also handle the error at runtime and output it as a message:


GuiXT
Call "/guixt/dbselect" -currentUser ...

if not Q[ok]
  Message "&V[_exception]"
endif


Wrong field name:

Set V[fields] "kna1~kunnr,kna1~name ... "


 


Wrong field name with '-' instead of '~':

Set V[fields] "kna1~kunnr,kna1~name1,kna1-ort01,... "


 


Missing space characters in join around "=":

Set V[table] "KNA1 join T005T on T005T~LAND1=KNA1~LAND1 and ..."


 

Value too long in condition:

Set V[plant] "17100"
...
Set V[condition] "WERKS = '&V[plant]' "

 


In this case, the SAP system generates an ABAP dump which you can analyze in transaction ST22. It shows the wrong value "17100" and the target field size 4:
 


Join three tables (inner join and outer join) For text tables, it is often better to use an outer join to obtain the table values even if a text is not available in a text table. In the example, we use the text table TVAGT, text for a rejection code.

GuiXT
CreateTable V[items] kunnr vbeln audat matnr arktx abgru abgrutext

// create SQL parameters
Set V[table] "VBAP join VBAK on VBAK~VBELN = VBAP~VBELN 
                left outer join TVAGT on TVAGT~ABGRU = VBAP~ABGRU 
                         and TVAGT~SPRAS = '&V[_language]' "
Set V[fields] "vbak~kunnr,vbak~vbeln,vbak~audat,vbap~matnr,
                vbap~arktx, vbap~abgru,tvagt~bezei"
Set V[condition] "vbap~abgru ne '' 
                and audat between '20150101'  and '20251231' 
                and vbak~vbtyp = 'B'"
Set V[orderby] "vbak~audat"

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="items"

if not Q[ok]
  Message "&V[_exception]"
endif

// display result
Table (1,1) (9,84) name="items" fixedColumns=6 title="Rejected Offer Items"
Column "Date" size=10 name="audat"
Column "Customer" size=10 name="kunnr"
Column "Offer" size=10 name="vbeln"
Column "Article" size=12 name="matnr"
Column "Rej.Code" size=8 name="abgru"
Column "Reason for Rejection" size=30 name="abgrutext"
Aggregation with count(*) and sum() The SQL agggregation functions count(*) and sum( COLNAME ) can be used in conjunction with the GROUPBY parameter

GuiXT
CreateTable V[items] abgru abgrutext count total

// create SQL parameters
Set V[table] "VBAP join VBAK on VBAK~VBELN = VBAP~VBELN 
                left outer join TVAGT on TVAGT~ABGRU = VBAP~ABGRU 
                and TVAGT~SPRAS = '&V[_language]' "
Set V[fields] "vbap~abgru,tvagt~bezei,count(*),sum( vbap~netwr )"
Set V[condition] "vbap~abgru ne '' and audat between '20240101' 
                and '20241231' and vbak~vbtyp = 'B'"
Set V[orderby]  "vbap~abgru,tvagt~bezei"
Set V[groupby]  "vbap~abgru,tvagt~bezei"
Set V[groupseparator] "X"

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  export.groupby="groupby" _
  export.orderby="orderby" _
  export.usegroupseparator="groupseparator" _
  import.values="items"

// display result
Table (1,1) (12,80) name="items" fixedColumns=4 title="Rejected Offer Items"
Column "Rej.Code" size=8 name="abgru" -readOnly
Column "Reason for Rejection" size=40 name="abgrutext" -readOnly
Column "Count" size=10 name="count" -readOnly
Column "Amount" size=16 name="total" -alignRight -readOnly
Further aggregation functions In the following example we also use min( COLNAME ), max( COLNAME ) and avg( COLNAME ):

The ORDER BY clause in SQL is always executed after grouping. By specifying "... as totalamount", we can refer to the aggregated column sum( netwr ) when specifying ORDER BY.

 
GuiXT
CreateTable V[ordervalues] auart count sum avg min max

// create SQL parameters
Set V[table] "VBAK"
Set V[fields] "auart, count(*), sum( netwr ) as totalamount, 
                avg( netwr ), min( netwr ), max( netwr )"
Set V[condition] "audat between '20240101' and '20241231' 
                and vbak~vbtyp = 'C' and netwr > 0"
Set V[groupby]  "auart"
Set V[orderby]  "totalamount descending"
Set V[groupseparator] "X"

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  export.groupby="groupby" _
  export.orderby="orderby" _
  export.usegroupseparator="groupseparator" _
  import.values="ordervalues"

// display result
Table (1,1) (12,95) name="ordervalues" fixedColumns=6  
Column "Order type" size=10 name="auart" -readOnly
Column "Count" size=8 name="count" -alignRight -readOnly
Column "Total value" size=24 name="sum" -alignRight -readOnly
Column "Average" size=16 name="avg" -alignRight -readOnly
Column "Minimum" size=16 name="min" -alignRight -readOnly
Column "Maximum" size=16 name="max" -alignRight -readOnly
The HAVING clause The HAVING clause is used to filter grouped records produced by GROUP BY, based on aggregate conditions. Note that SQL does not allow the use of column aliases (defined using ... AS ... in the field list) within the HAVING clause. Therefore, the aggregation function must be repeated explicitly in the HAVING condition.

 
GuiXT
CreateTable V[orders] kunnr name1 ordercount

// create SQL parameters
Set V[table] "VBAK join KNA1 on KNA1~KUNNR = VBAK~KUNNR"
Set V[fields] "vbak~kunnr,kna1~name1,count(*) as ordercount"
Set V[condition] "vbak~audat between '20200101' and '20240131'
                and vbak~vbtyp = 'C' " 
Set V[groupby] "vbak~kunnr,kna1~name1"
Set V[having] "count(*) GE 200"
Set V[orderby] "ordercount descending"

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  export.groupby="groupby" _
  export.having="having" _
  export.orderby="orderby" _
  import.values="orders"

// display result
Table (1,1) (10,59) name="orders"  title="&V[orders.rowcount] 
                customers with 200 or more orders" fixedColumns=3
Column "Customer" size=12 name="kunnr" -readOnly
Column "Name" size=30 name="name1" -readOnly
Column "Order Count" size=12 name="ordercount" -readOnly



Other aggregation function such as avg() can be used equally well:

 
GuiXT
// result table
CreateTable V[orders] country region averageordervalue

// create SQL parameters
Set V[table] "VBAK join KNA1 on KNA1~KUNNR = VBAK~KUNNR join T005T 
                on T005T~LAND1 = KNA1~LAND1 
                and T005T~SPRAS = '&V[_language]' 
                join T005U on T005U~LAND1 = KNA1~LAND1 
                and T005U~BLAND = KNA1~REGIO 
                and T005U~SPRAS = '&V[_language]' "
Set V[fields] "t005t~landx,t005u~bezei,
                avg( vbak~netwr ) as averageordervalue"
Set V[condition] "vbak~audat between '20200101' and '20240131' 
                and vbak~vbtyp = 'C' and vbak~netwr > 0 
                and kna1~regio NE '' " 
Set V[groupby] "t005t~landx,t005u~bezei"
Set V[having] "avg( vbak~netwr ) < 20000"
Set V[orderby] "averageordervalue ascending"
Set V[groupseparator] "X"

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  export.groupby="groupby" _
  export.having="having" _
  export.orderby="orderby" _
  export.usegroupseparator="groupseparator" _
  import.values="orders"

// display result
Table (1,1) (10,67) name="orders"  _
          title="Regions with average order value < 20k" fixedColumns=3
Column "Country" size=20 name="country" -readOnly
Column "Region" size=20 name="region" -readOnly
Column "Average Order Value" size=25 name="averageordervalue" _
                -readOnly -alignRight
String Functions SAP Open SQL supports several string functions, see
https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/abensql_string_func.html

The string functions can be used in /guixt/dbselect under the following considerations:
- The availability of the functions depends on the SAP kernel release.
- When using string functions with two or more arguments in the FIELDS clause, replace the comma between arguments with a vertical bar (|).
- We recommend using /guixt/dbselect version 2026‑02‑06 or higher.

Here are same examples:

 
GuiXT
// create result table 
CreateTable V[matgroups] group netwr

// create SQL parameters
Set V[table] "VIVEDA"
Set V[fields] "LEFT( matnrx | 2 ),sum( netwr )"
Set V[groupby] "LEFT( matnrx | 2 )"
Set V[condition] "audat between '20250101' and '20251231' "
Set V[usegroupseparator] "X"

// execute database select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.groupby="groupby" _
  export.usegroupseparator="usegroupseparator" _
  import.values="matgroups"

Sort V[matgroups] columns="group"

// display result
Table (1,1) (8,39) name="matgroups" fixedColumns=2
Column "Group" size=14 name="group" -readOnly
Column "Total Amount" size=20 name="netwr"  -alignRight -readOnly




 
GuiXT
// create result table 
CreateTable V[customers] group count 

// create SQL parameters
Set V[table] "KNA1"
Set V[fields] "UPPER( SUBSTRING( name1|1|2 ) ) as group,count(*)"
Set V[groupby] "UPPER( SUBSTRING( name1|1|2 ) )"

// execute database select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.groupby="groupby" _
  import.values="customers"

Sort V[customers] columns="group"

// display result
Table (1,1) (8,28) name="customers" fixedColumns=2
Column "Customer Group" size=14 name="group" -readOnly
Column "Count" size=10 name="count"  -alignRight -readOnly
Subqueries You can use SQL subqueries in the condition clause. Example:

 
GuiXT
// result table
CreateTable V[customers] account name city

// create SQL parameters
Set V[table] "KNA1"
Set V[fields] "kunnr,name1,ort01"
Set V[condition] "exists ( select 1 from vbak where kunnr = kna1~kunnr 
                and audat = '&V[today_ymd]' and vbak~auart = 'SO') "

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="customers"

// display result
Table (1,1) (10,72) name="customers" fixedColumns=4 _
  title="Customers with Urgent Orders Today"
Column "Customer" size=10 name="account" -readOnly
Column "Name" size=30 name="name" -readOnly
Column "City" size=20 name="city" -readOnly
Column "Orders " size=6 -pushButton label="@EY@" _
                process="show_rush_orders.txt"


Another example:

 
GuiXT
// result table
CreateTable V[customers] account name city

// create SQL parameters
Set V[table] "KNA1"
Set V[fields] "kunnr,name1,ort01"
Set V[condition] "1 < ( select count(*) from vbak where 
                vbak~kunnr = kna1~kunnr  and vbak~audat EQ '&V[today_ymd]' 
                and vbak~vbtyp = 'C') "

// execute database Select
Call "/guixt/dbselect" -currentUser _
  export.table="table" _
  export.fields="fields" _
  export.condition="condition" _
  import.values="customers"

// display result
Table (1,1) (6,72) name="customers" fixedColumns=4 _
  title="Customers with more than one order today"
Column "Customer" size=10 name="account" -readOnly
Column "Name" size=30 name="name" -readOnly
Column "City" size=20 name="city" -readOnly
Column "Orders " size=6 -pushButton label="@EY@" _
                process="show_recent_orders.txt"