凡尘clsoho™的博客

E-mail & MSN: clsoho@hotmail.com
QQ1超级群: <101817641已满> QQ2群:<110722895已满>
QQ3超级群:<23765855>QQ4超级群:<85338969>

AT SELECTION-SCREEN - selscreen_event

Syntax 语法

... { OUTPUT }
  | { ON {para|selcrit} }
  | { ON END OF selcrit }
  | { ON BLOCK block }
  | { ON RADIOBUTTON GROUP radi }
  | { }
  | { ON {HELP-REQUEST|VALUE-REQUEST}
  |   FOR {para|selcrit-low|selcrit-high} }
  | { ON EXIT-COMMAND }.

Alternatives: 供选择的

1. ... OUTPUT

2. ... ON {para|selcrit}

3. ... ON END OF selcrit

4. ... ON BLOCK block

5. ... ON RADIOBUTTON GROUP radi

6. ... { }

7. ... { ON {HELP-REQUEST|VALUE-REQUEST} FOR

      {para|selcrit-low|selcrit-high} }


8. ... ON EXIT-COMMAND

Effect 作用

These additions allow individual evaluation of specific elements of the selection screens of the program. The information as to which selection has triggered the event is contained in the system field sy-dynnr.

这些条件允许为程序的选择屏幕的指定的元素进行单个求值。哪个选择屏幕触发了这个事件的信息被系统字段sy-dynnr 包含。

Alternative 1 选项1

... OUTPUT



Effect 作用

This event is triggered at the screen event PBO of a selection screen. In the event block, the selection screen can be prepared through assignments to the data objects of parameters and selection criteria and through dynamic screen modifications.

这个事件在一个选择屏幕的屏幕事件PBO中被触发。在事件块中,选择屏幕可以通过分配给参数的数据对象和标准选择和通过动态屏幕修改来准备输出屏幕。

Note

The assignments to input fields in the event block AT SELECTION-SCREEN OUTPUT always affect the selection screen and overwrite the user inputs from previous displays of the same selection screen. Assignments in the event blocks LOAD-OF-PROGRAM oder INITIALIZATION, on the other hand, only have an effect at first program start.

在事件块AT SELECTION-SCREEN OUTPUT 中给输入字段分配值经常会影响到选择屏幕并且重写从之前相同的选择屏幕显示的用户输入。然而,在事件块LOAD-OF-PROGRAM或者INITIALIZATION的分配值只对程序起初启动时有影响。

Alternative 2 选项2

... ON {para|selcrit}
(逐行数据进行检查)


Effect 作用

This event is triggered at the screen event PAI of a selection screen if the content of the input field of a parameter para or a line of a selection criterion selcrit was passed to the ABAP program. In the event block, the user input can be checked. Sending a warning or an error message in the event block makes the fields para and selcrit ready for input again.

No parameter that is defined as a radio button can be specified. For this purpose, the addition ON RADIOBUTTON GROUP is provided.

如果一个参数para的输入字段或者一个标准选择屏幕selcrit的一行被传送到ABAP程序中,这个事件在选择屏幕的屏幕事件PAI中被触发 。在事件块中,用户输入可以被检查。在事件块中发出一个警告或者错误信息使字段para或者selcrit再一次做好输入准备。不能指定被定义成单选按钮的参数。为了这个目的,需要提供ON RADIOBUTTON GROUP选项。

Note

If a user action takes place in the dialog box for the multiple selection of a selection criterion selcrit, the entries of the selection table are passed to the program, line by line. For each line, the event AT SELECTION-SCREEN ON selcrit is triggered.

如果一个用户行为发生在标准选择屏幕selcrit的多重选择对话框中,选择表的记录被逐行地传送到程序中。对每一行,事件AT SELECTION-SCREEN ON selcrit被触发一次。

Alternative 3 选项3

... ON END OF selcrit
(全部数据进行检查)即输入完毕后进行检查


Effect 作用

This event is triggered after the selection table selcrit has been fully passed to the program after a user action in the dialog box for the multiple selection has taken place. In the event block, the entire selection table can be checked.

这个事件在一个用户行为发生在多重选择对话框中后在选择表selcrit已经被完全传送到程序之后被触发。在事件块中,整个选择表可以被检查。

Alternative 4 选项4

... ON BLOCK block



Effect 作用

This event is triggered at the screen event PAI of a selection screen if all the input fields of a block block of the selection screen were passed to the ABAP program. In the event block, the user inputs can be checked. Sending a warning or an error message in the event block makes all the fields of the block block ready for input again.

当选择屏幕的一个模块block的所有输入字段都被传送到ABAP程序中后这个事件在选择屏幕的屏幕事件PAI中被触发。在事件块中,可以检查用户输入。在事件块中发送一个警告或者错误信息使block块的所有字段再一次为输入做好准备。

Alternative 5 选项5

... ON RADIOBUTTON GROUP radi



Effect 作用

This event is triggered at the screen event PAI of a selection screen if all the fields of a radio button group radi of the selection screen were passed to the ABAP program. In the event block, the user input can be checked. Sending a warning or error message in the event block makes all the radion buttons of the block radi ready for input again.

如果选择屏幕的一个单选按钮组radi的所有字段都被传送到ABAP程序中,这个事件在一个选择屏幕的屏幕事件PAI中被触发。在这个事件块中,可以进行用户输入检查。在事件块发出一个警告或者错误信息使模块radi的所有单选按钮再一次为输入做好准备。

