Skip to Content
0
Former Member
Apr 24, 2009 at 02:35 AM

ALV Classic - Unable to catch the AT USER-COMMAND event for custom button

561 Views

Hi All,

Currently, I am using classic ALV to display my output (FM REUSE_ALV_GRID_DISPLAY).

DATA: rt_extab TYPE slis_t_extab.

DATA: t_events TYPE slis_t_event,

e_events TYPE slis_alv_event,

w_tabix TYPE sy-tabix.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = t_events

EXCEPTIONS

list_type_wrong = 1

OTHERS = 2.

IF sy-subrc EQ 0.

READ TABLE t_events WITH KEY name = 'USER_COMMAND' INTO e_events.

ENDIF.

CLEAR w_tabix.

w_tabix = sy-tabix.

IF sy-subrc EQ 0.

e_events-form = 'F_USER_COMMAND'. "Subroutine for button functionality

MODIFY t_events FROM e_events INDEX w_tabix.

CLEAR e_events.

ENDIF.

DELETE t_events WHERE name NE 'USER_COMMAND'. "ensure that USER_COMMAND is only here

PERFORM pf_status_kanban USING rt_extab.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid

i_callback_pf_status_set = 'PF_STATUS_KANBAN' "Exclude buttons <- working

i_callback_user_command = 'F_USER_COMMAND' "Subroutine for SY-UCOMM

i_callback_top_of_page = 'TOP_OF_PAGE'

is_layout = t_alv_layout

it_fieldcat = t_alv_fcat[]

it_sort = t_alv_sort

is_variant = t_gs_variant

it_events = t_events "Events for AT USER-COMMAND

  • IT_EVENT_EXIT = 'AT USER-COMMAND'

TABLES

t_outtab = t_output.

*************************************************************************************

FORM pf_status_kanban USING p_rt_extab.

APPEND: 'ICON_XXL' TO t_fcode,

'ICON_WORD_PROCESSING' TO t_fcode,

'ICON_MAIL' TO t_fcode.

SET PF-STATUS 'PF_STATUS_KANBAN'.

*SET PF-STATUS 'PF_STATUS_KANBAN' EXCLUDING T_FCODE.

ENDFORM. " SET_PF_STATUS

*************************************************************************************

FORM f_user_command USING p_r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

CASE r_ucomm.

WHEN 'EXCEL'.

PERFORM f_generate_col USING t_output.

  • PERFORM f_download_excel USING T_OUTPUT.

WHEN OTHERS.

ENDCASE.

ENDFORM. " F_USER_COMMAND

*************************************************************************************

- On my T_EVENTS, in my debug, it only contains the USER_COMMAND, and the name of my subroutine which is f_user_command

- Given this, I'm expecting that when I click my custom button (via pf-status), I'm assuming that the AT USER-COMMAND will be automatically triggered

- I also ensure that the object 'PF_STATUS_KANBAN' is active

- I also ensure that the case in my sy-ucomm is exactly the same name of the function code name for my pf-status

PROBLEM:

The value of my case sy-ucomm is blank, do I have something missing here?

Thanks Guys.

Regards,

Jaime