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: 

USER-COMMAND

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

Former Member
0 Kudos

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