Purpose Reading SAP searchhelp values for populating dropdown lists
Solution We use the function module /guixt/read_searchhelp_values and the Open Call
Interface.
Example The user selects the sales unit, order reason, customer price group and sales office via dropdown lists:
For each field, the value list can be read from the respective SAP search help:
The name of the searchhelp can be found in the SAP data dictionary (transaction SE11):
You can test the searchhelp in SE11:
We read these values via the function "/guixt/read_searchhelp_values":
GuiXT
Set V[searchhelp] "H_TVAU"
CreateTable V[dropdowntable] value text
Call "/guixt/read_searchhelp_values" cache="session" _
export.searchHelp="searchhelp" _
import.values="dropdowntable"
To facilitate reuse of the dropdown lists in other screens while keeping the scripts simple, we implement a separate "process" script for each dropdown list:
GuiXT Script
GuiXT
// get dropdown value lists
process read_dropdown_vrkme V[dropdown_vrkme]
process read_dropdown_augru V[dropdown_augru]
process read_dropdown_konda V[dropdown_konda]
process read_dropdown_vkbur V[dropdown_vkbur] "1710" "10" "00"
// Sales unit
Text (16,45) "Sales unit" size=20 -label
DropDownList (16,66) table=V[dropdown_vrkme] refer="V[vrkme]" width=40 -showKeys
// Order reason
Text (17,45) "Order reason" size=20 -label
DropDownList (17,66) table=V[dropdown_augru] refer="V[augru]" width=40
// Price group
Text (18,45) "Customer price group" size=20 -label
DropDownList (18,66) table=V[dropdown_konda] refer="V[konda]" width=40
// Sales office
Text (19,45) "Sales office" size=20 -label
DropDownList (19,66) table=V[dropdown_vkbur] refer="V[vkbur]" width=40
InputScript "process_read_dropdown_vrkme.txt"
GuiXT
// read searchhelp for sales unit
Parameter dropdowntable
Set V[searchhelp] "H_T006"
Set V[columns] "msehi,msehl"
CreateTable V[dropdowntable] value text
Call "/guixt/read_searchhelp_values" cache="session" _
export.searchHelp="searchhelp" _
export.columns="columns" _
import.values="dropdowntable"
Return
InputScript "process_read_dropdown_augru.txt"
GuiXT
// read searchhelp for order reason
Parameter dropdowntable
Set V[searchhelp] "H_TVAU"
CreateTable V[dropdowntable] value text
Call "/guixt/read_searchhelp_values" cache="session" _
export.searchHelp="searchhelp" _
import.values="dropdowntable"
Return
InputScript "process_read_dropdown_vkonda.txt"
GuiXT
// read searchhelp for customer price group
Parameter dropdowntable
Set V[searchhelp] "H_T188"
CreateTable V[dropdowntable] value text
Call "/guixt/read_searchhelp_values" cache="session" _
export.searchHelp="searchhelp" _
import.values="dropdowntable"
Return
InputScript "process_read_dropdown_vkbur.txt"
GuiXT
// read searchhelp for sales office
Parameter dropdowntable
Parameter vkorg
Parameter vtweg
Parameter spart
Set V[searchhelp] "H_TVKBZ"
Set V[columns] "vkbur,bezei"
// add selections
CreateStructure V[seloptrow] shlpfield sign option low high
CreateTable V[selopt] include=V[seloptrow]
if V[vkorg]
Set V[seloptrow.shlpfield] "VKORG"
Set V[seloptrow.sign] "I"
Set V[seloptrow.option] "EQ"
Set V[seloptrow.low] "&V[vkorg]"
AppendRow V[seloptrow] table=V[selopt]
endif
if V[vtweg]
Set V[seloptrow.shlpfield] "VTWEG"
Set V[seloptrow.sign] "I"
Set V[seloptrow.option] "EQ"
Set V[seloptrow.low] "&V[vtweg]"
AppendRow V[seloptrow] table=V[selopt]
endif
if V[spart]
Set V[seloptrow.shlpfield] "SPART"
Set V[seloptrow.sign] "I"
Set V[seloptrow.option] "EQ"
Set V[seloptrow.low] "&V[spart]"
AppendRow V[seloptrow] table=V[selopt]
endif
CreateTable V[dropdowntable] value text
Call "/guixt/read_searchhelp_values" cache="session" _
export.searchHelp="searchhelp" _
export.columns="columns" _
export.selopt="selopt" _
import.values="dropdowntable"
Return