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: 

*when we use at user -command and give smaple code fro at user-command*

Former Member
0 Kudos
1,903

Hi experts,

i am new to abap can any body tell me when we use AT USER-COMMAND and give a sample code for that.

point will be rewarded.

thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
408

Hi,

AT USER-COMMAND is a list Event.This Event is triggered when user make an action on the Application Toolber Or Menubar.

Here is the Program.

START-OF-SELECTION.

SET PF-STATUS 'TEST'.

WRITE: 'Basic list, SY-LSIND =', sy-lsind.

AT LINE-SELECTION.

WRITE: 'LINE-SELECTION, SY-LSIND =', sy-lsind.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'TEST'.

WRITE: 'TEST, SY-LSIND =', sy-lsind.

ENDCASE.

This program uses a status TEST, defined in the Menu Painter.

Function key F5 has the function code TEST and the text Test for demo.

Function code TEST is entered in the List menu.

The function codes PICK and TEST are assigned to pushbuttons.

The user can trigger the AT USER-COMMAND event either by pressing F5 , or by choosing List -> Test for demo, or by choosing the pushbutton 'Test for demo'.The user can trigger the AT LINE-SELECTION event by selecting a line.

Hopr This Will help You.

Regards,

Sujit

6 REPLIES 6

Former Member
0 Kudos
408

hi,

type "at user-command" in abap editor and press F1. u'll get the help file. it will give u better insights.

regards,

madhu

Former Member
0 Kudos
409

Hi,

AT USER-COMMAND is a list Event.This Event is triggered when user make an action on the Application Toolber Or Menubar.

Here is the Program.

START-OF-SELECTION.

SET PF-STATUS 'TEST'.

WRITE: 'Basic list, SY-LSIND =', sy-lsind.

AT LINE-SELECTION.

WRITE: 'LINE-SELECTION, SY-LSIND =', sy-lsind.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'TEST'.

WRITE: 'TEST, SY-LSIND =', sy-lsind.

ENDCASE.

This program uses a status TEST, defined in the Menu Painter.

Function key F5 has the function code TEST and the text Test for demo.

Function code TEST is entered in the List menu.

The function codes PICK and TEST are assigned to pushbuttons.

The user can trigger the AT USER-COMMAND event either by pressing F5 , or by choosing List -> Test for demo, or by choosing the pushbutton 'Test for demo'.The user can trigger the AT LINE-SELECTION event by selecting a line.

Hopr This Will help You.

Regards,

Sujit

Former Member
0 Kudos
408

Hi Bala,

At User-Command, is list event. When ever user performs some action on the list, i.e, presses a button, double clicks on a line on the list, we can specify what should be the resulting output.

At User-Command is written under AT Line-Selection event.

Hope this Helps you.

Any queries, get back to me.

Award points if helpful.

Regards,

Chandra Sekhar

Former Member
0 Kudos
408

hi

WE use AT USER-COMMAND while dealing with the interactive lists. You first have to set a PF-STATUS in ur code.

AT USER-COMMAND only works with Push Buttons Defined In PF-STATUS.

data:
   val type i value 10.

start-of-selection.
set pf-status 'MAIN'.

AT USER-COMMAND.
case sy-ucomm.
    when 'READ'.
    write:/ 'The Value is ', i.
endcase.

READ is the Function code of a button defined in PF-STATUS MAIN.

reward points if useful.

Sumit Agarwal

Former Member
0 Kudos
408

Hi Buddy,

At-user command is used to catch the users input on the screen.

i.e. if at the screen user have some list output and he wants that after hitting double click or enter at any one record he should get the 2ndry information about that record then he define the concerned logic to display the secondry information in the event at-user command.

suppose u have written a program to display HR related information for a class of students using lists and u want that when u double click on any one record u should get the details about the students academic qualification; you have to code everything for the 2ndry information under at user command event.

basically this event is used to code interactive reports.

also u have got ample amount of study material in previous replies.

hope this serves your problem.

Former Member