1.
在選擇螢幕輸出時呼叫
function module 『vrm_set_values』
。這種方法的好處就是,可以在程式中自定義
listbox
中的內容
原始碼如下:
report z_hxg_006 .
* 需要呼叫的型別池
type-pools: vrm.
data: name type vrm_id,
list type vrm_values,
value like line of list.
data: ps_t(10) type c.
*選擇螢幕定義
parameters: ps_parm(10) as listbox visible length 10,
ps(10) as listbox visible length 10. *
選擇螢幕輸出控制
at selection-screen output.
refresh list.
clear list.
name = 'ps'.
value-ke(r)y = '1'.
value-text = 'line 1'.
value-key = '2'.
value-text = 'line 2'.
call function 'vrm_set_values'
exporting id= name
values = list.
*start-of-selection
事件觸發
start-of-selection.
case ps.
when '1'.
ps_t = 'line 1'.
when '2'.
ps_t = 'line 2'.
endcase.
write: / 'parameter:', ps_t. 2.
直接在資料字典中定義域(將該域的
value range
填充相應的值),然後通過資料表中的字段和這個域關聯即可。
report z_hxg_042 .
tables: zsale_plan.「
自定義的表
*下面的
zsale_plan-zmonth
是和sap
系統自帶的域
month
相關聯的,即這個欄位的字段類*型為
month
parameters: zmonth like zsale_plan-zmonth as listbox
visible length 10.
3.通過自定義螢幕來實現
listbox
1) 首先我們自己建立乙個螢幕
call screen 100.
雙擊上面這段**,進入到螢幕設計
gui之後,在介面上增加文字輸入框,給它取名為
sjudge
(這個名字可以隨便你自己取,只要在程式編寫的時候保持一致就可以了
),同時在屬性框的「下拉「中選中
listbox
即可,
2) 做完上面一步後,我們需要在該螢幕的邏輯流中這樣設計
process before output.
* module status_0100.
process after input.
* module user_command_0100.
* 這裡就是給螢幕字段
sjudge
建立乙個功能模組
module create_dropdown_list
process on value-request.
field
sjudge
module create_dropdown_list.
3)雙擊
moule create_dropdown_list
,我們建立這個
module
在程式中的**,這裡需要呼叫乙個系統的功能模組
f4if_int_table_value_request
主程式**如下:
report z_hxg_040.
data: ok_code type sy-ucomm.
data: begin of itab occurs 0,
carrname like scarr-carrname,
end of itab.
call screen 100.
*module create_dropdown_list_input
module create_dropdown_list input.
refresh itab.
clear itab.
itab-carrname = '
合格'.
itab-carrname = '
不合格'.
call function 'f4if_int_table_value_request'
exporting
retfield = 'carrname'
value_org = 's'
tables
value_tab = itab
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc <> 0.
endif.
endmodule.
直接執行這段**就可以看到結果。
wpf 中ListBox的用法
listbox可以用來顯示類似web中新聞列表的樣式,顯示也比較靈活,可以自定定義模板 datatemplate x key listboxtemplate stackpanel margin 4 dockpanel grid grid.rowdefinitions rowdefinition ro...
WPF中ListBox的繫結
wpf中列表式控制項派生自itemscontrol類,繼承了itemssource屬性。itemssource屬性可以接收乙個ienumerable介面派生類的例項作為自己的值 所有可被迭代遍歷的集合都實現了這個介面,如陣列 list等 每乙個 itemscontrol的派生類都有自己的條目容器,如...
MFC中ListBox實現商品的入庫和出庫
在開發例項中,經常會用到商品的入庫和出庫功能 下面讓我們來完成這簡單功能的實現 首先,我們為listbox設定selection屬性為extended 該屬性可以設定為用shift 滑鼠左鍵選擇多個條目。下面是介面圖形。然後並為各個空間關聯變數。入庫 按鈕的bn clicked訊息響應函式如下 借出...