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 make screen fields input value '0' at runtime. ??

Former Member
0 Likes
774

I have two radiobuttons r1 and r2,

and i have two parameters p1 and p2.

Now,

when r1 is selected p2 should be disabled for input,

and when r2 is selected p1 should be disabled for output.

Right now i am using

**************************************************

AT SELECTION-SCREEN OUTPUT.

if r1 = 'X'.

LOOP AT SCREEN.

if screen-name = 'p2'.

screen-input = '0'.

MODIFY SCREEN.

endloop.

endif.

else.

LOOP AT SCREEN.

if screen-name = 'p1'.

screen-input = '0'.

MODIFY SCREEN.

endif.

endloop.

endif.

*********************************

The following code on execution,

only sets the default, but this event is not triggered on runtime.

How can we do this ??

8 REPLIES 8
Read only

jayanthi_jayaraman
Active Contributor
0 Likes
736

Hi,

To hide:

PARAMETERS: r_copy RADIOBUTTON GROUP R1 default 'X' user-command rusr,

r_delete RADIOBUTTON GROUP R1,

p_copy(10) modif id Z1,

p_delete(10) modif id z2.

AT SELECTION-SCREEN output.

LOOP AT SCREEN.

IF ( r_copy = 'X' and SCREEN-GROUP1 = 'Z1' ) or

( r_delete = 'X' and SCREEN-GROUP1 = 'Z2' ) or

( screen-name CS 'R_COPY' ) or ( screen-name CS 'R_DELETE' ).

SCREEN-active = 1.

ELSE.

SCREEN-active = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

To Disable:

PARAMETERS: r_copy RADIOBUTTON GROUP R1 default 'X' user-command rusr,

r_delete RADIOBUTTON GROUP R1,

p_copy(10) modif id Z1,

p_delete(10) modif id z2.

AT SELECTION-SCREEN output.

LOOP AT SCREEN.

IF ( r_copy = 'X' and SCREEN-GROUP1 = 'Z1' ) or

( r_delete = 'X' and SCREEN-GROUP1 = 'Z2' ) or

( screen-name = 'R_COPY' ) or ( screen-name = 'R_DELETE' ).

SCREEN-input = 1.

ELSE.

SCREEN-input = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Read only

0 Likes
736

Hi,

Just copy and paste.This should work.

PARAMETERS: r1 RADIOBUTTON GROUP R1 default 'X' user-command rusr,

r2 RADIOBUTTON GROUP R1,

p1(10) modif id Z1,

p2(10) modif id Z2.

AT SELECTION-SCREEN output.

LOOP AT SCREEN.

IF ( r1= 'X' and SCREEN-GROUP1 = 'Z1' ) or

( r2 = 'X' and SCREEN-GROUP1 = 'Z2' ) or

( screen-name = 'R1') or ( screen-name = 'R2').

SCREEN-input = 1.

ELSE.

SCREEN-input = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Read only

anversha_s
Active Contributor
0 Likes
736

hi,

chk this.

*-------------------------------------------
PARAMETERS : R1 RADIOBUTTON GROUP RG USER-COMMAND R DEFAULT 'X'.
PARAMETERS : R2 RADIOBUTTON GROUP RG .


*-------------------------------------------
selection-screen begin of block b1 with frame.
parameters : a(10) type c modif id abc.
parameters : b(10) type c modif id abc.
selection-screen end of block b1.

*-------------------------------------------
at selection-screen .


IF R1 = 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'A'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

IF R2 = 'X'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'B'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.

rgds

Anver

Read only

Former Member
0 Likes
736

HI Anuj

Please note that the names you use for the parameter comparision should in UPPER CASE. Highlighted below are for your reference.

AT SELECTION-SCREEN OUTPUT.

if r1 = 'X'.

LOOP AT SCREEN.

if screen-name = '<b>P2</b>'.

screen-input = '0'.

MODIFY SCREEN.

endloop.

endif.

else.

LOOP AT SCREEN.

if screen-name = '<b>P1</b>'.

screen-input = '0'.

MODIFY SCREEN.

endif.

endloop.

endif.

Kind Regards

Eswar

Read only

0 Likes
736

hi everyone,

None of the above code is working.

The code is not executed when i change the selection of radiobutton.

are the events specified get called when a change is made??

Read only

0 Likes
736

Hi Anuj

Please check that you code resembles something like below:

parameters: r1 radiobutton group rad1 default 'X' user-command ABC,
            r2 radiobutton group rad1.
parameters: p1(10) type c,
            p2(10) type c.

at selection-screen output.
  loop at screen.
     case 'X'.
     when R1.
          case screen-name.
          when 'P1'.
               screen-input = 1.
          when 'P2'.
               screen-input = 0.
          endcase.
     when R2.
          case screen-name.
          when 'P1'.
               screen-input = 0.
          when 'P2'.
               screen-input = 1.
          endcase.
     endcase.
     modify screen.
  endloop.

Copy the above code to a temporary program and execute to check the same.

Hope this helps you.

Kind Regards

Eswar

Read only

Former Member
0 Likes
736

Hi anuj,

just by putting code in the 'at selection-screen output.'. will not work.

you require to to trigger an event on radio button selection.

Try the following code with 2 radio buttons, it will work.

REPORT Y_TEMP_EXAMPLE.

tables: T001w.

parameters: p_radio1 radiobutton group serv default 'X' user-command

flag.

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

parameters: p_param type localfile modif id b1.

selection-screen end of block radio1.

parameters: p_radio2 radiobutton group serv.

selection-screen begin of block radio2 with frame title text-002.

select-options : s_plant for T001w-werks modif id b2.

selection-screen end of block radio2.

at selection-screen output.

loop at screen.

case screen-group1.

when 'B1'.

if p_radio1 eq space.

screen-input = 0. "disable file input parameter.

endif.

when 'B2'.

if p_radio2 eq space. "if report option not selected

screen-input = 0. "disable plant and prodh select options

endif.

endcase.

modify screen.

endloop.

Read only

Former Member
0 Likes
736

Hi Anuj,

Your code is fine only thing u need to change in the code is:

<b> change Screen-name = 'p2' to screen-name cs 'p2'.</b>

AT SELECTION-SCREEN OUTPUT.

if r1 = 'X'.

LOOP AT SCREEN.

if screen-name <b>CS</b> 'p2'.

screen-input = '0'.

MODIFY SCREEN.

endloop.

endif.

else.

LOOP AT SCREEN.

if screen-name <b>CS</b> 'p1'.

screen-input = '0'.

MODIFY SCREEN.

endif.

endloop.

endif.

I hope this helps.

Regards,

Geeta