如下代码将会输出一个P_U的字段
PARAMETERS p_u TYPE string VISIBLE LENGTH 12 MEMORY ID m1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_U'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
如果我们给这个字段设置一个默认值,参考如下代码,这时将会输出什么呢?
DATA: lv_xs TYPE xstring.
PARAMETERS p_u TYPE string VISIBLE LENGTH 12 MEMORY ID m1.
INITIALIZATION.
lv_xs = '0000'.
p_u = cl_bcs_convert=>xstring_to_string( iv_cp = '4103' iv_xstr = lv_xs ).
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_U'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
会发现输入框消失了
此时将代码修改到上一个版本,并在AT SELECTION-SCREEN OUTPUT下清除该值,仍然没有输入框
DATA: lv_xs TYPE xstring.
PARAMETERS p_u TYPE string VISIBLE LENGTH 12 MEMORY ID m1.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_U'.
screen-invisible = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
CLEAR: p_u.
START-OF-SELECTION.
WRITE:/ p_u.
SAPKB74024 SAP Basis Component