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: 

Hiding selection screen input fields along with field names in a Report.

former_member1716
Active Contributor
0 Kudos

Hello Experts,

I have a following requirement, In my report there are two radi buttons r1 and r2 and say two fields f1 and f2. when i select r2 both the fields f1 and f2 must be visible suppose if i select r1 both fields must disappear, i should not see the input fields and also the field names(f1, f2)
in the screen. Is there any possibility to achieve this requirement.

At least case,can i put the fields f1 and f2 in a seperate block and can i hide the entire block when selecting the radio button r1. If yes please help me to acheive the logic.

Thanks in advance

Thanks and regards,

Satish Kumar Balasubramanian.

1 ACCEPTED SOLUTION

arivazhagan_sivasamy
Active Contributor

Hi Sathishi,

Please write a code like below..

   PARAMETERS : R1 RADIOBUTTON GROUP G1 USER-COMMAND CMD DEFAULT 'X',
                             R2 RADIOBUTTON GROUP G1.

  PARAMETERS: FIELD1(30) MODIF ID 'AA',

                          FIELD2(30) MODIF ID 'AA',

                           FIELD3(30) MODIF ID.

   AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

  IF R2 = 'X'.

  IF SCREEN-GROUP1 = 'AA'.

     SCREEN-ACTIVE = '0'.
        MODIFY SCREEN.

  ENDIF.  

  ENDIF.

When select R2 field1 and field2 will be inactive.

Arivazhagna S

17 REPLIES 17

former_member424229
Participant
0 Kudos

Hi,

   use the event 'At selection-screen output'.

arivazhagan_sivasamy
Active Contributor

Hi Sathishi,

Please write a code like below..

   PARAMETERS : R1 RADIOBUTTON GROUP G1 USER-COMMAND CMD DEFAULT 'X',
                             R2 RADIOBUTTON GROUP G1.

  PARAMETERS: FIELD1(30) MODIF ID 'AA',

                          FIELD2(30) MODIF ID 'AA',

                           FIELD3(30) MODIF ID.

   AT SELECTION-SCREEN OUTPUT.

  LOOP AT SCREEN.

  IF R2 = 'X'.

  IF SCREEN-GROUP1 = 'AA'.

     SCREEN-ACTIVE = '0'.
        MODIFY SCREEN.

  ENDIF.  

  ENDIF.

When select R2 field1 and field2 will be inactive.

Arivazhagna S

0 Kudos

Hi Arivu,

I  got the answer Thank you so much. But i ahve small concern here.

When i select r1 all the fileds are getting hidden as per our requirement and now when i select r2 the fileds are shown, now when i fill something in the input fields and and go to r1 now again the fields are getting hidden, now again when i come back to r2 the value that i have given in the input fields remain, i want that to be cleared can you please help in this also.

Thanks,

Satish

0 Kudos

hi,

  use 'clear' statement.

atul_mohanty
Active Contributor
0 Kudos

Hi Satish -

You can achieve this AT SELECTION-SCREEN OUTPUT.

You need to add a MODIF ID to each group. And LOOP over the SCREEN.

Then CHECK the GROUP1 and you need to set the properties of ACTIVE, INVISIBLE for each of them as per your requirement.

0 Kudos

Hi atul,

Could you please guide me with a sample code.

Regards,

Satish

Former Member
0 Kudos

Hi,

I think you can try like this

tables:mara.

PARAMETERS:rad1 RADIOBUTTON GROUP rad1 default 'X' USER-COMMAND RAD,

rad2 RADIOBUTTON GROUP rad1.

SELECT-OPTIONS:num for mara-matnr.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

if rad1 = 'X'.

   IF screen-name cs 'NUM'.

   screen-active = '0'.

   MODIFY SCREEN.

   ENDIF.

else.

   IF screen-name cs 'NUM'.

   screen-active = '1'.

   MODIFY SCREEN.

   ENDIF.

endif.

ENDLOOP.

0 Kudos

Hi Kiran,

When i use your logic only input fields are getting hidden, i also want selection field name also to be hidden.

Thanks ,

Satish

0 Kudos

Hi Satish,

You can find many discussions on similar topic.

You need to

1. Give user command to radio buttons

2. Modif Id to the fields field1 and field2.

3. code both cases in at selection screen output.

You will get the required output.

PARAMETER : r_x RADIOBUTTON GROUP rad1 USER-COMMAND fc ,
             r_y   RADIOBUTTON GROUP rad1 .



SELECTION-SCREEN begin of BLOCK bl1 WITH FRAME .
  PARAMETERS p_field1 TYPE c MODIF ID MD1.
  PARAMETERS p_field TYPE c MODIF ID MD1.
SELECTION-SCREEN end of BLOCK bl1.


AT SELECTION-SCREEN OUTPUT.
   if r_y = 'X'.
     loop at screen.
         IF screen-group1 = 'MD1'.
           screen-invisible = 0.
           screen-input = 1.
           MODIFY SCREEN.
         ENDIF.
       ENDLOOP .
     else.
       loop at screen.
         IF screen-group1 = 'MD1'.
           screen-invisible = 1.
           screen-input = 0.
           MODIFY SCREEN.
         ENDIF.
       ENDLOOP .
  endif.

0 Kudos

Hi,

It is  working fine for me

former_member196157
Active Participant
0 Kudos

hiii,

hey try the following code

tables: mara, mseg.


selection-screen: begin of block b1  with frame title text-001.
  parameters: rb1 radiobutton group g1 user-command abap,
              rb2 radiobutton group g1 default 'X' .
selection-screen: end of block b1.


selection-screen begin of block b3 with frame title text-001.

select-options : matnr1 for mseg-matnr modif id rb2,
                  mtart1 for mara-mtart modif id rb2.
selection-screen end of block b3.

at selection-screen output.
if rb1 = 'X'.
perform hide_rb2_options.
else.
endif.


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.



OR u can try the code



tables: mara, mseg.


selection-screen: begin of block b1  with frame title text-001.
  parameters: rb1 radiobutton group g1 user-command abap,
              rb2 radiobutton group g1 default 'X' .
selection-screen: end of block b1.


selection-screen begin of block b2 with frame title text-001.

select-options : matnr for mseg-matnr modif id rb1,
                  mtart for mara-mtart modif id rb1,
                  matkl for mara-matkl modif id rb1.
selection-screen end of block b2.


selection-screen begin of block b3 with frame title text-001.

select-options : matnr1 for mseg-matnr modif id rb2,
                  mtart1 for mara-mtart modif id rb2.
selection-screen end of block b3.

at selection-screen output.
if rb1 = 'X'.
perform hide_rb2_options.
else.
perform hide_rb1_options.
endif.


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

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.




former_member220538
Active Participant
0 Kudos

Hi,

Try this

PARAMETERS:r1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND cmd,

            r2 RADIOBUTTON GROUP g1.

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

PARAMETERS:f1 TYPE sy-datum MODIF ID m1,

            f2 TYPE sy-datum MODIF ID m1.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

   LOOP AT SCREEN.

     IF r1 = 'X'.

       IF screen-group1 EQ 'M1'.

         screen-active = '0'.

       ENDIF.

     ENDIF.

     MODIFY SCREEN.

   ENDLOOP.


Regards,

Jeffin

0 Kudos

Hi George,

When i select r1 all the fileds are getting hidden as per our requirement and now when i select r2 the fileds are shown, now when i fill something in the input fields and and go to r1 now again the fields are getting hidden, now again when i come back to r2 the value that i have given in the input fields remain, i want that to be cleared can you please help in this also.

Thanks,

Satish

0 Kudos

Hi,

Use the clear statment in SELECTION SCREEN OUTPUT.

AT SELECTION-SCREEN OUTPUT.

   CLEAR: f1,f2.


Regards,

Jeffin

0 Kudos

If its a parameter it is clearing but for select options it is not clearing :< Can u pls help on this.

0 Kudos

Use refresh for select options.  refresh s_field.

or clear s_field[].

0 Kudos

Thank you so much Susan You are right again .

Help from seniors like you is really very essential for beginners like me.

Thanks,

Satish