InputField (1,1) "Country" (1,20) size=2 _
techName="KNA1-LAND1" name="country" -upperCase
// display country name
Clear V[country_name]
// country code specified?
if V[country]
// Clear result table (important for performance reasons)
Clear text[r]
Call /guixt/dbselect _
cache="session" _ // use cache="session" to save RFC calls
in.table="T005T" _
in.condition="LAND1 = '&V[country]' and SPRAS = '&V[_language]' " _
in.fields="LANDX" _
table.values="r"
// copy country name
CopyText fromText="r" toString="country_name" line=1
endif
Text (1,26) "&V[country_name]"
Remarks
Always clear the result variable (here: "r") before executing
the call. Otherwise the result table from the previous call - which
might be large - is imported to the function
Use cache="..." if appropriate. For many text tables
cache="session" makes sense
Syntax errors/typos in the SQL parameters If you have
any typos or syntax errors in the table name, condition or in the field
list, the SAP system generates an ABAP dump that you can examine with
transaction ST22.
Example:
We use the wrong column name "LANGU" instead of "SPRAS":
GuiXT
... in.condition="LAND1 = '&V[country]' and LANGU = '&V[_language]' "
An error popup comes up:
Display the ABAP
short dump via transaction ST22 and look at the "Error analysis" text: