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

at selection-screen output.

Former Member
0 Likes
1,092

hi

i had an req to modify the selection screen:

there are 5 fileds from fld1,fld5.alsong with r1 & r2.

user wants,if r1 is selected fld1-fld3 shd be displayed,other shd be hided.

if r2 is selected fld4-fld5 to be displayed,rest to be hided.

please tell any sample code,so tnat i can do this.

regds

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,063

Check this sample code.

REPORT  ztest_selection.


PARAMETERS: p1(10),
            p2(10),
            p3(10),
            p4(10),
            p5(10).
PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND abc DEFAULT 'X',
            r2 RADIOBUTTON GROUP g1.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF r1 = 'X'.
      IF screen-name CS 'P4' or screen-name CS 'P5'.
        screen-active = 0.
        modify screen.
      ENDIF.
    ELSE.
      IF screen-name CS 'P1' or screen-name CS 'P2'
      OR screen-name CS 'P3'.
        screen-active = 0.
        modify screen.
      ENDIF.
    ENDIF.

  ENDLOOP.

hi

i had an req to modify the selection screen:

there are 5 fileds from fld1,fld5.alsong with r1 & r2.

user wants,if r1 is selected fld1-fld3 shd be displayed,other shd be hided.

if r2 is selected fld4-fld5 to be displayed,rest to be hided.

please tell any sample code,so tnat i can do this.

regds

10 REPLIES 10
Read only

bpawanchand
Active Contributor
0 Likes
1,063

Hi

regards

Pavan

Read only

Former Member
0 Likes
1,063

hi Vipin

Use Loop at Screen -- endllop in AT Selection-screen output event

Regards

Deva

Read only

former_member386202
Active Contributor
0 Likes
1,063

Hi,

Refer below code

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS : p_pres RADIOBUTTON GROUP g1 "Radio button for presentation server

USER-COMMAND radio DEFAULT 'X',

p_appl RADIOBUTTON GROUP g1, "Radio button for application server

p_ptest TYPE c AS CHECKBOX.

SELECTION-SCREEN : END OF BLOCK b1.

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS : p_pifile TYPE rlgrap-filename MODIF ID md1, "Input filename for presentation server

p_pefile TYPE rlgrap-filename MODIF ID md2. "Error filename for presentation server

SELECTION-SCREEN : END OF BLOCK b2.

SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.

PARAMETERS : p_aifile TYPE ibipparms-path MODIF ID md3, "Input filename for application server

p_aefile TYPE ibipparms-path MODIF ID md4. "Error filename for application server

SELECTION-SCREEN : END OF BLOCK b3.

IF p_pres EQ c_x.

LOOP AT SCREEN.

IF screen-group1 EQ 'MD3'.

screen-input = c_ok.

screen-active = c_1.

ENDIF.

IF screen-group1 EQ 'MD4'.

screen-input = c_ok.

screen-active = c_1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF p_appl EQ c_x.

LOOP AT SCREEN.

IF screen-group1 EQ 'MD1'.

screen-input = c_ok.

screen-active = c_1.

ENDIF.

IF screen-group1 EQ 'MD2'.

screen-input = c_ok.

screen-active = c_1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

Regards,

Prashant

Read only

Former Member
0 Likes
1,063

Hi,

Check this sample code


REPORT z_sdn.

PARAMETERS:
  p_num RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND abc,
  p_char RADIOBUTTON GROUP rad1.

PARAMETERS:
  p_num1  TYPE i MODIF ID num,
  p_num2  TYPE i MODIF ID num,
  p_num3  TYPE i MODIF ID num,
  p_char1 TYPE c MODIF ID chr,
  p_char2 TYPE c MODIF ID chr.


AT SELECTION-SCREEN OUTPUT.
  IF p_num EQ 'X'.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'CHR'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'NUM'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Regards

Abhijeet

Read only

Former Member
0 Likes
1,063

Hi

Try like below

PARAMETERS show_all AS CHECKBOX USER-COMMAND flag.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

PARAMETERS: p1(10) TYPE c,

p2(10) TYPE c,

p3(10) TYPE c.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.

PARAMETERS: p4(10) TYPE c MODIF ID bl2,

p5(10) TYPE c MODIF ID bl2,

p6(10) TYPE c MODIF ID bl2.

SELECTION-SCREEN END OF BLOCK b2.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF show_all <> 'X' AND

screen-group1 = 'BL2'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

regards

jana

Read only

Former Member
0 Likes
1,063

hi,

plz chk below example :

parameters: r1 as checkbox user-command abc,
p1(10).

at selection-screen output.

if r1 is initial.

loop at screen.
if screen-name = 'P1'.
screen-input = '0'.
endif.
modify screen.
endloop.

else.
loop at screen.
if screen-name = 'P1'.
screen-input = '1'.
endif.
modify screen.
endloop.

endif.

thanx.

Read only

Former Member
0 Likes
1,064

Check this sample code.

REPORT  ztest_selection.


PARAMETERS: p1(10),
            p2(10),
            p3(10),
            p4(10),
            p5(10).
PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND abc DEFAULT 'X',
            r2 RADIOBUTTON GROUP g1.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF r1 = 'X'.
      IF screen-name CS 'P4' or screen-name CS 'P5'.
        screen-active = 0.
        modify screen.
      ENDIF.
    ELSE.
      IF screen-name CS 'P1' or screen-name CS 'P2'
      OR screen-name CS 'P3'.
        screen-active = 0.
        modify screen.
      ENDIF.
    ENDIF.

  ENDLOOP.

Read only

0 Likes
1,063

hi

in the same req the user also want fld 1 & fld 4 as mandaty,but than its showing error,only hiding the fileds after assinging some values to mandatry fileds,is there any way,to solve this?

Read only

0 Likes
1,063

You can avoid that using the Checks on those fields.

Here is the modified version of the code.

REPORT  ztest_selection.


PARAMETERS: p1(10),
            p2(10),
            p3(10),
            p4(10),
            p5(10).
PARAMETERS: r1 RADIOBUTTON GROUP g1 USER-COMMAND abc DEFAULT 'X',
            r2 RADIOBUTTON GROUP g1.

AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

    IF r1 = 'X'.
      IF screen-name CS 'P4' OR screen-name CS 'P5'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-name CS 'P1' OR screen-name CS 'P2'
      OR screen-name CS 'P3'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.

  ENDLOOP.

AT SELECTION-SCREEN.
  IF sy-ucomm = 'ONLI'.
    IF r1 = 'X' AND p1 IS INITIAL.
      SET CURSOR FIELD 'P1'.
      MESSAGE 'Enter value in P1' TYPE 'E'.
    ENDIF.
    IF r1 = 'X' AND p2 IS INITIAL.
      SET CURSOR FIELD 'P2'.
      MESSAGE 'Enter value in P2' TYPE 'E'.
    ENDIF.

  ENDIF.

Read only

0 Likes
1,063

Hello Vipin,

At a time how can you hide a field and make it mandatory?

If you hide a field, who will enter the data in it?

First get the requirement properly from client or functional guy. If he want to hide the field and make it mandatory ask him to give a default value for the mandatory field and put that default value in parameters.

Regards,

Naresh.