Application Development and Automation 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: 
Read only

Form user_command not triggering in debugger

siongchao_ng
Contributor
1,348

Hi all,

After I display my ALV.

I went to menu bar click on LIst->Export->Spreadsheet.

I check the command. It is &XXL

How come my user_command subroutine cannot trigger?

Then I tried added a custom function button on application toolbar named &EXL

Apparently, standard function code cannot trigger, but custom function can?

gw_wrk_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program          = gw_wrk_repid
        i_callback_pf_status_set    = 'SUB_PF_STATUS' "znsc
        i_callback_user_command     = 'USER_COMMAND'
        i_callback_html_top_of_page = 'TOP_OF_PAGE'
        it_fieldcat                 = gw_wrk_fieldcat
        is_layout                   = gw_wrk_layout
        it_sort                     = gt_sort
      TABLES
        t_outtab                    = gt_output
      EXCEPTIONS
        program_error               = 1
        OTHERS                      = 2.



FORM user_command USING r_ucomm     LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.

  FIELD-SYMBOLS: <fs_output> LIKE gs_output.

  CASE r_ucomm.
    WHEN '&IC1'.
      IF rs_selfield-fieldname = 'EBELN'.
        READ TABLE gt_output INTO gw_output INDEX rs_selfield-tabindex.
        SET PARAMETER ID 'BES' FIELD gw_output-ebeln.
        CALL TRANSACTION 'ME23N'.
      ENDIF.

*   begin znsc
    WHEN '&XXL'.
      IF gt_output IS NOT INITIAL.
        UNASSIGN <fs_output>.
        LOOP AT gt_output ASSIGNING <fs_output>.
5 REPLIES 5
Read only

FredericGirod
Active Contributor
0 Likes
1,217

Sorry, could you explain why you are trying to catch the ucomm &XLL ? it is standard, you do not have to catch it.

(forget this FM, use SALV class, it is more than old-school this FM)

Read only

siongchao_ng
Contributor
0 Likes
1,217

Hi Frederic,

I am trying to remove special characters in a alv column only when user tried to trigger &XXL

by click on LIst->Export->Spreadsheet.

WHEN '&XXL'.
      IF gt_output IS NOT INITIAL.
        UNASSIGN <fs_output>.
        LOOP AT gt_output ASSIGNING <fs_output>.
          IF <fs_output>-longtext IS NOT INITIAL.
            PERFORM remove_spl_char USING <fs_output>-longtext.
*                                     CHANGING <fs_output>-longtext.

          ENDIF.
        ENDLOOP.
*         refresh the alv table after removing special chars in item long text
        rs_selfield-refresh = 'X'. "Set this one. It refreshes internal table data with new values
      ENDIF.
Read only

former_member226519
Active Contributor
0 Likes
1,217

did you try to fill ans pass table IT_EVENTS with &XXL ?

Read only

FredericGirod
Active Contributor
0 Likes
1,217

it is not better to hide xxl button, create your own ? create an excel file is not really difficult with ABAP2XLS

Read only

RemiKaimal
Active Contributor
0 Likes
1,217

Did you you register the instance events handler? Looks like there there is a missing
SET HANDLER statement. The user command will trigger once its done