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

USER_COMMAND

Former Member
0 Likes
529

Hi can any body tell me wht is the purpose of function module USER_COMMAND.

thanks in advance

kp

3 REPLIES 3
Read only

Former Member
0 Likes
488

Hi,

Event in interactive reporting

This event is executed whenever the user presses a function key in the list or makes an entry in the command field.

DATA: NUMBER1 TYPE I VALUE 20,

NUMBER2 TYPE I VALUE 5,

RESULT TYPE I.

START-OF-SELECTION.

WRITE: / NUMBER1, '?', NUMBER2.

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'ADD'.

RESULT = NUMBER1 + NUMBER2.

WHEN 'SUBT'.

RESULT = NUMBER1 - NUMBER2.

WHEN 'MULT'.

RESULT = NUMBER1 * NUMBER2.

WHEN 'DIVI'.

RESULT = NUMBER1 / NUMBER2.

WHEN OTHERS.

WRITE 'Unknown function code'.

EXIT.

ENDCASE.

WRITE: / 'Result:', RESULT.

After entry of a function code, the appropriate processing is performed under the event AT USER-COMMAND and the result is displayed in the details list.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
488

Hello,

USER_COMMAND is a function module in the PAI of the flow logic.Basically it is used to write the logic when the user presses a self created push button in the menu bar or the application bar.In the PF-status(in the PBO-Process before output-of the screen),you can define push buttons of your choice like SAVE,EXIT,BACK.

When the user clicks on any one of them,say BACK,he would expect the flow to traverse to the previous screen.The logic for this to happen is written in USER_COMMAND as it is the PAI-process after input-module .

<b>PAI of the screen:</b>

Module user_command.

Case ok_code.

When 'BACK'.

leave to screen 0.

When 'EXIT.

leave program.

endcase.

(ok_code is defined in the top declaration as

DATA:ok_code type sy-ucomm.)

Regards,

Beejal

**reward if this helps

Read only

Former Member
0 Likes
488

hi,

User-command is an event under interactive report.

AT USER-COMMAND.

case sy-ucomm.

when 'disp'.

select * from mara.

write:/ mara-matnr.

endselect.

when the user selects the menu item or presses any function key the event that is

triggered is at user-command and can handle in the program by writting the code.

the system variable sy-ucomm stores the function code for the clicked menu item or for the function key and same can be checked in the program.