如何在sap的screen中使用ListBox
来源:互联网 发布:拳皇98um出招优化 编辑:程序博客网 时间:2024/05/22 08:04
1、拖入一个编辑控件到屏幕,设置“下拉”属性为“ListBox”
2、设置Function-CODE,
3、listbox的列表的取值有三种方法:
A)默认取Dictionary;
B)使用“VRM_SET_VALUES"函数在PBO中设置 ,代码见后面代码
C)使用Process On Value-request事件和“F4IF_INT_Table_Value_request”函数设置输入帮助
其中C优于B,B优于A
代码示例:(参见SAP的样例程序,rsdemo_dropdown_list)
*屏幕事件
process before output.
module status_0100.
module fill_carrid.
*
process after input.
module event_from_listbox.
module exit at exit-command.
process on value-request.
field sflight-carrid module set_data_carrid.
*程序
report rsdemo_dropdown_listbox .
data init.
tables scarr.
tables spfli.
tables sflight.
tables sbook.
data save_ok like sy-ucomm.
data ok_code like sy-ucomm.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0100 output.
if init is initial.
set pf-status 'GRUND'.
set titlebar '100'.
* preset of listboxes
spfli-carrid = 'LH'.
sflight-carrid = 'LH'.
sbook-carrid = 'LH'.
endif.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module SET_DATA_CARRID INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module set_data_carrid input.
types: begin of type_carrid,
carrid like spfli-carrid,
carrname like scarr-carrname,
end of type_carrid.
data itab_carrid type standard table of type_carrid with header line.
select carrid carrname
from scarr
into corresponding fields of table itab_carrid.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'CARRID'
value_org = 'S'
tables
value_tab = itab_carrid
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endmodule. " SET_DATA_CARRID INPUT
*&---------------------------------------------------------------------*
*& Module FILL_CARRID OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module fill_carrid output.
* Do not use this process (but it works)
type-pools vrm.
data values type vrm_values with header line.
if init is initial.
select * from scarr.
values-text = scarr-carrname.
values-key = scarr-carrid.
append values.
endselect.
call function 'VRM_SET_VALUES'
exporting
id = 'SBOOK-CARRID'
values = values[]
exceptions
id_illegal_name = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endif.
scarr-carrid = 'LH'.
init = 'X'.
endmodule. " FILL_CARRID OUTPUT
*&---------------------------------------------------------------------*
*& Module EVENT_FROM_LISTBOX INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module event_from_listbox input.
save_ok = ok_code.
clear ok_code.
case save_ok.
when 'LISTBOX_2'.
message i300(eu) with save_ok.
when 'LISTBOX_3'.
message i300(eu) with save_ok.
endcase.
endmodule. " EVENT_FROM_LISTBOX INPUT
*&---------------------------------------------------------------------*
*& Module EXIT INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module exit input.
leave program.
endmodule. " EXIT INPUT
- 如何在sap的screen中使用ListBox
- 如何在sap的screen中使用ListBox
- 如何在sap的screen中使用ListBox
- 如何在SAP的Screen中编写List报表
- 如何在SAP的Screen中编写List报表
- 如何在SAP的Screen中编写List报表
- 如何在SAP的Screen中编写List报表
- 在 selection-screen 中添加 listbox
- 在c#中如何使用ListBox
- 如何在Netbeans 6.0 中设置工程的splash screen
- 如何在screen中加入select-options screen
- 如何在screen中加入select-options screen
- 如何在screen中加入select-options screen
- SAP WEB GUI的实现,SAP在网页中使用
- 如何在ListBox中选择背景位图
- SCREEN中LISTBOX 选择事件响应
- 如何在Excel中使用VB宏连接SAP系统
- SAP HANA如何在存储过程中使用自定义的table type
- ASP.NET 开发人员应当始终坚持的做法
- 生活如此......
- 非常有用之 Unix/Linux 单行脚本
- 英语学习
- ANT涉猎(一)
- 如何在sap的screen中使用ListBox
- 设置Windows server 2003 ,达到安全级别
- ASP.NET程序中常用的三十三种代码
- 剖析:Composite UI Application Block(前言)
- 搞了2天,终于对log4j算是有点了解了。
- 什么是Web Service?
- java中的递归
- 我会像对待女朋友那样去呵护我的代码,却不会像写代码那样去对待我的女朋友。。。
- 向Word中插入图片,C#编写的生成缩略图程序