Purpose
You want to add a label in front of a drop down list
Solution
Use Text with option -label

If there are further elements in the same row at the right hand side of the drop down list you need to "stop" the underlining by a further Text command, see example 2 below. 


Example 1

GuiXT

Text (5,100) "Division" size=10 -label
DropDownList (5,111) "mydivisions" width=30 refer="V[division]"



Example 2

GuiXT
Text (5,100) "Division" size=10 -label
DropDownList (5,111) "mydivisions" width=30 refer="V[division]"

InputField (5,150) "Customer" (5,160) size=10 name="kunnr"


Here the underlining is  extended to the next text element "Customer". The reason is that the drop down list drawn by GuiXT is not taken into account by SAP GUI when joining the label with the next screen element.

You can avoid this effect by adding a further text element at the same position as the drop down list. This text remains invisible since it is covered by the drop down list:

GuiXT
Text (5,100) "Division" size=10 -label
DropDownList (5,111) "mydivisions" width=30 refer="V[division]"

// add an invisible text element to stop underlining
Text (5,111) "_"

InputField (5,150) "Customer" (5,160) size=10 name="kunnr"

 

Components
InputAssistant