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
2,176

Hi all,

how can we make the use of the user command in the radiobutton in the normal ABAP report.

like in module pool we can put case on the sy-ucomm what i can do to perfrom certain action on the radio button on my selection screen.

Regards,

Himanshu

17 REPLIES 17
Read only

Former Member
0 Likes
2,001

hi,

tables spfli.
Parameters:
p_delete radiobutton group rad1 user-command ONLI,
p_record radiobutton group rad1.
select-options:
s_field for spfli-carrid.

AT SELECTION-SCREEN OUTPUT.
IF P_DELETE  EQ 'X'.

REFRESH S_FIELD.
CLEAR S_FIELD.

ENDIF.

Check this sample code, the button delete is click the entries in the selection screen are erased.

Thanks

Sharath

Read only

0 Likes
2,001

but what is the use of user command in this code can you explain a bit.

Read only

0 Likes
2,001

HI,

check this code,

TABLES spfli.
PARAMETERS:
p_show RADIOBUTTON GROUP rad1 USER-COMMAND onli,
p_hide RADIOBUTTON GROUP rad1.

SELECT-OPTIONS:
s_field FOR spfli-carrid MODIF ID grp.

AT SELECTION-SCREEN OUTPUT.
  IF p_hide  EQ 'X'.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'GRP'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

The function code ONLI mentioned aside user-command is the equivalent of F8 in ABAP programming.

So whenever a mouse click operation is performed, the event is triggered.

Read only

0 Likes
2,001

hi,

The main purpose of giving the option USER-COMMAND is that you can assign a function code for your radio button.

Whenever any action performed on the this radio button group, the ucomm of sscrfields table or the SY-UCOMM is field with that valued of function code.

Now its left to you to use standard function codes or your own function codes, in the above post i have used standard function ONLI for function key F8.

Thanks and regards

Sharath

Read only

Former Member
0 Likes
2,001

Hi,

If radio botten - X then you can write logic for user commad.

Reagrds

Md.MahaboobKhan

Read only

Former Member
0 Likes
2,001

Hi,

Parameters:

p_radio1 radiobutton group rad1 user-command usr1,

p_radio2 radiobutton group rad1.

Thanks

Thanks

kalyan

Read only

Former Member
0 Likes
2,000

Hi,

Refer to the following code:

tables:zemp,zmag,zleave.

data: it_emp type standard table of zemp,

wa_emp type zemp,

it_mag type standard table of zmag,

wa_mag type zmag,

it_leave type standard table of zleave,

wa_leave type zleave.

selection-screen begin of block b1.

parameters: semp_id like zemp-id,

rd1 radiobutton group gp1,

rd2 radiobutton group gp1,

rd3 radiobutton group gp1.

select-options: sappldat for zleave-rqstdate.

selection-screen end of block b1.

at selection-screen.

if rd1 = 'X'.

call screen '1001'.

elseif rd2 = 'X'.

call screen '1002'.

endif.

include z_19189leave_status_1001o02.

include z_19189leave_user_command_1i01.

Hope it helps.

Regards

Rajesh Kumar

Read only

Former Member
0 Likes
2,000

Hi Himanshu ,

Please try this code---

PARAMETERS : rd1 RADIOBUTTON GROUP rgb USER-COMMAND usd .
PARAMETERS : rd2 RADIOBUTTON GROUP rgb DEFAULT 'X'.

START-OF-SELECTION.
  IF rd1 = 'X'.
    WRITE : '1st radio button is selected'.
  ELSE.
    WRITE : '2nd radio button is selected'.
  ENDIF.

Regards

Pinaki Mukherjee

Read only

huseyindereli
Active Contributor
0 Likes
2,000

Hi Himanshu ,

Define your radiobuttons with the same group assignment.

PARAMETERS : p_all RADIOBUTTON GROUP rd1 ,

p_none RADIOBUTTON GROUP rd1 .

Then one of the parameter at the group has the value 'X' , the others are set to be initial. And you decide your action as below.

START-OF-SELECTION.

IF p_all = 'X'.

Perform user_selected_all.

ELSEIF p_none = 'X'.

Perform user_selected_none.

ENDIF.

Read only

Former Member
0 Likes
2,000

Hai Sharma,

Kindly search in SDN.

PARAMETER PORDER RADIOBUTTON GROUP G1 DEFAULT 'X' USER-COMMAND COM.
PARAMETER PVENDOR RADIOBUTTON GROUP G1.

