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

making a field mandatory while selecting radio button

Former Member
0 Likes
5,549

Hi Gurus

There are four radio buttons in the selection screen.while a selecting a fourth radio button the user should be prompted to enter select option.while the user selects the fourth radio button only select option should become a mandatory field.If user selects first button then select option should be hidden again. I am finding problem in making select option mandatory while selecting fourth radio button.

My code is

tables : afru.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

*

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 1.

PARAMETERS :

rb_1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND chk.

SELECTION-SCREEN COMMENT 3(5) text-003.

*

SELECTION-SCREEN POSITION 10.

PARAMETERS :

rb_2 RADIOBUTTON GROUP g1.

SELECTION-SCREEN COMMENT 12(10) text-004.

*

SELECTION-SCREEN POSITION 22.

PARAMETERS :

rb_3 RADIOBUTTON GROUP g1.

SELECTION-SCREEN COMMENT 24(10) text-005.

SELECTION-SCREEN END OF LINE.

*

PARAMETERS:

rb_4 RADIOBUTTON GROUP g1.

SELECT-OPTIONS:

s_budat FOR afru-budat MODIF ID d1.

SELECTION-SCREEN END OF BLOCK b2.

*Prompt user for custom date

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF rb_4 = '' AND screen-group1 = 'D1'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

plz suggest steps

Thanks

Ganesh

Hi Gurus

There are four radio buttons in the selection screen.while a selecting a fourth radio button the user should be prompted to enter select option.while the user selects the fourth radio button only select option should become a mandatory field.If user selects first button then select option should be hidden again. I am finding problem in making select option mandatory while selecting fourth radio button.

My code is

tables : afru.

SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

*

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 1.

PARAMETERS :

rb_1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND chk.

SELECTION-SCREEN COMMENT 3(5) text-003.

*

SELECTION-SCREEN POSITION 10.

PARAMETERS :

rb_2 RADIOBUTTON GROUP g1.

SELECTION-SCREEN COMMENT 12(10) text-004.

*

SELECTION-SCREEN POSITION 22.

PARAMETERS :

rb_3 RADIOBUTTON GROUP g1.

SELECTION-SCREEN COMMENT 24(10) text-005.

SELECTION-SCREEN END OF LINE.

*

PARAMETERS:

rb_4 RADIOBUTTON GROUP g1.

SELECT-OPTIONS:

s_budat FOR afru-budat MODIF ID d1.

SELECTION-SCREEN END OF BLOCK b2.

*Prompt user for custom date

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF rb_4 = '' AND screen-group1 = 'D1'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

plz suggest steps

Thanks

Ganesh

11 REPLIES 11
Read only

Former Member
0 Likes
3,354

Hi,

try this.

AT SELECTION-SCREEN OUTPUT.

If rb_4 eq 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'D1'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

endif.

This works

Read only

GauthamV
Active Contributor
0 Likes
3,354

Try this.



tables : afru.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
*
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
PARAMETERS :
rb_1 RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND chk.
SELECTION-SCREEN COMMENT 3(5) text-003.
*
SELECTION-SCREEN POSITION 10.
PARAMETERS :
rb_2 RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 12(10) text-004.
*
SELECTION-SCREEN POSITION 22.
PARAMETERS :
rb_3 RADIOBUTTON GROUP g1.
SELECTION-SCREEN COMMENT 24(10) text-005.
SELECTION-SCREEN END OF LINE.
*
PARAMETERS:
rb_4 RADIOBUTTON GROUP g1.
SELECT-OPTIONS:
s_budat FOR afru-budat MODIF ID d1.
SELECTION-SCREEN END OF BLOCK b2.

*Prompt user for custom date
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF rb_4 = '' AND screen-group1 = 'D1'.
screen-active = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

at selection-screen on s_budat.

IF rb_4 = 'X' .
if s_budat is initial.
message 'Enter Value for Posting date' type 'I' display like 'E'.
endif.
endif.

Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
3,354

at selection screen.

if s_budat-low is initial and s_budat-high is initial.

error.

endif.

Read only

Former Member
0 Likes
3,354

Hi ganesh,


SELECT-OPTIONS:
s_budat FOR afru-budat obligatory MODIF ID d1.

Regards.

Read only

Former Member
0 Likes
3,354

Hi,

To make the select-option mandatory u can write a validation in at selection-screen on s_budat-low.

AT selection-screen on s_budat-low.

If s_budat[] is initial and rd4 is not initial.

message 'Enter Value For S_BUDAT'

endif.

Hope this resolves your query.

Regards,

Nikhil

Edited by: Nikhil Kayal on May 6, 2009 6:46 AM

Read only

Former Member
0 Likes
3,354

hi,

Use OBLIGATORY in your Select option.

Siva

Read only

0 Likes
3,354

Hi all

When I use obligatory in select options once the if the user radio button it does not allow other radio button to choose...for example if user selects radio button 4 and it shows select option...If the user again want to choose first radio button instead of 4th radio button..obligatory doesnt allow the user to other radio buttons...

Thanks

Ganesh

Read only

0 Likes
3,354

Making select option OBLIGATORY will make this mandatory on the screen.

better try the approach in first raply for this thread.

Read only

Former Member
0 Likes
3,354

Hi,

Just try out the below code.

AT SELECTION-SCREEN OUTPUT.

If rb_4 eq 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'D1'.

screen-required = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

endif.

Regards,

Nikhil

Read only

Former Member
0 Likes
3,354

Hi Ganesh,

Please add the following code to ur program and it works.

start-of-selection.

if not rb_4 is initial.

if s_budat[] is initial.

write:/'message[]'.

exit.

else.

write:/'*required logic'.

endif.

endif.

Thanx,

Anusha

Read only

Former Member
0 Likes
3,354

I solved this using a counter

*Validating the posting date

AT SELECTION-SCREEN ON s_budat.

IF rb_4 = 'X'.

IF gf_cnt EQ '6' AND s_budat-low+4(2) EQ '00'.

MESSAGE text-093 TYPE 'I' DISPLAY LIKE 'E'.

LEAVE LIST-PROCESSING.

STOP.

ENDIF.

ENDIF.

*Prompt user for custom date

AT SELECTION-SCREEN OUTPUT.

CLEAR : gf_cnt,

s_budat[],

s_budat.

LOOP AT SCREEN.

IF screen-name CS 'S_BUDAT'.

IF NOT rb_4 IS INITIAL.

screen-active = 1.

gf_cnt = gf_cnt + 1.

ELSE.

screen-active = 0.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

*