ABAP SCREEN/选择屏幕/RADIO BUTTON

2023-10-13 18:58:39 浏览数 (2)

目的:针对radio button 选择的不同,显示和隐藏条件字段

1、ZTEST_S中:

代码语言:javascript复制
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME  TITLE TEXT-001 .
SELECT-OPTIONS:
  s_bukrs FOR pa0001-bukrs MODIF ID m1,
  s_pernr FOR pa0001-pernr MODIF ID m1,
  s_ename FOR pa0001-ename MODIF ID m1.

PARAMETERS: p_file LIKE rlgrap-filename MODIF ID m2.
SELECTION-SCREEN END OF BLOCK b1.


SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME  TITLE TEXT-002.
PARAMETERS: rb1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND u1,
            rb2 RADIOBUTTON GROUP g1,
            rb3 RADIOBUTTON GROUP g1
            .
SELECTION-SCREEN END OF BLOCK b2.

2、在 AT SELECTION-SCREEN OUTPUT 中,创建form,如下        "PERFORM frm_screen"

代码语言:javascript复制
FORM frm_screen .

  LOOP AT SCREEN.
    IF rb2 EQ 'X'.
      IF screen-group1 EQ 'M1'.
        screen-active = '0'.  "隐藏
      ELSE.
        screen-active = '1'.  "显示
      ENDIF.

    ELSEIF rb1 EQ 'X' OR rb3 EQ 'X'.
      IF screen-group1 EQ 'M2'.
        screen-active = '0'.
      ELSE.
        screen-active = '1'.
      ENDIF.
    ENDIF.

    MODIFY SCREEN.
  ENDLOOP.
ENDFORM.

0 人点赞