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: 

using radio buttons

Former Member
0 Kudos

Hi all, I need a selection screen with 2 radio buttons.when i click on first,selection screen for report one should b displayed and on selection of second ,other selection screen should b displayed.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

U will findout the example in ABAPDOCU

See the program

DEMO_SEL_SCREEN_WITH_SUBSCREEN

9 REPLIES 9

Former Member
0 Kudos

U will findout the example in ABAPDOCU

See the program

DEMO_SEL_SCREEN_WITH_SUBSCREEN

Former Member
0 Kudos

Hi Nujhat,

do the following

PARAMETERS : p_local RADIOBUTTON GROUP 1 MODIF ID m1,

p_unix RADIOBUTTON GROUP 1 MODIF ID m1.

so u can use

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF screen-group1 = 'M1'.

  • Activate ur fields

MODIFY SCREEN.

ENDIF.

ENDLOOP.

-Anu.

Former Member
0 Kudos

Hi,

&----


*& Report ZLAXMI_ALVEXER1 *

*& *

&----


*& NAME : VENKATA LAXMI *

*& DATE : 24-02-2006 *

*& PROGRAM TO PRINT THE REPORT IN ALV LIST FORMAT AND GRID FORMAT *

&----


report zlaxmi_alvexer1 message-id zz .

&----


*& TABLES DECLARATION *

&----


tables:lfa1, lfb1, lfm1.

&----


*& TYPE POOLS DECLARATION *

&----


type-pools: slis.

&----


*& INTERNAL TABLE DECLARATION *

&----


data: begin of itab occurs 0,

lifnr like lfa1-lifnr, " VENDOR

bukrs like lfb1-bukrs, " COMPANY CODE

ekorg like lfm1-ekorg, " PURCHASING ORG

ktokk like lfa1-ktokk, " ACCOUNT GROUP

name1 like lfa1-name1, " VENDOR NAME

stras like lfa1-stras, " STREET

ort01 like lfa1-ort01, " CITY

regio like lfa1-regio, " REGION

pfort like lfa1-pfort, " PO BOX

pstlz like lfa1-pstlz, " PO CODE

pstl2 like lfa1-pstl2, " PO ZIP

telf1 like lfa1-telf1, " TELEPHONE

end of itab.

*INTERNAL TABLE FOR FIELD CATALOG

data: it_fieldcat type standard table of slis_fieldcat_alv

with header line,

*INTERNAL TABLE FOR EVENTS

it_event type slis_t_event,

wa_event type slis_alv_event,

*INTERNAL TABLE FOR SORTING

it_sort type slis_t_sortinfo_alv,

wa_sort type slis_sortinfo_alv,

*INTERNAL TABLE FOR LAYOUT

wa_layout type slis_layout_alv.

&----


*& VARIABLE DECLARATION *

&----


data : v_repid type sy-repid,

v_pagno(4) type n,

v_date(8) type c.

&----


*& CONSTANTS *

&----


constants: c_x type c value 'X'.

&----


*& SELECTION SCREEN *

&----


selection-screen: begin of block b1 with frame title text-001.

select-options: s_lifnr for lfa1-lifnr,

s_bukrs for lfb1-bukrs,

s_ekorg for lfm1-ekorg,

s_ktokk for lfa1-ktokk.

selection-screen: end of block b1.

selection-screen: begin of block b2 with frame title text-002.

selection-screen : begin of line.

selection-screen comment 1(20) text-003.

parameters: p_list radiobutton group rad1 default 'X'.

selection-screen : end of line.

selection-screen : begin of line.

selection-screen comment 1(20) text-004.

parameters: p_grid radiobutton group rad1.

selection-screen : end of line.

selection-screen: end of block b2.

&----


*& AT SELECTION SCREEN *

&----


at selection-screen.

perform validate_screen.

&----


*& START OF SELECTION *

&----


start-of-selection.

clear: itab, itab[].

v_repid = sy-repid.

perform get_data.

&----


*& END OF SELECTION *

&----


end-of-selection.

*--DO ALV Process

v_repid = sy-repid.

*--Sort the Output Fields

