2

我有一些单选按钮,当我在它们之间进行更改时,一些块会出现/消失。

但是,如果我将参数设置为强制性或必需的,除非我填写它们,否则它们不会隐藏。我想让参数成为必需的,但是当我更改单选按钮选项时我需要隐藏它们。

4

2 回答 2

4

估计是选择画面...

  • 然后在您的屏幕上循环并检查“YOUR_RADIO_BUTTON”的值
  • 启用或禁用块

    AT SELECTION-SCREEN OUTPUT.
    
      LOOP AT SCREEN.
    * Radio button parameter = P_RADIO
    *   hide the parameter named "to_hide" 
        IF P_RADIO EQ 'X' AND SCREEN-NAME CS 'TO_HIDE'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
    
    *   display the parameter named "to_hide"
        IF P_RADIO <> 'X' AND SCREEN-NAME CS 'TO_HIDE'.
          SCREEN-INPUT = 1.
          MODIFY SCREEN.
        ENDIF.
    
      ENDLOOP.
    
于 2012-12-07T23:15:41.653 回答
2

If you use PARAMETERS ... OBLIGATORY, this is an unconditional statement - this parameter is required regardless of the other settings. If you need a conditional check, you have to code it for yourself:

PARAMETERS p_chkbuk AS CHECKBOX.
PARAMETERS p_bukrs  TYPE bukrs.

AT SELECTION-SCREEN ON p_bukrs. 
  IF p_chkbuk = abap_true AND p_bukrs IS INITIAL. 
    MESSAGE 'You need to enter something.' TYPE 'I' DISPLAY LIKE 'E'.
  ENDIF.
于 2012-12-09T16:10:12.877 回答