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

Change screen field attributes dynamically

Former Member
0 Likes
1,373

Hello,

I have a custom screen with a radiobutton group consisting of 4 buttons. Function code for the radio button is 'SEARCHOP'. I have four I/O fields next to each radiobutton on the screen. I want that all I/O fields should be invisible except the one for which the current radiobutton is selected.

E.g.

On screen:

RB1 IOField1 (Status: Visible)

RB2 IOField2 (Status: Invisible)

RB3 IOField3 (Status: Invisible)

RB4 IOField4 (Status: Invisible)

User Input: Click on radiobutton RB3

On screen:

RB1 IOField1 (Status: Invisible)

RB2 IOField2 (Status: Invisible)

RB3 IOField3 (Status: Visible)

RB4 IOField4 (Status: Invisible)

I am using the following code in PAI but it doesn't work.

MODULE USER_COMMAND_9501 INPUT.

OK_CODE = SY-UCOMM.

CASE OK_CODE.

WHEN 'SEARCHOP'.

IF RBN_SEARCH_FOLIO EQ 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME EQ 'IOFIELD1'

SCREEN-ACTIVE = 'X'.

MODIFY SCREEN.

ELSEIF SCREEN-NAME EQ 'IOFIELD2' OR

SCREEN-NAME EQ 'IOFIELD3' OR

SCREEN-NAME EQ 'IOFIELD4'

SCREEN-ACTIVE = ''.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF RBN_SEARCH_CERT EQ 'X'.

...

ELSEIF RBN_SEARCH_DIST EQ 'X'.

...

ELSEIF RBN_SEARCH_RECEIPT EQ 'X'.

...

ENDIF.

ENDCASE.

ENDMODULE.

Suggestions are app[reciated. Thanks.

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
872

Try doing the setting of fields "active" in the PBO, not the PAI.

Jonathan

4 REPLIES 4
Read only

karol_seman
Active Participant
0 Likes
872

Hi,

on click on radio button you have to loop at screen:



  LOOP AT SCREEN.
   CASE SCREEN-NAME.
     WHEN 'IOFIELD1'. 
      IF RB1 = 'X'.
        SCREEN-INVISIBLE = 0.
      ELSE.
        SCREEN-INVISIBLE = 1.
      ENDIF.
      MODIFY SCREEN.
     WHEN 'IOFIELD2'. 
      IF RB2 = 'X'.
        SCREEN-INVISIBLE = 0.
      ELSE.
        SCREEN-INVISIBLE = 1.
      ENDIF.
      MODIFY SCREEN.
    ENDCASE.
  ENDLOOP. 

you have to do case for all 4 radio buttons in the way mentioned above.

Read only

Former Member
0 Likes
872

Hi,

At first, you should set a radiobutton for the four radiobutton,

And then, set a funciton code for each radiobutton.

The last, use the loop at screen statement to control the input field like the above reply.

BR

Bob

Read only

former_member200872
Active Participant
0 Likes
872

Hi,

Try the code given below.

Regards,

Wajid Hussain P.

  • * * * *

CASE ok_code.

WHEN 'SEARCHOP'.

IF rbn_search_folio EQ 'X'.

LOOP AT SCREEN.

IF screen-name EQ 'IOFIELD1'.

screen-active = 'X'.

screen-invisible = ' '.

ELSEIF screen-name EQ 'IOFIELD2' OR

screen-name EQ 'IOFIELD3' OR

screen-name EQ 'IOFIELD4'.

screen-active = ' '.

screen-invisible = 'X'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF rbn_search_cert EQ 'X'.

  • ...

ELSEIF rbn_search_dist EQ 'X'.

  • ...

ELSEIF rbn_search_receipt EQ 'X'.

  • ...

ENDIF.

ENDCASE.

Read only

Former Member
0 Likes
873

Try doing the setting of fields "active" in the PBO, not the PAI.

Jonathan