Purpose Allow the user to choose a value in a table cell from a list instead of entering the value manually. |
Solution There is no "drop-down list" column attribute, but we can implement our own solution:
For the popup we use a standard SAP popup (help settings) and remove the existing elements.
Table
(1,10)
(12,90)
title="Water
consumption per plant"
name="mytable"
rows="10" We make the "Plant" column readonly and add a pushbutton column: Table
(1,10)
(12,90)
title="Water
consumption per plant"
name="mytable"
rows="10"
|
The selected plant is set into the "plant" cell and the popup is closed:
InputScript "dropdown_plant.txt" // indicate: plant selection active // Set window position for popup Set V[wndcol] 48 // clear table data (plant selection) Clear V[myplants.cell.*] "" // read plants from SAP database Call "/GUIXT/DBSELECT" cache="session" _ in.table="T001W" _ in.Fields="WERKS,NAME1,ORT01" _ in.Condition="NAME1 NE SPACE" _ in.orderBy="WERKS" _ table.Values="r" Set V[k] 1Set V[n] 1 label next_valueCopyText fromText="r" toString="myplants.cell.werks.&V[n]" line="&V[k]" if Q[ok]Set V[k] &V[k] + 1 CopyText fromText="r" toString="myplants.cell.name1.&V[n]" line="&V[k]" Set V[k] &V[k] + 1 CopyText fromText="r" toString="myplants.cell.ort01.&V[n]" line="&V[k]" Set V[k] &V[k] + 1 Set
V[n]
&V[n]
+ 1 endif // set total number of plants // Set target field name // use help settings screen
// resize popup
window WindowPosition (&V[wndrow],&V[wndcol]) // remove existing tabstrip del S[USR_VALS] -withBox // set a new title Title "Plant selection" Table (0,0) (14,64) name="myplants" rows="&V[plantcount]" fixedColumns=3 Column "Plant" -pushButton size=8 name="werks" process="select_plant.txt" Column "Name" -readOnly size=30 name="name1" Column "City" -readOnly size=30 name="ort01" On "Enter" process="leave_plant_selection.txt" On "/12" process="leave_plant_selection.txt" endif
InputScript
"select_plant.txt" // reset plant selection indicator // leave popup
InputScript
"leave_plant_selection.txt" // leave popup
Components |