在单选按钮组上的选择屏幕输出 VS

at selection-screen output VS on radiobutton group

我正在写一份报告,其中有两个单选按钮 'tab'。根据它们的值,我必须将一些屏幕字段设置为不显示,否则,正确显示它们。

我可以通过使用事件 at selection-screen output. 让它完美地工作,但是当使用 at selection-screen on radiobutton group tab 时它拒绝工作 - 测试一个,我注释掉另一个。

两者的代码完全相同,所以有人可以帮助我理解这两个事件的区别,以便我了解为什么只有一个有效吗?

下面的事件,只有第二个有效。

at selection-screen on radiobutton group tab.
  go_controller->modify_screen( ).


at selection-screen output.
  go_controller->modify_screen( ).

他们都调用相同的方法

  method modify_screen.

    loop at screen.

      case  screen-group1.

        when 'TAB'.

          if use_otab = abap_false.
            screen-invisible = 1.
            screen-active    = 0.
            screen-input     = 0.
            p_int            = abap_false.
            p_nat            = abap_false.
            free               p_table[].

          else.
            screen-active    = 1.
            screen-invisible = 0.
            screen-input     = 1.

          endif.

          modify screen.

      endcase.

    endloop.

  endmethod.

通过调试,我看到两个事件都正确到达,但是,只有第二个有效。

因为它是这样设计的:AT SELECTION-SCREEN ON...是一个"process after input"(PAI)事件。 PAI 旨在对用户操作做出反应。 PAI结束时,确定下一个dynpro(即使可能和实际的一样),然后处理dynpro的"process before output"(PBO)。这是为用户准备的屏幕元素。只有在 PBO 中,SCREEN table 的修改对屏幕元素的可见性或可编辑性有影响。

因此,在报告中您应该使用 at selection-screen output. 来影响参数和 select 选项的可见性或可编辑性。