perform sort_fields.

*--Build Field catalog for the Output fields

perform build_fieldcat.

*--Set the Layout for ALV

perform set_layout.

&----


*& Form GET_DATA

&----


  • text

----


  • TO GET THE DATA FROM TABLES INTO ITAB

----


form get_data .

select

a~lifnr

b~bukrs

c~ekorg

a~ktokk

a~name1

a~stras

a~ort01

a~regio

a~pfort

a~pstlz

a~pstl2

a~telf1

into table itab

from lfa1 as a join lfb1 as b

on alifnr = blifnr

join lfm1 as c

on alifnr = clifnr

where a~lifnr in s_lifnr and

b~bukrs in s_bukrs and

c~ekorg in s_ekorg and

a~ktokk in s_ktokk.

endform. " GET_DATA

&----


*& Form validate_screen

&----


form validate_screen .

data: lv_lifnr like lfa1-lifnr,

lv_bukrs like lfb1-bukrs,

lv_ekorg like lfm1-ekorg,

lv_ktokk like lfa1-ktokk.

if not s_lifnr[] is initial.

select lifnr

up to 1 rows

into lv_lifnr

from lfa1

where lifnr in s_lifnr.

endselect.

if sy-subrc <> 0.

message e000 with 'Invalid vendor'(005).

endif.

endif.

if not s_bukrs is initial.

select bukrs

up to 1 rows

into lv_bukrs

from t001

where bukrs in s_bukrs.

endselect.

if sy-subrc <> 0.

message e000 with 'Invalid company code'(006).

endif.

endif.

if not s_ekorg is initial.

select ekorg

up to 1 rows

into lv_ekorg

from t024e

where ekorg in s_ekorg.

endselect.

if sy-subrc <> 0.

message e000 with 'Invalid purchasing org'(007).

endif.

endif.

if not s_ktokk is initial.

select ktokk

up to 1 rows

into lv_ktokk

from t077k

where ktokk in s_ktokk.

endselect.

if sy-subrc <> 0.

message e000 with 'Invalid acct group'(008).

endif.

endif.

endform. " validate_screen

&----


*& Form sort_fields

&----


form sort_fields .

clear wa_sort.

wa_sort-fieldname = 'LIFNR'.

wa_sort-spos = '1'.

wa_sort-up = 'X'.

append wa_sort to it_sort.

clear wa_sort.

wa_sort-fieldname = 'BUKRS'.

wa_sort-spos = '2'.

wa_sort-up = 'X'.

append wa_sort to it_sort.

clear wa_sort.

wa_sort-fieldname = 'EKORG'.

wa_sort-spos = '3'.

wa_sort-up = 'X'.

append wa_sort to it_sort.

endform. " sort_fields

&----


*& Form build_fieldcat

&----


form build_fieldcat .

it_fieldcat-col_pos = '1'.

it_fieldcat-fieldname = 'LIFNR'.

it_fieldcat-key = 'X'.

it_fieldcat-outputlen = '10'.

it_fieldcat-seltext_l = 'VENDOR'(009).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '2'.

it_fieldcat-fieldname = 'BUKRS'.

it_fieldcat-key = 'X'.

it_fieldcat-outputlen = '4'.

it_fieldcat-seltext_l = 'COMPANY CODE'(010).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '3'.

it_fieldcat-fieldname = 'EKORG'.

it_fieldcat-key = 'X'.

it_fieldcat-outputlen = '4'.

it_fieldcat-seltext_l = 'PURCHASING ORG'(011).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '4'.

it_fieldcat-fieldname = 'KTOKK'.

it_fieldcat-outputlen = '4'.

it_fieldcat-seltext_l = 'ACCOUNT GRP'(012).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '5'.

it_fieldcat-fieldname = 'NAME1'.

it_fieldcat-outputlen = '12'.

it_fieldcat-seltext_l = 'VENDOR NAME'(013).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '6'.

it_fieldcat-fieldname = 'STRAS'.

it_fieldcat-outputlen = '12'.

it_fieldcat-seltext_l = 'STREET'(014).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '7'.

it_fieldcat-fieldname = 'ORT01'.

