ITPub博客

首页 > Linux操作系统 > Linux操作系统 > SAP ALV userexit-ALV增强 ----- 下载ALV为本地文件

SAP ALV userexit-ALV增强 ----- 下载ALV为本地文件

Linux操作系统 作者:ty_yang 时间:2015-01-22 22:25:06 0 删除 编辑

每一个标准的用'REUSE_ALV_GRID_DISPLAY'实现的ALV,执行后都会跳转到一个标准的屏幕。我们可以去观察这个screen的GUI Status—‘STANDARD_FULLSCREEN’。上面有不少的按钮,每个按钮都有一个功能代码。如 ‘  &ALL’ ‘&SAL’这种。我的想法是,按这个按钮的时候激发我在程序中代码,实现ALV的user exit。

 

做法(以下载按钮为例):

Step 1:

  DATA: it_event_test TYPE slis_t_event_exit,

        it_event_test_wa TYPE slis_event_exit.

  it_event_test_wa-ucomm = '%PC '.

  it_event_test_wa-before = 'X'.

*  it_event_test_wa-after = 'X'.

APPEND it_event_test_wa TO it_event_test.

 

Step 2:

FORM. mycommand USING r_ucomm LIKE sy-ucomm

                     rs_selfield TYPE slis_selfield.

 

IF r_ucomm = '%PC '.

  此处添加增强的代码

  ENDIF.

ENDFORM.          

 

Step 3:

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      i_callback_program      = g_repid

      is_layout               = gs_layout

      it_fieldcat             = gt_fieldcat[]

      i_grid_title            = l_text

      i_save                  = 'A'

      is_variant              = gs_variant

      i_callback_user_command = 'MYCOMMAND'

      it_event_exit           = it_event_test

    TABLES

      t_outtab                = gt_data[].

  .

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29810852/viewspace-1411465/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-08-16

  • 博文量
    14
  • 访问量
    33595