Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

dynamic selection screen

Former Member
0 Kudos
193

hello Friends ,

Hw to make dynamivc selection screen , I have 2 radio button if I click on ffirst one , PO field will come and in the second radiobutton Ref field wl come and Po field wl disappear , is it possible .if Plz help me .

Thanks in advance .

Regards .

Joy .

1 ACCEPTED SOLUTION

Former Member
0 Kudos
160

This code does what you ask but with 2 fields


TABLES: vbak, ltak.
DATA:
  err_sw.
PARAMETERS: rb1 RADIOBUTTON GROUP rb1 USER-COMMAND sel DEFAULT 'X'.
PARAMETERS: rb2 RADIOBUTTON GROUP rb1.

SELECTION-SCREEN: SKIP 1.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_auart FOR vbak-auart DEFAULT 'ZRE'
NO INTERVALS MODIF ID rb1.
SELECT-OPTIONS: s_date FOR vbak-erdat MODIF ID rb1.
SELECTION-SCREEN: END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_tanum FOR ltak-tanum MODIF ID rb2.
SELECT-OPTIONS: s_bdatu FOR ltak-bdatu MODIF ID rb2.
SELECTION-SCREEN: END OF BLOCK b2.

*____________________________________________ Screen Actions
AT SELECTION-SCREEN OUTPUT.
  IF rb1 = 'X'.
    PERFORM hide_rb2_options.
  ELSE.
    PERFORM hide_rb1_options.
  ENDIF.

INITIALIZATION.

START-OF-SELECTION.
  CLEAR err_sw.
  IF rb1 = 'X'.
    IF s_auart IS INITIAL
    OR s_date IS INITIAL.
      MESSAGE i208(00) WITH 'Required field not entered'.
      err_sw = 'X'.
    ENDIF.
  ELSE.
    IF s_tanum IS INITIAL
    OR s_bdatu IS INITIAL.
      MESSAGE i208(00) WITH 'Required field not entered'.
      err_sw = 'X'.
    ENDIF.
  ENDIF.

  CHECK err_sw NE 'X'.

  WRITE:/ 'Hi!'.

*&---------------------------------------------------------------------*
*&      Form  hide_rb2_options
*&---------------------------------------------------------------------*
FORM hide_rb2_options.
  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN 'RB1'.
        screen-active = 1.
        MODIFY SCREEN.
      WHEN 'RB2'.
        screen-active = 0.
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.
ENDFORM.                    " hide_rb2_options
*&---------------------------------------------------------------------*
*&      Form  hide_rb1_options
*&---------------------------------------------------------------------*
FORM hide_rb1_options.
  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN 'RB2'.
        screen-active = 1.
        MODIFY SCREEN.
      WHEN 'RB1'.
        screen-active = 0.
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.

ENDFORM.                    " hide_rb1_options

6 REPLIES 6

Former Member
0 Kudos
161

This code does what you ask but with 2 fields


TABLES: vbak, ltak.
DATA:
  err_sw.
PARAMETERS: rb1 RADIOBUTTON GROUP rb1 USER-COMMAND sel DEFAULT 'X'.
PARAMETERS: rb2 RADIOBUTTON GROUP rb1.

SELECTION-SCREEN: SKIP 1.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_auart FOR vbak-auart DEFAULT 'ZRE'
NO INTERVALS MODIF ID rb1.
SELECT-OPTIONS: s_date FOR vbak-erdat MODIF ID rb1.
SELECTION-SCREEN: END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_tanum FOR ltak-tanum MODIF ID rb2.
SELECT-OPTIONS: s_bdatu FOR ltak-bdatu MODIF ID rb2.
SELECTION-SCREEN: END OF BLOCK b2.

*____________________________________________ Screen Actions
AT SELECTION-SCREEN OUTPUT.
  IF rb1 = 'X'.
    PERFORM hide_rb2_options.
  ELSE.
    PERFORM hide_rb1_options.
  ENDIF.

INITIALIZATION.

START-OF-SELECTION.
  CLEAR err_sw.
  IF rb1 = 'X'.
    IF s_auart IS INITIAL
    OR s_date IS INITIAL.
      MESSAGE i208(00) WITH 'Required field not entered'.
      err_sw = 'X'.
    ENDIF.
  ELSE.
    IF s_tanum IS INITIAL
    OR s_bdatu IS INITIAL.
      MESSAGE i208(00) WITH 'Required field not entered'.
      err_sw = 'X'.
    ENDIF.
  ENDIF.

  CHECK err_sw NE 'X'.

  WRITE:/ 'Hi!'.

*&---------------------------------------------------------------------*
*&      Form  hide_rb2_options
*&---------------------------------------------------------------------*
FORM hide_rb2_options.
  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN 'RB1'.
        screen-active = 1.
        MODIFY SCREEN.
      WHEN 'RB2'.
        screen-active = 0.
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.
ENDFORM.                    " hide_rb2_options
*&---------------------------------------------------------------------*
*&      Form  hide_rb1_options
*&---------------------------------------------------------------------*
FORM hide_rb1_options.
  LOOP AT SCREEN.
    CASE screen-group1.
      WHEN 'RB2'.
        screen-active = 1.
        MODIFY SCREEN.
      WHEN 'RB1'.
        screen-active = 0.
        MODIFY SCREEN.
    ENDCASE.
  ENDLOOP.

ENDFORM.                    " hide_rb1_options

Former Member
0 Kudos
160

Hi,

yes this is possible

check out the code below which is doing the same jst here checkbox in place of radio button in ur require ment

tables:

mard.

select-options: s_matnr for mard-matnr modif id xyz.

parameters : s_werks like mard-werks modif id xyz .

select-options: s_lgort for mard-lgort modif id abc.

parameters check as checkbox user-command check.

at selection-screen output.

if check eq 'X'.

loop at screen.

if screen-group1 = 'ABC'.

screen-input = 0.

screen-invisible = 1.

modify screen.

endif.

endloop.

endif.

start-of-selection.

write:s_matnr.

reward if helpful

Former Member
0 Kudos
160

0 Kudos
160

just select the screen part en set it to visible = 0 or 1.

Former Member
0 Kudos
160

Hi,

Check out the below link....

huseyin_catalbas
Explorer
0 Kudos
160

Hello Joy,

Yes it should be possible with a coding similar to below.

Regards,

Hüseyin Çatalbaş

AT SELECTION-SCREEN OUTPUT.

  • make all fields active

LOOP AT SCREEN .

screen-active = 1.

MODIFY SCREEN.

ENDLOOP.

*make chosen fields inactive according to radios

LOOP AT SCREEN .

IF radio1 = 'X'.

IF screen-name CS 'REF'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF radio2 = 'X'.

IF screen-name CS 'PO'.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.