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

radio button

Former Member
0 Likes
624

Hi,

I need a sample code in which ,once I select a radiobutton , a select option should be made mandatory.

can anyone help.

thanks.

Regards,

Sangeet.

5 REPLIES 5
Read only

Former Member
0 Likes
603

SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.

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

PARAMETER:rad1 RADIOBUTTON GROUP rad USER-COMMAND frad1 DEFAULT 'X',

rad2 RADIOBUTTON GROUP rad .

SELECTION-SCREEN END OF BLOCK b1.

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

PARAMETER: mtr AS CHECKBOX MODIF ID g3 USER-COMMAND chk1,

p_matnr TYPE eban-matnr MODIF ID g1,

sloc AS CHECKBOX MODIF ID g3 USER-COMMAND chk2,

str_loc TYPE eban-lgort MODIF ID g4.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t03.

SELECT-OPTIONS: matnr1 FOR eban-matnr MODIF ID g2.

SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN PUSHBUTTON /20(10) name USER-COMMAND UCOM.

SELECTION-SCREEN END OF SCREEN 100.

name = 'FETCH'.

title = 'Test Report'.

CALL SELECTION-SCREEN '100'.

TYPE-POOLS slis.

AT SELECTION-SCREEN OUTPUT.

IF rad1 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'G1' OR screen-group1 = 'G4'.

screen-active = '1'.

screen-input = 0.

ELSEIF screen-group1 = 'G2'.

screen-active = '0'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ELSEIF rad2 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'G1' OR screen-group1 = 'G4' OR screen-group1 = 'G3' OR screen-group1 = 'G5'.

screen-active = '0'.

ELSEIF screen-group1 = 'G2'.

screen-active = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

IF mtr = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'G1'.

screen-input = 1 .

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

IF sloc = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'G4'.

screen-input = 1 .

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

clear sy-ucomm.

  • iflag = 1.

Regards,

Pavan

Read only

Former Member
0 Likes
603

Hi,

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.

  • Personnel Area

PARAMETERS :p_werks TYPE pa0001-werks OBLIGATORY.

PARAMETERS :rb1 RADIOBUTTON GROUP rad2.

SELECTION-SCREEN END OF BLOCK a1.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN .

IF screen-name = 'P_WERKS' .

IF rb1 = 'X'.

screen-REQUIRED = '1'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Thanbks,

Sutapa

Read only

JayR
Participant
0 Likes
603

Hi Sangeet,

Below is the sample code

REPORT ztest.

TABLES : mara.

PARAMETERS : r1 RADIOBUTTON GROUP g1,

r2 RADIOBUTTON GROUP g1.

SELECT-OPTIONS : S_MATNR FOR mara-matnr.

AT SELECTION-SCREEN output.

IF r2 = 'X'.

LOOP AT SCREEN.

IF screen-name = 'S_MATNR-LOW' or screen-name = 'S_MATNR-HIGH'.

screen-required = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Jai

Read only

Former Member
0 Likes
603

hi,

follow this logic...........

***provides tables wprk area..**

TABLES: kna1. "madatary while working with select-options

        • declaring radio buttons based on your requirement*****

PARAMETERS: R1 RADIOBUTTON GROUP RAD1 DEFAULT 'X',

R2 RADIOBUTTON GROUP RAD1.

***defining select options*****

SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.

****provide the logic in at selection-screen output for changing the screen fields dynamically**

     AT SELECTION-SCREEN OUTPUT.
                 if R1 = 'x' . 
                  LOOP AT SCREEN. "this table holds the data regarding screen fields
         
                     if SCREEN-name1 = 's_kunnr '.
                         SCREEN-active = 1.               "make it active
                         SCREEN-required = 1.            " make it mandatory
                         MODIFY SCREEN.
                     endif.
             ENDLOOP.
             endif.

the above logic work, if you select the radio-button R1 it make the select-options s_kunnr as mandatory in screen......

if you want more fields mandatory based on selecting radio-button follow the above logic.

regards,

Ashok Reddy

Read only

Former Member
0 Likes
603

hi,

TABLES: kna1.

PARAMETERS: R1 RADIOBUTTON GROUP RAD1 DEFAULT 'X',

R2 RADIOBUTTON GROUP RAD1.

SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.

AT SELECTION-SCREEN OUTPUT.

if R1 = 'X' and screen-name = 's_kunnr'.

SCREEN-active = 1. "make it active

SCREEN-required = 1. " make it mandatory

MODIFY SCREEN.

endif.

if helpful reward some points.

with regards,

Suresh Aluri.