it_fieldcat-outputlen = '12'.

it_fieldcat-seltext_l = 'CITY'(015).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '8'.

it_fieldcat-fieldname = 'REGIO'.

it_fieldcat-outputlen = '2'.

it_fieldcat-seltext_l = 'REGION'(016).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '9'.

it_fieldcat-fieldname = 'PFORT'.

it_fieldcat-outputlen = '10'.

it_fieldcat-seltext_l = 'PO BOX'(017).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '10'.

it_fieldcat-fieldname = 'PFTLZ'.

it_fieldcat-outputlen = '10'.

it_fieldcat-seltext_l = 'POST CODE'(018).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '11'.

it_fieldcat-fieldname = 'PSTL2'.

it_fieldcat-outputlen = '10'.

it_fieldcat-seltext_l = 'PO ZIP'(019).

append it_fieldcat.

clear it_fieldcat.

it_fieldcat-col_pos = '12'.

it_fieldcat-fieldname = 'TELF1'.

it_fieldcat-outputlen = '16'.

it_fieldcat-seltext_l = 'TELEPHONE'(020).

append it_fieldcat.

clear it_fieldcat.

endform. " build_fieldcat

&----


*& Form set_layout

&----


form set_layout .

if p_list = c_x .

wa_layout-window_titlebar = 'LIST DISPLAY'(021).

*-- ALV LIST DISPLAY

perform list_display tables itab.

*-- ALV GRID DISPLAY

elseif p_grid = c_x.

wa_layout-window_titlebar = 'GRID DISPLAY'(022).

perform grid_display tables itab.

endif.

endform. " set_layout

&----


*& Form list_display

&----


form list_display tables p_itab .

call function 'REUSE_ALV_LIST_DISPLAY'

exporting

i_callback_program = v_repid

is_layout = wa_layout

it_fieldcat = it_fieldcat[]

it_sort = it_sort[]

tables

t_outtab = itab

exceptions

program_error = 1

others = 2.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " list_display

&----


*& Form GRID_DISPLAY

&----


form grid_display tables p_itab .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

i_callback_program = v_repid

is_layout = wa_layout

it_fieldcat = it_fieldcat[]

it_sort = it_sort[]

it_events = it_event

tables

t_outtab = itab

exceptions

program_error = 1

others = 2

.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endform. " GRID_DISPLAY

Regards,

Laxmi.

Former Member
0 Kudos

Try like this...

Parameters: p_1 radiobutton group r1 default 'X' user-command 123 modif id m1,

p_2 radiobutton group r2 default 'X' user-command u1 modif id m2.

give the first screen values with an addition of modif id m1 and second screen with modif id m2.

at selection-screen output.

if p_1 = 'X'.

loop at screen.

if screen-group1 = 'M1'.

screen-input = '0'.

screen-invisible = '1'.

modify screen.

endif.

endloop.

elseif p_2 = 'X'.

loop at screen.

if screen-group1 = 'M2'.

screen-input = '0'.

screen-invisible = '1'.

modify screen.

endif.

endloop.

endif.

Madhavi

Former Member
0 Kudos

Hi

Try this sample code..and reward if helpful.

PARAMETERS: RAD1 RADIOBUTTON GROUP RAD1 USER-COMMAND RAD,

RAD2 RADIOBUTTON GROUP RAD1.

LOOP AT SCREEN.

IF RAD1 = 'X'.

WRITE:/ 'FIRST REPORT LOGIC'.

ELSE.

WRITE:/ 'SECOND REPORT LOGIC'.

ENDIF.

ENDLOOP.

cheers

Badri

Former Member
0 Kudos

HI Nujat,

  • Selection Screen

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

PARAMETERS : rb_pc RADIOBUTTON GROUP r1 DEFAULT 'X'

USER-COMMAND ucomm, "For Presentation

p_f1 LIKE rlgrap-filename

MODIF ID rb1, "Input File

rb_srv RADIOBUTTON GROUP r1, "For Application

p_f2 LIKE rlgrap-filename

MODIF ID rb2, "Input File

p_direct TYPE char128 MODIF ID abc DEFAULT c_path.

