03-12-2007 2:24 PM
Hi ,
Can anybody tell me , what is the functionlity of USER-COMMAND in ALV report?
I seen a line like below in the ALV report.
<b>
I_callback_user_command = 'USER_COMMAND' </b>
Please provide me , what is the functionality of this and in what situation i can use this.
thanks in advance
kp
03-12-2007 2:26 PM
USER_COMMAND here is a form name ..
It makes a perform call...
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
..........
endform.
Here program gives the control back to the program from ALV... Here u can do what ever u want in this program..
fRO EXAMPLE ...
FORM stable using lw_ucomm type sy-ucomm fs_selfield type slis_selfield.
case lw_ucomm.
when '&OUP'.
sort t_flight descending stable by carrid connid." fldate.
when '&ODN'.
sort t_flight descending stable by carrid connid fldate.
endcase.
rewards ,
sai ramesh.
03-12-2007 2:27 PM
If you had defined your custom buttons in the application tool bar , to handle the user command of custom buttons as well as some standard functions we use USER_COMMAND
FORM <b>USER_COMMAND</b> USING P_UCOMM TYPE SY-UCOMM
P_SELFLD TYPE SLIS_SELFIELD.
CASE P_UCOMM.
*
WHEN '&IC1'. "Double click
ENDFORM.
03-12-2007 2:28 PM
Hi..
Passing an EXIT routine indicates to the ALV that the application wants
to respond to certain function codes.
Generally, these are function codes that are unknown to the ALV (that
is, are not standard ALV functions) and that were defined and set by a
user status.
The interface of the form routine specified must be defined as follows
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
The EXIT routine is called whenever a function unknown to the ALV is
triggered or if the routine call before/after the execution of a
standard function code has been defined by interface parameter
IT_EVENT_EXIT.
03-12-2007 2:28 PM
This line is telling the ALV that this is the FORM routine which will handle the function codes from the ALV grid. You can put your own buttons on the toolbar and handle them in this FORM routine. You can also handle such things like the double click on a line in the ALV using the FORM defined.
Regards
Rich Heilman
03-12-2007 2:30 PM
Hi,
We use this statement for interactive reporting purpose from the basic list of ALV.
like:
call hierarchical ALV display function module
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZWMR_PICK_STATUS_REPORT'
i_callback_pf_status_set = 'SET_STATUS'
i_callback_user_command =
'USER_COMMAND' "custom gui status form
...............................................................................
and in the User Command we write the code what;s to do further:
&----
*& Form user_command
&----
form called on user command from ALV list
----
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
DATA: index TYPE i,
w_disp_head LIKE LINE OF t_disp_head,
w_door LIKE likp-lgtor.
CLEAR r_lgtor. REFRESH r_lgtor.
CASE r_ucomm.
WHEN 'PICK'. " Double click line
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'VBELN'.
Read data table, using index of row user clicked on
READ TABLE t_disp_tab INTO wa_item_tab INDEX
rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'VL' FIELD wa_item_tab-vbeln.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
Regards,
Anji