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: 

regarding user command

Former Member
0 Kudos
1,261

PARAMETERS:

p_up RADIOBUTTON GROUP a DEFAULT 'X' USER-COMMAND rb,

p_list RADIOBUTTON GROUP a.

what is the use of USER-COMMAND rb

can any clear my douth....

correct answers can be appriciated by reward points.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
319

Hi srinivasa,

1. what is the use of USER-COMMAND rb

2. Ur code only, little bit enhanced.

(here we can detect the use and difference)

(click on RADIO1 then click on P_UP0

3. Just copy paste

4.

REPORT ABC.

PARAMETERS:

P_UP RADIOBUTTON GROUP A DEFAULT 'X' USER-COMMAND RB,

P_LIST RADIOBUTTON GROUP A.

*----


PARAMETERS:

RADIO1 RADIOBUTTON GROUP B DEFAULT 'X' USER-COMMAND XYZ,

RADIO2 RADIOBUTTON GROUP B.

*----


AT SELECTION-SCREEN.

IF SY-UCOMM IS NOT INITIAL.

MESSAGE SY-UCOMM TYPE 'I'.

ENDIF.

regards,

amit m.

8 REPLIES 8

Former Member
0 Kudos
319

HI,

USER COMMAND will perform actions on radiobutton click.

in radio buttons USER-COMMAND can be used to assign a function code fcode to the first parameter in a radio button group. The function code fcode must be specified directly, and have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure SSCRFIELDS from the ABAP Dictionary must be declared using the statement TABLES. When the user selects any radio button of the radio button group on the selection screen, the runtime environment triggers the event AT SELECTION-SCREEN and transfers the function code fcode to the component ucomm of the interface work area sscrfields.

chk this example first using USER-COMMAND USR

REPORT ABC MESSAGE-ID ZZ.

PARAMETERS : IMPORT RADIOBUTTON GROUP RB USER-COMMAND USR,

EXPORT RADIOBUTTON GROUP RB DEFAULT 'X'.

PARAMETERS : P_MATNR LIKE MARA-MATNR.

AT SELECTION-SCREEN OUTPUT.

IF IMPORT EQ 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME EQ 'P_MATNR'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF EXPORT EQ 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME EQ 'P_MATNR'.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

and then removing user-command , notice the difference

REPORT ABC MESSAGE-ID ZZ.

PARAMETERS : IMPORT RADIOBUTTON GROUP RB

EXPORT RADIOBUTTON GROUP RB DEFAULT 'X'.

PARAMETERS : P_MATNR LIKE MARA-MATNR.

AT SELECTION-SCREEN OUTPUT.

IF IMPORT EQ 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME EQ 'P_MATNR'.

SCREEN-INPUT = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF EXPORT EQ 'X'.

LOOP AT SCREEN.

IF SCREEN-NAME EQ 'P_MATNR'.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Regards,

Priyanka.

former_member196280
Active Contributor
0 Kudos
319

USER-COMMAND ucom

Since all parameters of a radio button group have the same user command, you can only use this addition with the first parameter in the group. The user command is then triggered when you click any button in the group.

If the parameter does not have the RADIOBUTTON GROUP or AS CHECKBOX addition, it must have type Character and length 1. It is then displayed as a checkbox.

Consider the below example it works similar to this

Example

SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 14 LINES.

SELECTION-SCREEN TAB (15) tabs1 USER-COMMAND <b>ucomm1</b>

DEFAULT SCREEN 12.

SELECTION-SCREEN TAB (15) tabs2 USER-COMMAND ucomm2

DEFAULT SCREEN 2000.

SELECTION-SCREEN END OF BLOCK tabb1.

INITIALIZATION.

tabs1 = TEXT-001.

tabs2 = TEXT-002.

AT SELECTION-SCREEN

CASE SSCRFIELDS-UCOMM.

WHEN <b>'UCOMM1'</b>.

tabb1-program = 'SAPLSVAR'.

tabb1-dynnr = 100.

tabb1-activetab = 'TABS2'.

ENDCASE.

Regards,

SaiRam

Former Member
0 Kudos
319

Hi,

USER-COMMAND can be used to assign a function code <b>fcode</b> to the parameter. The function code fcode must be directly specified and may have a maximum length of 20 characters. To evaluate the function code, an interface work area of the structure <b>SSCRFIELDS</b> from the ABAP Dictionary must be declared using the statement <b>TABLES</b>.

When the user selects the checkbox on the selection screen, the runtime environment triggers the event<b> AT SELECTION-SCREEN</b> and transfers the function code <b>fcode</b> to the component <b>ucomm</b> of the interface work area sscrfields. and the selection screen processing is affected accordingly.

Thanks & Regards

Santhosh

Former Member
0 Kudos
319

HI

AT USER-COMMAND event is used in interactive reporting. The code between the AT USER-COMMAND and the ENDAT command is executed when the user enters data into the OK code field(the upper-left entry field on the screen where you enter transactions). The data entered into the OK code field is stored in the system field SY-UCOMM.

Regards,

Padmam.

raymond_giuseppi
Active Contributor
0 Kudos
319

As there is a USER-COMMAND on the whole groups, as soon as the user choice one of the element, the function code associated is raised and control get immediatly back to program in AT-SELECTION SCREEN. Usually this function code is used to set a fkag that is used to active or disactive fileds in the AT SELECTION-SCREEN OUTPUT.

sample :


  PARAMETERS: p_up RADIOBUTTON GROUP a DEFAULT 'X' USER-COMMAND rb,
              p_list RADIOBUTTON GROUP a.

  AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      CASE screen-group1.
        WHEN '01'.
          IF p-up = 'X'.
            screen-active = 1.
          ELSE.
            screen-active = 0.
          ENDIF.
* ...
      ENDCASE.
      MODIFY SCREEN.
    ENDLOOP.

Regards

Former Member
0 Kudos
319

priyanka i can't able to find any difference in o/p's of the program's which u posted with user command and without user command.

can u tell me where the difference occurs.

0 Kudos
319

Hi,

The Screen modification(matnr will be display only when u press import button and will be input mode when you press export button) will not happen if you remove the user command option.Because If you do not set the function for the check box or radio button,then the events like <b>at selection-screen,</b>at selection-screen output will not trigger.Just check it in debugging mode.

Message was edited by:

Vigneswaran S

Former Member
0 Kudos
320

Hi srinivasa,

1. what is the use of USER-COMMAND rb

2. Ur code only, little bit enhanced.

(here we can detect the use and difference)

(click on RADIO1 then click on P_UP0

3. Just copy paste

4.

REPORT ABC.

PARAMETERS:

P_UP RADIOBUTTON GROUP A DEFAULT 'X' USER-COMMAND RB,

P_LIST RADIOBUTTON GROUP A.

*----


PARAMETERS:

RADIO1 RADIOBUTTON GROUP B DEFAULT 'X' USER-COMMAND XYZ,

RADIO2 RADIOBUTTON GROUP B.

*----


AT SELECTION-SCREEN.

IF SY-UCOMM IS NOT INITIAL.

MESSAGE SY-UCOMM TYPE 'I'.

ENDIF.

regards,

amit m.