Note

The individual fields of a radio button group are not passed individually and do not trigger the event AT SELECTION-SCREEN ON par.

 一个单选按钮组的字段不会被单独地传送并且不会触发事件AT SELECTION-SCREEN ON par.

Alternative 6 选项6

... { }



Effect 作用

The event AT SELECTION-SCREEN itself is triggered as the last event of selection screen processing if all the input values were passed to the program. In this event block, all the user inputs can be checked. Sending a warning or an error message in the event block makes all the screen fields ready for input once again.

事件AT SELECTION-SCREEN 本身在选择屏幕处理的最后模块被触发如果所有的输入值被传送到ABAP程序中。在这个事件块中,所有的用户输入都可以被检查。在事件块中发出一个警告或者错误使所有的屏幕字段再一次做好输入准备。

Alternative 7 选项7

... { ON { HELP-REQUEST | VALUE-REQUEST } FOR
    {para|selcrit-low|selcrit-high} }


Effect 作用

The two events ON HELP-REQUEST and ON VALUE-REQUEST are triggered at the screen events POH and POV of a selection screen if - for the input field of a parameter para or one of the input fields of a selection criterion selcrit - the field help F1 or the input help F4 was called. Other selection events are not triggered.

这两个事件ON HELP-REQUEST ON VALUE-REQUEST 在一个选择屏幕的屏幕事件POHPOV中被触发如果――对于参数para的输入字段或者标准选择屏幕selcrit的其中一个输入字段――帮助字段F1者输入帮助F4被调用。

In the event blocks, a self-defined field or input field can be programmed, which overrides any helps possibly defined in the ABAP Dictionary.

在这些事件块中,可以编写一个自定义的字段或者输入字段,它们可以重写任何可能在ABAP字典中定义的帮助信息。

Notes

  • These event blocks can only be implemented for fields of the selection screen that are defined in the same ABAP program and not in a possibly linked logical database.

这些事件块只能被选择屏幕在相同的ABAP程序中定义的并且不在一个可能关联的逻辑数据库中的字段执行。

  • With the events for the field and input help, no data is transported between the selection screen and the ABAP program. As with general screens, suitable function modules must be used for these. The parameters and selection criteria changed for the input help are transported to the selection screen.

对于字段和输入帮助的事件,在选择屏幕和ABAP程序之间不会传送数据。对于常规的屏幕,必须为它们使用合适的函数块。为输入帮助改变的屏幕参数和标准选择被传送到选择屏幕。

Alternative 8 选项8

... ON EXIT-COMMAND



Effect 作用

This event is triggered if the user has called one of the functions Back, Exit or Cancel. In the event block, possible clean-up actions can be executed.

如果用户调用了函数Back, Exit 或者 Cancel中的一个这个事件被触发。在这个事件块中,将会执行可能的清理操作。

Example 例子

In these executable programs, a standard selection screen and a further selection screen are defined. In the event blocks AT SELECTION-SCREEN, the inputs in the selection screens can be specially handled using the name p_carrid and the screen number in sy-dynnr.

在这些可执行程序中,一个标准选择屏幕和一个深一层的选择屏幕被定义。在事件块AT SELECTION-SCREEN中,选择屏幕上的输入可以被指定使用名字P_CARRID并且屏幕号码在sy-dynnr中。

REPORT demo_at_selection_screen.

* Global data

DATA: sflight_tab TYPE TABLE OF sflight,
      sflight_wa  LIKE LINE  OF sflight_tab.

* Selection screens

PARAMETERS p_carrid TYPE spfli-carrid.

SELECTION-SCREEN BEGIN OF SCREEN 500.
  SELECT-OPTIONS s_conn FOR sflight_wa-connid.
  DATA s_conn_wa LIKE LINE OF s_conn.
SELECTION-SCREEN END OF SCREEN 500.

* Handling selection screen events

AT SELECTION-SCREEN ON p_carrid.
  IF p_carrid IS INITIAL.
    MESSAGE 'Please enter a value' TYPE 'E'.
  ENDIF.
  AUTHORITY-CHECK OBJECT 'S_CARRID'
                      ID 'CARRID' FIELD p_carrid
                      ID 'ACTVT'  FIELD '03'.
  IF sy-subrc = 4.
    MESSAGE 'No authorization for carrier' TYPE 'E'.
  ELSEIF sy-subrc <> 0.
    MESSAGE 'Error in authority check' TYPE 'A'.
  ELSE.
    IF sy-ucomm = 'ONLI'.
      CALL SELECTION-SCREEN '0500'.
    ENDIF.
  ENDIF.

AT SELECTION-SCREEN.
  IF sy-dynnr = '0500'.
    IF s_conn IS INITIAL.
      MESSAGE 'Please enter values' TYPE 'W'.
    ELSE.
      SELECT *
             FROM sflight
             INTO TABLE sflight_tab
             WHERE carrid = p_carrid AND
                   connid IN s_conn.
      IF sy-subrc <> 0.
        MESSAGE 'No flights found' TYPE 'E'.
      ENDIF.
    ENDIF.
  ENDIF.

* Main program

START-OF-SELECTION.
  ...

posted on 2010-02-03 08:45  凡尘clsoho  阅读(1729)  评论(0编辑  收藏  举报