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: 

Radion button validation

Former Member
0 Kudos

Hello friends,

I have two radio buttons on screen, fields enabled on the basis of radio button selection.

I add the logice for this in at selection screen output.First time it is working fine but when i am selecting another rodio button it is going to start-of-selection not at at selection screen output .

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-004.

*For defining radio-buttons

PARAMETERS: r1 RADIOBUTTON GROUP rad1 USER-COMMAND onli default 'X',

r2 RADIOBUTTON GROUP rad1.

SELECT-OPTIONS:

s_mail FOR but000-partner,

s_veh FOR but000-partner,

s_driver FOR but000-partner.

"s_arch FOR sy-datum.

PARAMETERS:p_arch LIKE sy-datum. "OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

*Enable/Disable Fields

PERFORM visiblity_driver_vehicle.

Not able to find where i am wrong

13 REPLIES 13

Former Member
0 Kudos

HI,

Use modifid:

Sample Codes:

Selection-screen begin of block b1.
Parameters:
Field1 modifid aa,
Field2 modifid ab,
Field3 modifid ac.
Selection-screen End of block b1 .

Parameters: R1 radiobutton group rd1 default 'X' user-command ucomm,
                  R2 radiobutton group rd1.

at selection-screen output.
Loop at screen.
If R2 = 'X'.
If Screen-group1 = 'AB'.
Screen-active = 0.
endif.
endif.

If R1 = 'X'.
If Screen-group1 = 'AA'.
Screen-active = 0.
endif.
endif.

modify screen.

endloop.

Hope this will hep you

Regards,

GP

0 Kudos

facing the same problem on second time selection of radio button it is going to start-of-selection.

0 Kudos

hi,

you can use this to get .

at selection-screen output.

Loop at screen.

If Rad2 = 'X'.

If Screen-group1 = 'group1'.

Screen-active = 0.

endif.

endif.

If R1 = 'X'.

If Screen-group1 = 'group2'.

Screen-active = 0.

endif.

endif.

modify screen.

endloop.

Regards

Rajendra

Former Member
0 Kudos

Hi Shilpi,

Please paste the code of the subroutine PERFORM visiblity_driver_vehicle too, so that we can help you.

Regards,

Swapna.

0 Kudos

LOOP AT SCREEN.

IF r1 = 'X'.

  • IF screen-name = 'S_VEH-HIGH' OR screen-name = 'S_VEH-LOW'.

IF screen-group1 = 'AB'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF r2 = 'X'.

  • IF screen-name = 'S_DRIVER-HIGH' OR screen-name = 'S_DRIVER-LOW'.

IF screen-group1 = 'AA'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

0 Kudos

The fields which should be active for radio button R1 should be given the modif ID as SC1 and for the fields which should be active for radio button R2 should be given the modif ID as SC2 while declaration.

Try to modify the code in this way:

IF r1 = 'X'.
    LOOP AT SCREEN.
      IF  screen-group1 = 'SC2'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.                           
    ENDLOOP.                           
  ELSE.
    LOOP AT SCREEN.
      IF  screen-group1 = 'SC1'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.                           
    ENDLOOP.                          
  ENDIF.

Regards,

Swapna.

kamesh_g
Contributor
0 Kudos

HI

Why you are using at selection screen output .

use the below code .

START-OF-SELECTION.

IF r1 = 'X'.

PERFORM foreground.

ELSEIF r2 = 'X'.

PERFORM background.

ENDIF.

Former Member
0 Kudos

hi,

Radiobutton (inc desc) and entry field on same line of selection screen.

*ABAP code

SELECTION-SCREEN BEGIN OF BLOCK out WITH FRAME TITLE text-s01.

selection-screen begin of line.

parameters: p_type radiobutton group grp1.

selection-screen comment 4(15) text-010 for field p_type.

selection-screen position pos_low.

parameters: p_tinput like p2001-awart.

selection-screen end of line.

selection-screen begin of line.

parameters: p_reason radiobutton group grp1.

selection-screen comment 4(17) text-010 for field p_reason.

selection-screen position pos_low.

parameters: p_rinput like p2001-umsch.

selection-screen end of line.

SELECTION-SCREEN END OF BLOCK out.

Checkbox (inc desc) and entry field on same line of selection screen.

