format 使用一例 之 color & input

来源:互联网 发布:手机淘宝复制链接 编辑:程序博客网 时间:2024/04/30 23:28

 一 color

 

(1)       Write 添加背景色

八种颜色,分别为 0-7 可以用8个常量代替输出

WRITE: /  'col_key' COLOR col_key,
          
'col_total' COLOR col_total,
          
'col_group' COLOR col_group,
          
'col_background' COLOR COL_BACKGROUND,
          
'col_heading' COLOR col_heading,
          
'COL_NEGATIVE' COLOR COL_NEGATIVE,
          
'COL_POSITIVE' COLOR COL_POSITIVE,
          
'COL_NORMAL' COLOR COL_NORMAL
          .

 

 

0 COL_BACKGROUND Backgrounds

1 COL_HEADING Headers

2 COL_NORMAL List entries

3 COL-TOTAL Totals

4 COL_KEY Key columns

5 COL-POSITIVE Positive threshold values

6 COL_NEGATIVE Negative threshold values

7 COL_GROUP Control levels

 

 

如果在前面用 format color 颜色 on 或者 format color = 颜色 的话。

后面的输出默认则用这个颜色作为背景。

 

如果在前面用 format color off 的话

后面的输出则没有背景颜色。

 

假设前面没有定义背景颜色。但是后面的输出时 指定了颜色。则该输出使用该颜色。例如:write ‘liujincai’ color 颜色

 

假设前面定义了背景颜色。但是后面的输出时 指定了其它颜色。则该输出使用其它颜色。例如:write ‘liujincai’ color 颜色

 

假设前面定义了背景颜色。但是后面的输出时 没有指定颜色。则该输出使用前面定义的颜色。例如:write ‘liujincai’ color 颜色

 

假设前面定义了背景颜色。但是后面的输出时 关闭了颜色 。则该输出不使用颜色。例如:write ‘liujincai’ color off

 

 

二, input

 

(1)       List行的控制以及行中输入框以及 line-selection 事件的响应。

DATA: input_field(100TYPE c,
      line_num 
TYPE i.

START-
OF-SELECTION.
  
WRITE 'Input text:'.
  
SET BLANK LINES ON.
  
FORMAT INPUT.
  
WRITE / input_field.
  
FORMAT INPUT OFF.
  
WRITE:/  '>>> OK <<<' COLOR 5 HOTSPOT .

AT LINE-SELECTION.
  
case sy-lisel.
    
when    '>>> OK <<<'.
    line_num = sy-lilli - 
1.
    
READ LINE line_num FIELD VALUE input_field..
    
if sy-subrc ne 0 .  exit.   endif.
    
if input_field <> 'liujincai'.
    
WRITE:   'The input was:',
           /  input_field.
    
else.
       
modify CURRENT LINE field value input_field from ''.
    
endif.

 endcase.