"File directory

SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF rb_pc = c_x AND screen-group1 = 'RB2'.

screen-input = '0'.

MODIFY SCREEN.

ELSEIF rb_srv = c_x AND screen-group1 = 'RB1'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

IF screen-group1 = 'ABC'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Also Check out the std program:

DEMO_SEL_SCREEN_AS_SUBSCREEN

DEMO_SEL_SCREEN_WITH_SUBSCREEN

Reward points if this helps.

Manish

Message was edited by: Manish Kumar

Former Member
0 Kudos

Hi,

You can see give sample.

When first radio button is selected then process your first option. Fetch data and display in output.

When second readio button is created then call other report by SUBMIT which will take you to desired selection screen.

SELECTION-SCREEN BEGIN OF BLOCK block

WITH FRAME.

PARAMETERS : pr1 radiobutton group rb1,

pr2 radiobutton group rb1.

SELECTION-SCREEN END OF BLOCK block.

START-OF-SELECTION.

IF pr1 = 'X'.

WRITE / 'First radio button selected'.

ELSEIF pr2 = 'X'.

WRITE / 'Second radio button selected'.

ENDIF.

*REWARD if this helps.

Former Member
0 Kudos

hi Nujhat ,

just execute this code .

hope this helps ,

regards,

Vijay.

-


tables: kna1, lfa1.

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

PARAMETERS : rad1 TYPE c RADIOBUTTON GROUP g1 DEFAULT 'X'

USER-COMMAND com1,

rad2 TYPE c RADIOBUTTON GROUP g1.

select-options: kunnr for kna1-kunnr MODIF ID p1,

lifnr for lfa1-lifnr modif id d1.

  • End of Insert

SELECTION-SCREEN END OF BLOCK b2.

*----


*

  • Selection Screen Output

*----


*

AT SELECTION-SCREEN OUTPUT.

IF rad1 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'D1'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

IF screen-group1 = 'P1'.

screen-input = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

IF rad2 = 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'P1'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

IF screen-group1 = 'D1'.

screen-input = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Former Member
0 Kudos

Hi Just follow this way.

SELECTION-SCREEN BEGIN OF BLOCK rad1 WITH FRAME TITLE text-003.

selection-screen begin of line.

SELECTION-SCREEN POSITION 11.

SELECTION-SCREEN COMMENT 1(12) text-004 modif id mg1.

parameters p_verfr(10) type c modif id mg1.

SELECTION-SCREEN POSITION 41.

SELECTION-SCREEN COMMENT 35(16) text-005 modif id mg1.

parameters p_verto(10) type c modif id mg1.

selection-screen end of line.

selection-screen skip 1.

selection-screen begin of line.

SELECTION-SCREEN POSITION 11.

SELECTION-SCREEN COMMENT 1(22) text-008 modif id mg2.

Parameters : p_seldel(10) type c modif id mg2.

selection-screen end of line.

selection-screen skip 4.

selection-screen begin of line.

SELECTION-SCREEN POSITION 11.

SELECTION-SCREEN COMMENT 1(10) text-001.

PARAMETERS : P0 RADIOBUTTON GROUP RADI user-command ABCD.

SELECTION-SCREEN POSITION 41.

SELECTION-SCREEN COMMENT 35(16) text-002.

PARAMETERS : P1 RADIOBUTTON GROUP RADI default 'X'.

selection-screen end of line.

SELECTION-SCREEN end OF BLOCK rad1.

data: v_chk.

at selection-screen.

if sy-ucomm = 'ABCD'.

v_chk = 'X'.

endif.

***********************************************************************************

AT SELECTION-SCREEN OUTPUT.

if v_chk = 'X'.

loop at screen.

IF P0 = 'X'.

if SCREEN-GROUP1 = 'MG2'.

screen-input = 0.

screen-active = 0.

ENDIF.

elseif P1 = 'X'.

if SCREEN-GROUP1 = 'MG1'.

screen-input = 0.

screen-active = 0.

ENDIF.

endif.

modify screen.

endloop.

ENDIF.

Regs

Rams

Message was edited by: ramesh