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

Checkbox validation...?

0 Likes
4,325

i have to display 2 checkbox....at a given time 1 check box must be selected....or a message display to select a checkbox...

message should display before output( on selection screen)...

11 REPLIES 11
Read only

SharathYaralkattimath
Contributor
0 Likes
2,713

Hi,

code like this,

AT SELECTION-SCREEN OUTPUT.

IF p_check1 is INITIAL AND p_check2 IS INITIAL.

     MESSAGE 'Either Checkbox 1 or Checkbox2 should be selected' TYPE 'S'.

ENDIF.


Read only

0 Likes
2,713

Message is showing after returning from list screen....i want to show the message before output...then user select a check box... then execute the code(F8)

Read only

0 Likes
2,713

Replace

AT SELECTION-SCREEN OUTPUT.

with

AT SELECTION-SCREEN.

...........

message 'xxxxx' type 'E'.

.............

Read only

0 Likes
2,713

by using AT SELECTION-SCREEN.... message is showing in list screen...not on the selection screen

Read only

0 Likes
2,713

Please post a proper Question,

Not very clear what you need.

Read only

0 Likes
2,713

sorry....i  not saw you changed message type S to E....now the issuse is fix

thanks!!!

Read only

0 Likes
2,713

code like this,

AT SELECTION-SCREEN.

IF p_check1 is INITIAL AND p_check2 IS INITIAL.

     MESSAGE 'Either Checkbox 1 or Checkbox2 should be selected' TYPE 'E'.

ENDIF.

Read only

Phillip_Morgan
Contributor
0 Likes
2,713

By selected you mean checked so internally in ABAP it contains 'X', I presume.

Not very clear what you need.

You could display it with default 'X' unless it depends on value of another field on the screen...

(never mind - Sharath has it right!)

Read only

Former Member
0 Likes
2,713

Hi,

If your requirement is to have only one option selected at a given point of time, then u should go for RADIO BUTTON else if multiple options to be selected, then CHECK BOX.

I will give you a brief overview of the syntax of CHECK BOX

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.

PARAMETER: CB_DISPLAY AS CHECKBOX,

                       CB_DOWNLOAD AS CHECKBOX.

SELECT-SCREEN END OF BLOCK B1.

IF CB_DISPLAY = 'X'.

<CODE TO DISPLAY THE DATA FROM ON TO THE SCREEN'

ELSEIF CB_DOWNLOAD = 'X'.

CALL FUNCTION 'GUI_DOWNLOAD'.

Read only

0 Likes
2,713

i know what is radio button & check box....my requirement is..

>there should 2 check box....user can select both or AT least one

>if user doesnt select any check box...a message should display to select at leaste one

>message should show when user click execute(F8) without any checkbox selected...

Read only

0 Likes
2,713

AT SELECTION-SCREEN.

IF p_cb1 is INITIAL and p_cb2 IS INITIAL.

IF sy-ucomm = 'ONLI'. " When user presses F8

* Give your error message

ENDIF.

ENDIF.