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: 

manipulate 2 checkboxes

Former Member
0 Kudos

hi

i have to display 2 checkboxes on a selection screen, whereby one should be mandatory

and when one is checked, the other is disabled

i did smthing like this but its not working

pls advise

PARAMETERS : p_post AS CHECKBOX USER-COMMAND usr default 'X',

p_park AS CHECKBOX USER-COMMAND usr1.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF p_post = 'X'.

IF screen-name = 'P_PARK'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF p_park = 'X'.

IF screen-name = 'P_POST'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Why don't you use simple radio buttons, only one can be active at any given time.

7 REPLIES 7

Former Member
0 Kudos

Why don't you use simple radio buttons, only one can be active at any given time.

Former Member
0 Kudos

Hi,

Your code seemed to be working fine..If you check one the other is getting disabled.

If you want to check atleast one is checked..THen use AT SELECTION-SCREEN...and validate the checkboxes..

at selection-screen.

if p_post is initial and p_park is initial.
  message e208(00) with 'Atleast one should be checked'.

endif.

THanks

Naren

0 Kudos

its working but i dont need the message,

is there another alternative?

0 Kudos

check this , is it that you are expecting..

DATA: p_flag.
PARAMETERS : p_post AS CHECKBOX USER-COMMAND usr DEFAULT 'X',
p_park AS CHECKBOX USER-COMMAND usr1.

AT SELECTION-SCREEN OUTPUT.

  IF p_park = 'X' .
    p_flag = 'X'.
  ELSEIF p_post = 'X'.
    p_flag = ''.
  ENDIF.
  IF p_flag = '' AND
     p_park = '' AND
     p_post = '' .
    p_flag = 'X'.
  ELSE.
    p_flag = ' '.
  ENDIF.
  LOOP AT SCREEN.
    IF p_flag = ' '.
      p_post = 'X'.
      IF screen-name = 'P_PARK'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      p_park = 'X'.
      IF p_flag = 'X'.
        IF screen-name = 'P_POST'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDLOOP.

i just manipulated and coded see it works or not.

0 Kudos

Hi ,

This disabling should be done only when any of CHECK BOX selected.


AT SELECTION-SCREEN OUTPUT.
  IF SY-UCOMM = 'USR'   OR
      SY-UCOMM = 'USR1'.
    LOOP AT SCREEN.
      IF p_post = 'X'.
        IF screen-name = 'P_PARK'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDIF.

      IF p_park = 'X'.
        CLEAR P_POST.
        IF screen-name = 'P_POST'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDIF.
    ENDLOOP.
  ENDIF.

If you want any one should be selected, then you should clear

P_POST when P_PARK is selected.

Try this.

Regards,

R.Nagarajan.

-


We can -


Former Member
0 Kudos

Hi,

Not sure if I understood your requirements...You want to make them mandatory..but you don't want the message..

is this what you want?please let me know..

THanks

Naren

Former Member
0 Kudos

use Radiobutton to have it work automatically

PARAMETERS : p_post type c radiobutton group 1 default 'X',

p_park type c radiobutton group 1.