‎2007 Jun 04 12:23 PM
hi freinds
what is the diff between at user command and at line selection. can we use both at a time in a interactive reporting.
if yes then which one is triggered first.
‎2007 Jun 04 12:43 PM
HI,
At user-command is used with the user actions on the report.
At line selection is for secoindary lists for your report..
WRITE 'Basic List'.
AT LINE-SELECTION.
WRITE 'Secondary List'.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-lsind.
WHEN 1.
WRITE 'First Secondary List'.
WHEN 2.
WRITE 'Second Secondary List'.
WHEN OTHERS.
WRITE: 'Secondary List, Level:', sy-lsind.
ENDCASE.
ULINE.
at user command will trigger first if not inside the At line selction..
Write a sample code including both the events and run it in debug mode..
Yourself will understand the flow..
rewards if useful,
regards,
nazeer
Message was edited by:
nazeer shaik
‎2007 Jun 04 12:47 PM
Hi,
AT LINE-SELECTION.
Effect
Event in interactive reporting
This event is processed whenever the user chooses a valid line in the list (i.e. a line generated by statements such as WRITE,ULINE, or SKIP) with the cursor and presses the function key which has the function PICK in the interface definition. This should normally be the function key F2, because it has the same effect as double-clicking the mouse, or clicking once in the case of a hotspot.
The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display. If you want the current list display to remain visible (to aid user orientation), you can do this with the key word WINDOW.
In most cases, the information from the selected line is used to retrieve more comprehensive information by direct reading. When displaying the original list, you store the key terms needed for this in the HIDE area of the output line.
AT USER COMMAND is used for interactive processing.
If User clicks any function key, you can write what should be the corresponding processing for it. BACK, EXIT and CANCEL are the standard Function keys.
You can create your own Function keys giving FCODE to them & use them under the event AT-USER COMMAND.
Either of the above is used not both.
Regards,
Priyanka.
‎2007 Jun 04 12:48 PM
<b>At Line-Selection</b>
Event is triggered by either the user double clicking a particular line or using F2 to select it.When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line.
The function code PICK is, by default, always linked with function key F2 and hence with the mouse double-click.
The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display.
<b>At User-Command</b>
Event triggered by user pressing a function key.The current function code is stored in the system field SY-UCOMM
reward if useful.
‎2007 Jun 04 12:48 PM
Hi,
AT LINE-SELECTION.
It is an Event in interactive reporting
This event is processed whenever the user chooses a valid line in the list (i.e. a line generated by statements such as WRITE,ULINE, or SKIP) with the cursor and presses the function key which has the function PICK in the interface definition. This should normally be the function key F2, because it has the same effect as double-clicking the mouse, or clicking once in the case of a hotspot.
The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display. If you want the current list display to remain visible (to aid user orientation), you can do this with the key word WINDOW.
In most cases, the information from the selected line is used to retrieve more comprehensive information by direct reading. When displaying the original list, you store the key terms needed for this in the HIDE area of the output line.
Eg:-
DATA TEXT(20).
START-OF-SELECTION.
PERFORM WRITE_AND_HIDE USING SPACE SPACE.
AT LINE-SELECTION.
CASE TEXT.
WHEN 'List index'.
PERFORM WRITE_AND_HIDE USING 'X' SPACE.
WHEN 'User command'.
PERFORM WRITE_AND_HIDE USING SPACE 'X'.
WHEN OTHERS.
SUBTRACT 2 FROM SY-LSIND.
PERFORM WRITE_AND_HIDE USING SPACE SPACE.
ENDCASE.
CLEAR TEXT.
FORM WRITE_AND_HIDE USING P_FLAG_LSIND P_FLAG_UCOMM.
WRITE / 'SY-LSIND:'.
PERFORM WRITE_WITH_COLOR USING SY-LSIND P_FLAG_LSIND.
TEXT = 'List index'.
HIDE TEXT.
WRITE / 'SY-UCOMM:'.
PERFORM WRITE_WITH_COLOR USING SY-UCOMM P_FLAG_UCOMM.
TEXT = 'User command'.
HIDE TEXT.
IF SY-LSIND > 0.
WRITE / 'PICK here to go back one list level'.
ENDIF.
ENDFORM.
FORM WRITE_WITH_COLOR USING P_VALUE
P_FLAG_POSITIVE.
IF P_FLAG_POSITIVE = SPACE.
WRITE P_VALUE COLOR COL_NORMAL.
ELSE.
WRITE P_VALUE COLOR COL_POSITIVE.
ENDIF.
ENDFORM.
AT USER-COMMAND.
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.
Some functions are executed directly by the system and thus cannot be processed by programs. These include:
PICK
See variant AT LINE-SELECTION
PFn
See variant AT PFn
/...
System command
%...
System command
PRI
BACK
Back
RW
Cancel
P...
Scroll function (e.g.: P+ , P- , PP+3, PS-- etc.)
Instead of this functions, you can use the SCROLL statement in programs.
Since many of these system functions begin with "P", you should avoid using this letter to start your own function codes.
Otherwise, the effect is as for AT LINE-SELECTION; also, the current function code is stored in the system field SY-UCOMM.
Example
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,
Jayant
‎2007 Jun 04 12:51 PM
HI
<b>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.</b>
<b>The AT LINE-SELECTION comand defines the code thats executed after a user double-clicks a line or presses the F2 function key.</b>
<i><b>YES BOTH THE EVENTS CAN BE TRIGGERED IN THE SAME PROGRAM. AT
LINE SELECTION EVENT SELECT THE CURRENT ROW WHICH IS STORED
IN SY-LSIND. IF THE USER DOUBLE CLICK ON THE LINE THE AT
USER COMMAND TRIGERS. THIS CONTAINS THE FUNCTION CODE OF
THE FIELD.NOW YOU CAN CALL LIST SCREN THERE AFTER. SO ITS
MANDATORY BOTH THE EVENTS SHOULD TRIGGER IN ONE PROGRAM.</b></i>
Reward if helpfull
Regards
Pavan
‎2007 Jun 04 12:51 PM
hi
good
AT USER-COMMAND->
the user chooses a function code during list processing that is neither processed by the system, or PICK or PFnn, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:
AT USER-COMMAND.
statements.
In this event block, you can use an IF or CASE structure to differentiate between the function codes. They are available in the system field sy-ucomm. There are further system fields that are filled in list events, such as sy-lsind and sy-pfkey, that allow you to make further case distinctions.
GO THROUGH THIS CODE
Example of AT USER-COMMAND.
REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
START-OF-SELECTION.
WRITE: 'Basic List',
/ 'sy-lsind:', sy-lsind.
TOP-OF-PAGE.
WRITE 'Top-of-Page'.
ULINE.
TOP-OF-PAGE DURING LINE-SELECTION.
CASE sy-pfkey.
WHEN 'TEST'.
WRITE 'Self-defined GUI for Function Codes'.
ULINE.
ENDCASE.
AT LINE-SELECTION.
SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
PERFORM out.
sy-lsind = sy-lsind - 1.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'FC1'.
PERFORM out.
WRITE / 'Button FUN 1 was pressed'.
WHEN 'FC2'.
PERFORM out.
WRITE / 'Button FUN 2 was pressed'.
WHEN 'FC3'.
PERFORM out.
WRITE / 'Button FUN 3 was pressed'.
WHEN 'FC4'.
PERFORM out.
WRITE / 'Button FUN 4 was pressed'.
WHEN 'FC5'.
PERFORM out.
WRITE / 'Button FUN 5 was pressed'.
ENDCASE.
sy-lsind = sy-lsind - 1.
FORM out.
WRITE: 'Secondary List',
/ 'sy-lsind:', sy-lsind,
/ 'sy-pfkey:', sy-pfkey.
ENDFORM.
When you run the program, the system displays the following basic list with a the page header defined in the program:
You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
For each interactive event, the system decreases the sy-lsind system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, sy-lsind still has the value 1.
THANKS
mrutyun^