17 Flares Twitter 0 Facebook 17 Google+ 0 LinkedIn 0 Email -- Pin It Share 0 17 Flares ×

Radio button is a type of graphical user interface element that allows the users to select one option from set of options at a time.

You can create radio button on selection screen by using the parameters statement in SAP.

Syntax:

PARAMETRES : <RADIOBUTTION NAME>  RADIO BUTTON GROUP <RADIO BUTTION GROUP>.

Ex:

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-100.
*//check box creation
PARAMETERS:P_rad1 RADIOBUTTON GROUP rg1,
p_chk2 RADIOBUTTON GROUP rg1.
SELECTION-SCREEN END OF BLOCK blk1.

Output:

Radio Buttions1By default system will select one radio button

ABAP Program With Radio Buttons:

*&———————————————————————*
*& Report  ZRADIO_BUTTON_ON_SEL_SCREEN
*&
*&———————————————————————*
*&
*&
*&———————————————————————*

REPORT ZRADIO_BUTTON_ON_SEL_SCREEN.

*//Tables declaration
tables : mara,vbak.

*//Types declaration for MARA
types : begin of ty_mara,
matnr type matnr,
ERSDA  TYPE ERSDA,
ERNAM  TYPE ERNAM,
LAEDA  TYPE LAEDA,
AENAM  TYPE AENAM,
end of ty_mara.

*//Types declaration for VBAK
types : begin of ty_vbak,
VBELN  TYPE VBELN_VA,
ERDAT  TYPE ERDAT,
ERZET  TYPE ERZET,
end of ty_vbak.

*//Internal table declaration
data : lt_mara type table of ty_mara,
lt_vbak type table of ty_vbak.

*//Work area declaration
data : wa_mara type ty_mara,
wa_vbak type ty_vbak.

*//Selection screen design
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-s02.
select-options:s_matnr for mara-matnr modif id SC1,
s_vbeln for vbak-vbeln modif id SC2.
SELECTION-SCREEN END OF BLOCK blk1.

*//Radio button design
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-s01.
*//Radio buttons design
parameters: p_rad1 radiobutton group grp1,
p_rad2 radiobutton group grp1.
SELECTION-SCREEN END OF BLOCK blk2.

start-of-selection.
*//Retriving data from MARA
if p_rad1 eq ‘X’.
if s_matnr is not initial.
select matnr ersda ernam laeda aenam
from mara
into table lt_mara
where matnr in s_matnr.
else.
message ‘Enter material number’ type ‘E’.
endif.
if lt_mara is not initial.
*//Displaying output
loop at lt_mara into wa_mara.
write :/ wa_mara-matnr, wa_mara-ersda,wa_mara-ernam, wa_mara-laeda,wa_mara-aenam.
endloop.
else.
message ‘NO DATA’ type ‘I’.
endif.
elseif p_rad2 eq ‘X’.
if s_vbeln is not initial.
select vbeln erdat erzet
from vbak
into table lt_vbak
where vbeln in s_vbeln.
else.
message ‘Enter sales order number’ type ‘E’.
endif.
if lt_vbak is not initial.
*//Displaying output
loop at lt_vbak into wa_vbak.
write :/ wa_vbak-vbeln, wa_vbak-erdat,wa_vbak-erzet.
endloop.
else.
message ‘NO DATA’ type ‘I’.
endif.
endif.

Output:

Radio Buttions

 

Enjoy 🙂

Also Read:

Dynamic selection screen in SAP ABAP.

Creating Pushbuttons on Selection Screen.

Table Maintenance without using SE11 and SE30 Transaction Codes.

17 Flares Twitter 0 Facebook 17 Google+ 0 LinkedIn 0 Email -- Pin It Share 0 17 Flares ×