Application Development and Automation 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: 
Read only

How to generate dynamic selection-screen?

Former Member
0 Likes
1,257

Hi all,

I have two radio buttons on selection-screen.

If user-selects the one, Then under the radio button another parameter should be displayed

if he selects another radio button, the previous parameter should not be displayed and another parameter should appear in the selection screen under the second radio button.

Please help by giving the code to solve this problem?

Thanks,

Vamshi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,021

dear you can use this code for refrence

PARAMETERS : but1 RADIOBUTTON GROUP rad1 USER-COMMAND clmd1,
             but2 RADIOBUTTON GROUP rad1 ,  "USER-COMMAND clmd1,
             filename LIKE rlgrap-filename.

INITIALIZATION.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF screen-name = '%_FILENAME_%_APP_%-TEXT' AND but2 = 'X'.

      screen-active = '0'.
      screen-required = '0'.
      MODIFY SCREEN.
    ENDIF.


    IF screen-name = 'FILENAME' AND but2 = 'X'.
      screen-active = '0'.
      screen-required = '0'.
      screen-name = ''.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    IMPORTING
      file_name     = filename.

START-OF-SELECTION.

  IF but1 = 'X'.
    fname = filename.
    PERFORM update_zappr_tmpt .
  ELSEIF but2 = 'X'.
    PERFORM modify_zappr_hrq .
  ENDIF.

dear you can use this code for refrence

PARAMETERS : but1 RADIOBUTTON GROUP rad1 USER-COMMAND clmd1,
             but2 RADIOBUTTON GROUP rad1 ,  "USER-COMMAND clmd1,
             filename LIKE rlgrap-filename.

INITIALIZATION.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF screen-name = '%_FILENAME_%_APP_%-TEXT' AND but2 = 'X'.

      screen-active = '0'.
      screen-required = '0'.
      MODIFY SCREEN.
    ENDIF.


    IF screen-name = 'FILENAME' AND but2 = 'X'.
      screen-active = '0'.
      screen-required = '0'.
      screen-name = ''.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    IMPORTING
      file_name     = filename.

START-OF-SELECTION.

  IF but1 = 'X'.
    fname = filename.
    PERFORM update_zappr_tmpt .
  ELSEIF but2 = 'X'.
    PERFORM modify_zappr_hrq .
  ENDIF.

5 REPLIES 5
Read only

Former Member
0 Likes
1,021

You have to add modiff id with those parameter and code in at selection-screen event to modify the screen.

Like:




AT SELECTION-SCREEN OUTPUT.

loop at screen.
  if screen-name eq 'PNPS$MSL'.
    screen-active = 0.
  endif.
  modify screen.
endloop.


Read only

Former Member
0 Likes
1,021

Hi Vamsi,

By using AT SELECTION-SCREEN OUTPUT and creating the MOdif id for the selection screen parameter you can achieve the dynamic selection scree..


AT SELECTION-SCREEN OUTPUT.
* Modify selection screen as per the radio buttons selected.
  PERFORM modify_sel-screen.
 
FORM modify_sel-screen .

* If radio button - process in range of STR's selected, display STR
* range and Date range as input
  IF p_rb1 EQ c_x.
    LOOP AT SCREEN.
      IF screen-group1 = c_ir2.
        screen-active  = c_0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
* If radio button - process from excel is selected, give option for
* user to upload file
  ELSEIF p_rb2 EQ c_x.
    LOOP AT SCREEN.
      IF screen-group1 = c_ir1.
        screen-active  = c_0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " MODIFY_SEL-SCREEN

see the below example....

copy the below code you can come to know how the dynamic selection screen happens..



*----------------------------------------------------------------------*
*                   S E L E C T I O N  S C R E E N                     *
*----------------------------------------------------------------------*
* Selection criteria
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_rb1  RADIOBUTTON GROUP gr1 USER-COMMAND com1 DEFAULT 'X',
                                         "Process STR's in date range
           p_rb2  RADIOBUTTON GROUP gr1. "Process STR's from Excel
SELECTION-SCREEN BEGIN OF BLOCK c1 WITH FRAME .
PARAMETERS : p_apover TYPE zcpeg_fg_related-pl_version OBLIGATORY.
                                                            "PJ1031008
SELECTION-SCREEN END OF BLOCK c1.
SELECTION-SCREEN END OF BLOCK b1.

* Display date range to process STR's
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: s_banfn FOR w_preq MODIF ID ir1,
                                    "Purchase requisition number
                s_lfdat FOR w_lfdat MODIF ID ir1.
"Date range
SELECTION-SCREEN END OF BLOCK b2.

* Option for uploading file to process STR's
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS: p_file TYPE rlgrap-filename MODIF ID ir2. "File name
SELECTION-SCREEN END OF BLOCK b3.



AT SELECTION-SCREEN OUTPUT.
* Modify selection screen as per the radio buttons selected.
  PERFORM modify_sel-screen.
 
FORM modify_sel-screen .

* If radio button - process in range of STR's selected, display STR
* range and Date range as input
  IF p_rb1 EQ c_x.
    LOOP AT SCREEN.
      IF screen-group1 = c_ir2.
        screen-active  = c_0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
* If radio button - process from excel is selected, give option for
* user to upload file
  ELSEIF p_rb2 EQ c_x.
    LOOP AT SCREEN.
      IF screen-group1 = c_ir1.
        screen-active  = c_0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.
ENDFORM.                    " MODIFY_SEL-SCREEN

Regards,

Prabhudas

Read only

0 Likes
1,021

Solved . Thanks.

Read only

Former Member
0 Likes
1,022

dear you can use this code for refrence

PARAMETERS : but1 RADIOBUTTON GROUP rad1 USER-COMMAND clmd1,
             but2 RADIOBUTTON GROUP rad1 ,  "USER-COMMAND clmd1,
             filename LIKE rlgrap-filename.

INITIALIZATION.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF screen-name = '%_FILENAME_%_APP_%-TEXT' AND but2 = 'X'.

      screen-active = '0'.
      screen-required = '0'.
      MODIFY SCREEN.
    ENDIF.


    IF screen-name = 'FILENAME' AND but2 = 'X'.
      screen-active = '0'.
      screen-required = '0'.
      screen-name = ''.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    IMPORTING
      file_name     = filename.

START-OF-SELECTION.

  IF but1 = 'X'.
    fname = filename.
    PERFORM update_zappr_tmpt .
  ELSEIF but2 = 'X'.
    PERFORM modify_zappr_hrq .
  ENDIF.

Read only

0 Likes
1,021

Hi ankith,

Your reply is help ful.

But can u please explain me IF screen-name = '%_FILENAME_%_APP_%-TEXT' what is this screen-name value?

Thanks,

Vamshi