PARAMETERS PEBELN LIKE EKKO-EBELN MODIF ID PO.
PARAMETERS PLIFNR LIKE LFA1-LIFNR MODIF ID VEN.

AT SELECTION-SCREEN OUTPUT .

LOOP AT SCREEN .

CHECK SCREEN-GROUP1 = 'PO' OR
SCREEN-GROUP1 = 'VEN'.
IF PORDER = 'X'.
IF SCREEN-GROUP1 EQ 'PO'.
SCREEN-ACTIVE = 1.
ELSEIF SCREEN-GROUP1 EQ 'VEN'.
SCREEN-ACTIVE = 0.
ENDIF.
ELSE.
IF SCREEN-GROUP1 EQ 'VEN'.
SCREEN-ACTIVE = 1.
ELSEIF SCREEN-GROUP1 EQ 'PO'.
SCREEN-ACTIVE = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

I hope the above code will help you..

Regards,

Harish

Read only

Former Member
0 Likes
2,000

Hi,

you can use the following statement..

tables:
sscrfields.


at selection-screen.
case sscrfields-ucomm.
when 'RAD1'.    " where RAD1 is the user-command of the radio button.
"   processing steps.....
when 'RAD2'.
" processing steps..........
endcase.

Regards,

Siddarth

Read only

Former Member
0 Likes
2,000

HI,

Get the radio Button with the help of parameter on the screen

and then use them directly without user command.

I have not tried so m not sure with it, try and see.

Read only

Former Member
0 Likes
2,000

Hi

You can declare radiobutton as

Parameters:

p_rad like radiobutton group r1 user-command onli.

Regards,

Rajani

Read only

Former Member
0 Likes
2,000

Selection-screen begin of block a1 with frame.

Parameters:

group1 radiobutton group radi user-command abc

default 'X',

group2 radiobutton group radi.

Selection-screen end of block a1.

The USER-COMMAND statement is used to assign a function code 'abc' to the first parameter in a radio button group. To evaluate this function code, SSCRFIELDS structure is refered from the ABAP Dictionary When the user selects any radio button of the radio button group on the selection screen, AT SELECTION-SCREEN event is triggered and transfers the function code 'abc' to SSCRFIELDS structure.

Regards,

Joan

Read only

Former Member
0 Likes
2,000

PARAMETERS:

p_show RADIOBUTTON GROUP rad1 USER-COMMAND onli,

p_hide RADIOBUTTON GROUP rad1.

start-of-selection.

if p_show = 'X' .

do this .

else .

do this.

endif.

Read only

awin_prabhu
Active Contributor
0 Likes
2,000

Hi friend,

For use of user command in the radiobutton, see below report.

REPORT zassigncheck .

PARAMETERS: c1 radiobutton group a USER-COMMAND ucom,

c2 radiobutton group a ,

c3 radiobutton group a .

PARAMETERS: p1(5) MODIF ID ab,

p2(5) MODIF ID ab1,

p3(5) MODIF ID ab2.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF c1 = 'X'.

IF screen-name = 'P1'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF c2 = 'X'.

IF screen-group1 = 'AB1'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

IF c3 = 'X'.

IF screen-group1 = 'AB2'.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

Might be helpful.

Thanks..

Read only

Former Member
0 Likes
2,000

Hi Himanshu,

Go through the following code. Radio button has been implemented using user-command.

REPORT  ZRAJRADIOTEST2.


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS: P1 TYPE C RADIOBUTTON GROUP GRP1 USER-COMMAND U_SEL DEFAULT 'X'.
PARAMETERS: S_ORDER TYPE VBAK-VBELN.
PARAMETERS: P2 TYPE C RADIOBUTTON GROUP GRP1.
PARAMETERS: P_ORDER TYPE EKKO-EBELN.

SELECTION-SCREEN END OF BLOCK B1.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF SCREEN-NAME = 'S_ORDER'.
      IF P1 = 'X'.
        SCREEN-ACTIVE = '1'.
      ELSE.
        SCREEN-ACTIVE = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.

    IF SCREEN-NAME = 'P_ORDER'.
      IF P2 = 'X'.
        SCREEN-ACTIVE = '1'.
      ELSE.
        SCREEN-ACTIVE = '0'.
      ENDIF.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Basically you just need to declare user-command(nothing more needs to be done) based on which the selection screen will change it on selection of the specific radio button. Execute the code and you will understand.