最近一个同事有一个比较变态的用户需求,他希望每次回到选择屏幕时,选择参数是有程序控制输入的,用户客户端的输入清除。对此需求有两种处理方法: 一、在AT SELECTION-SCREEN中写赋值语句,这种方法你可能需要中间变量缓存选择条件用于查询,代码样例: REPORT demo_write_statement. tables vbak. DATA: NAME(20) VALUE 'SOURCE', SOURCE(10) VALUE 'abcd', TARGET(10). select-options k_kunnr for vbak-kunnr.
data: is_parent type i value 0.
INITIALIZATION. × refresh k_kunnr. AT SELECTION-SCREEN. refresh k_kunnr. MOVE: 'I' TO k_kunnr-SIGN, 'EQ' TO k_kunnr-OPTION, '9999' TO k_kunnr-LOW. APPEND k_kunnr. *SYSTEM-CALL INITIALIZATION. 二、在Initialization事件中写赋值代码 在Initialization事件中写赋值代码,默认情况只有第一次会影响输入屏幕,以后将失去作用。为了使该代码起作用你必须在选择屏幕的其他事件中执行SYSTEM-CALL INITIALIZATION.这个语句。代码样例: REPORT demo_write_statement. tables: spfli. DATA: tab_spfli TYPE TABLE OF spfli, tab_sflight TYPE SORTED TABLE OF sflight WITH UNIQUE KEY table_line, wa LIKE LINE OF tab_sflight. select-options s_CARRID for spfli-CARRID. INITIALIZATION. refresh s_CARRID. MOVE: 'I' TO s_CARRID-SIGN, 'EQ' TO s_CARRID-OPTION, 'AZ' TO s_CARRID-LOW. APPEND k_kunnr.
AT SELECTION-SCREEN. start-of-SELECTION. SELECT carrid connid INTO CORRESPONDING FIELDS OF TABLE tab_spfli FROM spfli WHERE CARRID in s_CARRID . SYSTEM-CALL INITIALIZATION. SELECT carrid connid fldate INTO CORRESPONDING FIELDS OF TABLE tab_sflight FROM sflight FOR ALL ENTRIES IN tab_spfli WHERE carrid = tab_spfli-carrid AND connid = tab_spfli-connid. LOOP AT tab_sflight INTO wa.
AT NEW connid. WRITE: / wa-carrid, wa-connid. ENDAT. WRITE: / wa-fldate. ENDLOOP.
相关连接:http://blog.csdn.net/CompassButton/archive/2006/08/18/1091626.aspx
|