*Abap code

SELECTION-SCREEN BEGIN OF BLOCK out WITH FRAME TITLE text-s01.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: p_filchk AS CHECKBOX.

SELECTION-SCREEN COMMENT 4(17) text-s02 FOR FIELD p_filchk.

SELECTION-SCREEN POSITION POS_LOW.

PARAMETERS: p_file LIKE rlgrap-filename.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK out.

Two radios buttons on same line of selection screen.

SELECTION-SCREEN BEGIN OF BLOCK out WITH FRAME TITLE text-s01.

selection-screen begin of line.

parameters: p_and radiobutton group grp1.

selection-screen comment 4(5) text-010 for field p_and.

parameters: p_or radiobutton group grp1.

selection-screen comment (5) text-011 for field p_or.

selection-screen end of line.

SELECTION-SCREEN END OF BLOCK out.

Two entry fields plus comments on same line of selection screen.

SELECTION-SCREEN BEGIN OF BLOCK out WITH FRAME TITLE text-s01.

selection-screen begin of line.

selection-screen comment 1(7) text-su9. u201Csu9 = Clerk

parameters: p_clerk1 LIKE knb1-busab OBLIGATORY DEFAULT u201851u2032.

selection-screen comment 15(19) text-su1. u201Csu1 = Surname begins with

parameters: p_cstr1(20) type c OBLIGATORY DEFAULT u2018ABCDu2019.

selection-screen end of line.

SELECTION-SCREEN END OF BLOCK out.

check with this code.

Regards,

N.Neelima.

kamesh_g
Contributor
0 Kudos

hi

As youo are using same block

use the following code .

AT SELECTION-SCREEN ON BLOCK b2.

IF p_chkbox = 'X' AND p_file1 IS INITIAL.

MESSAGE e000.

ENDIF.

IF p_chkbox = '' AND ( NOT p_file1 IS INITIAL ).

MESSAGE e002.

ENDIF.

IF p_chkbox = 'X' AND ( NOT s_ebeln IS INITIAL ).

MESSAGE e001.

ENDIF.

Former Member
0 Kudos

Hi,

at selection-screen output.

loop at screen.

if R1 = 'X'.

if screen-group1 = 'RAD1'.

screen-active = 1.

modify screen.

endif.

else.

if R2 = 'X'.

if screen-group1 = 'RAD1'.

screen-active = 0.

modify screen.

endif.

endif.

endloop.

Regards,

jaya

Former Member
0 Kudos

Hi,

try this.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-004.

PARAMETERS: r1 RADIOBUTTON GROUP rad1 default 'X' USER-COMMAND UCOM ,

r2 RADIOBUTTON GROUP rad1.

SELECT-OPTIONS:

s_mail FOR but000-partner modif id D1,

s_veh FOR but000-partner modif id D1,

s_driver FOR but000-partner modif id D2,

s_arch FOR sy-datum modif id D2.

PARAMETERS:p_arch LIKE sy-datum.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

if r1 eq 'X'.

loop at screen.

if screen-group1 CS 'D2'.

screen-active = 0.

modify screen.

endif.

endloop.

else.

loop at screen.

if screen-group1 CS 'D1'.

screen-active = 0.

modify screen.

endif.

endloop.

endif.

Former Member
0 Kudos

solved on my own

Former Member
0 Kudos
tables:
but000.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-004.

*For defining radio-buttons
PARAMETERS: r1 RADIOBUTTON GROUP rad1 USER-COMMAND onli default 'X',
r2 RADIOBUTTON GROUP rad1.

SELECT-OPTIONS:
s_mail FOR but000-partner ,
s_veh FOR but000-partner modif id AB,
s_driver FOR but000-partner modif id AA.
"s_arch FOR sy-datum.

PARAMETERS:p_arch LIKE sy-datum. "OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.
*Enable/Disable Fields
LOOP AT SCREEN.
IF r1 = 'X'.

*    * IF screen-name = 'S_VEH-HIGH' OR screen-name = 'S_VEH-LOW'.

IF screen-group1 = 'AB'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
IF r2 = 'X'.

*    * IF screen-name = 'S_DRIVER-HIGH' OR screen-name = 'S_DRIVER-LOW'.

IF screen-group1 = 'AA'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.