2006 Nov 27 8:21 AM
Hi friends,
Can we use both those events at a time in report?
If so can any body provide me sample code?
Regards
2006 Nov 27 8:23 AM
Hi
AT LINE-SELECTION is the event linked only to DOUBLECLICK:
START-OF-SELECTION.
DO 10 TIMES.
WRITE: / 'line:', SY-INDEX.
ENDDO.
AT LINE-SELECTION.
CHECK NOT SY-LISEL IS INITIAL.
WRITE: SY-LISEL.AT USER-COMMAND is the event linked to any command, defined in own status, made by user in ABAP LIST.
START-OF-SELECTION.
SET PF-STATUS 'MY_STATUS'.
DO 10 TIMES.
WRITE: / 'line:', SY-INDEX.
ENDDO.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN '%PICK'.
CHECK NOT SY-LISEL IS INITIAL.
WRITE: SY-LISEL.
ENDCASE.In my sample I used the USER-COMMAND for the same purpose of AT LINE-SELECTION, infact AT LINE-SELECTION is triggered only if the <b>OK-CODE is assigned to F2 and has value PICK</b>.
So if you use the statament AT LINE-SELECTION you don't need to set an own status, if you use AT USER-COMMAND you need it.
Max
2006 Nov 27 8:23 AM
Hi
AT LINE-SELECTION is the event linked only to DOUBLECLICK:
START-OF-SELECTION.
DO 10 TIMES.
WRITE: / 'line:', SY-INDEX.
ENDDO.
AT LINE-SELECTION.
CHECK NOT SY-LISEL IS INITIAL.
WRITE: SY-LISEL.AT USER-COMMAND is the event linked to any command, defined in own status, made by user in ABAP LIST.
START-OF-SELECTION.
SET PF-STATUS 'MY_STATUS'.
DO 10 TIMES.
WRITE: / 'line:', SY-INDEX.
ENDDO.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN '%PICK'.
CHECK NOT SY-LISEL IS INITIAL.
WRITE: SY-LISEL.
ENDCASE.In my sample I used the USER-COMMAND for the same purpose of AT LINE-SELECTION, infact AT LINE-SELECTION is triggered only if the <b>OK-CODE is assigned to F2 and has value PICK</b>.
So if you use the statament AT LINE-SELECTION you don't need to set an own status, if you use AT USER-COMMAND you need it.
Max
2006 Nov 27 8:25 AM
hi,
AT LINE-SELECTIONfor DOUBLECLICK
AT USER-COMMAND=> all the user commnads from the ALV out put.
rgds
Anver
2006 Nov 27 8:25 AM
AT LINE-SELECTION is used if u develop interactive list.
AT USER-COMMAND is used in module pool program if the user performs any action on the screen.
2006 Nov 27 8:28 AM
<b>Example for AT LINE-SELECTION</b>
REPORT demo_list_at_line_selection.
START-OF-SELECTION.
WRITE 'Basic List'.
AT LINE-SELECTION.
WRITE: 'Secondary List by Line-Selection',
/ 'SY-UCOMM =', sy-ucomm.
When you run the program, the basic list appears with the standard list status. The detail list shows that SY-UCOMM has the value PICK.
<b>Example for AT USER-COMMAND</b>
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.
I hope it helps.
For more details have a look at below link.
http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
Best Regards,
Vibha
*Please mark all the helpful answers
2006 Nov 27 8:31 AM
Hi ravi,
<b>We cannot use both.
ONLY ONE will be fired.
(If PICK / Double - CLICK -
> AT LINE-SELECTION
for other fcodes -
> AT USER-COMMAND
will be fired)</b>
1. If we use GUI-STATUS of our own,
and PICK code is there, (with F2 assigned to it),
2. Then AT LINE SELECTION WILL be triggered,
and not at user-command.
3. For all other fcodes, at user-command will get triggered.
4. eg. in this program,
double -click on ABCD pf status
and create it.
There assign two fcodes, one is PICK and another anything u like.
5.
report abc.
parameters : a type c .
start-of-selection.
SET PF-STATUS 'ABCD'.
write 😕 'BASIC LIST'.
at line-selection.
IF SY-LSIND = 1.
SET PF-STATUS 'ABCD'.
write 😕 'Detail LIST' , SY-LSIND.
ENDIF.
*----
USER COMMAND.
at user-command.
break-point.
regards,
amit m.
2006 Nov 27 8:35 AM
hi,
chk this code.
u will get good idea.
report zxyz_0001.
tables: trdir.
data: itrdir type table of trdir with header line.
select-options: s_name for trdir-name.
start-of-selection.
select * into table itrdir
from trdir
where name in s_name.
loop at itrdir.
format hotspot on.
write:/ itrdir-name.
hide itrdir-name.
format hotspot off.
endloop.
at line-selection.
editor-call for report itrdir-name display-mode.rgds
'Anver
2006 Nov 27 8:37 AM
Hi,
When u double click a line it is At line-selection.
Eg:
write 'Welcome'. "on double click 'Welcome' at line-selection is triggered.
at line-selection.
write 'At line selection event'.
-
When user presses a button, depending on the button pressed event can be triggered by the foll. code in program.
Eg.
at user-command.
case sy-ucomm.
when ''.
write 'User entered Enter Key'.
endcase.
Rgds...
2006 Nov 27 8:52 AM
Hi,
Both the events can not be fired at a time.
When we click a button with function code PICK, then <b>AT LINE-SELECTION</b> gets triggered. When we click a button with other function codes other than PICK, then <b>AT USER-COMMAND</b> gets triggered. There is one more event. <b>AT-PFNN</b>, this event triggers for the buttons with function codes PF01, PF02... PF05.
Regards,
Sailaja.
2006 Nov 27 9:01 AM
HI,
The coding remains the same. the only additional thing which is to be taken care is that in se41 when u create a status make sure you give 'PICK' as function code to F2 function key in function key area. that will trigger at line-selection event.
santhosh
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |