Purpose |
The function module
/guixt/select
offers you a comfortable way to read the SAP database in a GuiXT script. You execute the function with the Call statement. Both single and multiple records can be returned by the function. Prerequisites:
Please note: There is a newer function /guixt/dbselect which allows you to specify an arbitrary number of returned columns. For large result sets this function is faster than /guixt/select. |
Import of the function module |
If you prefer to create the function module directly in transaction SE37 without using the SAP transport system you can use the file source code /guixt/select. |
Authorizations |
You can either execute the
Call with the RFC user specified in the GuiXT profile or with the user
that is currently logged on (option -currentUser
in Call command with ). Following authorizations are needed:
Function group authorization
for /GUIXT/DB01: Here XXXX is the SAP authorization group of the table that you want to read (internally stored in table TDDAT). Note: The table display
authorization S_TABU_DIS is checked in the same way in the SAP transactions
SE16 and SM30 and in the standard function module RFC_READ_TABLE. |
Parameters |
Following parameters are
available:
|
in.table= |
Table or table view to be
read. Example: ... in.table="T001"
In addition to normal tables
you may use the search help views M_..., e.g. M_MAT11 and views that
join several tables. For example, the view "VBAKUK"
for a customer order returns both general information from table VBAK
and status information from table VBUK. |
in.Condition= |
Search condition in the format
of the ABAP "Select" command. Example: ... in.Condition="BUKRS = '1000' ". Note that ABAP strings are enclosed with inverted commas.
As usual the content of a
script variable is addressed by &V[varname]: If you want to compare one column with the value in another column, use the notation table~column, e.g.: ... in.Condition="PARVW = 'RE' AND KUNNR <> KNVP~KUNN2" For further details see the ABAP "Select" documentation. A search condition is always required, specified either with in.Condition= or with table.Conditiontable=. The
in.Condition=
parameter is restricted to a total length of 4000 bytes. If you need to
pass many keys, e.g. 1000 customer numbers, use the
table.Conditiontable=
parameter which allows any number of lines, each with a
maximum length of 4000 bytes. |
in.Fields= |
Optionally a list of field
names, separated by commas. Only the given fields are read from the
database. Example: ... in.Fields="KUNNR,NAME1,NAME2,ORT01,STRAS,PSTLZ,LAND1". If you use the parameters out.V1= out.V2= ... or out.V1Table= out.V2Table= ... a field list is required; the given fields are read and put into the specified variables. In case of "work area mode", i.e. out.Result= or table.Resulttable= the whole table row record is returned, but only the fields given in the field list are actually filled. |
in.Orderby= |
Optionally a list of field
names, separated by comma. The result table is ordered ascending by the
given fields. Example: ... in.Orderby="ORT01,NAME1".
After each field name you may
specifiy "DESCENDING" for descending ordering. Example: |
in.Distinct= | With "X" the DISTINCT clause of the Select command is used |
out.Found= | Returns "X" if at least one record returned, "" otherwise. |
out.Reccount= | Returned record count |
out.Result= |
The first row returned is put
into the given variable, or "" in case of empty result table. If
in.Fields
is specified, only the given fields are filled. Example: GuiXT
|
out.V1= out.V2= ... out.V10= |
In conjunction with
in.Fields.
The fields given in the field list are put into the corresponding
variables. Example: GuiXT
|
table.Resulttable= |
Returns all table rows that
fulfil the search condition. If
in.Fields
is specified, only the given fields will be filled. Example: We read all customers with city "HEIDELBERG": GuiXT
|
table.V1table= table.V2table= ... table.V10table= |
In conjunction with
in.Fields.
The fields given in the field list are put into the corresponding long
text variables, one line for each returned row. Example: We read all customers with city "HEIDELBERG": GuiXT
|
table.Conditiontable= |
Search condition in ABAP
"Select" format. In contrast to
in.Condition=
you pass a
long text variable that can contain any number of lines. Example: We assume that a long text variable "kns" contains a list of account numbers. We want to use the account numbers in order to build up the search condition, using an "OR" clause for each account number: GuiXT
|
Components | GuiXT + InputAssistant |