ALV 設置Status Titlebar Usercommand 的代碼

g_repid = sy-repid.

  call function 'REUSE_ALV_GRID_DISPLAY'
     exporting
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
     i_callback_program               = g_repid
   i_callback_pf_status_set           = 'STATUS_SET'
   i_callback_user_command           = 'ALV_USER_COMMAND'
*   I_CALLBACK_TOP_OF_PAGE            = ' '
*   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*   I_CALLBACK_HTML_END_OF_LIST       = ' '
*   I_STRUCTURE_NAME                  = I_STRUCTURE_NAME
*   I_BACKGROUND_ID                   = ' '
   i_grid_title                       = 'TITLE'
*   I_GRID_SETTINGS                   = I_GRID_SETTINGS
       is_layout                      = wa_layout
       it_fieldcat                    = t_fieldcat[]
*   IT_EXCLUDING                      = IT_EXCLUDING
*   IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
*   IT_SORT                           = IT_SORT
*   IT_FILTER                         = IT_FILTER
*   IS_SEL_HIDE                       = IS_SEL_HIDE
*   I_DEFAULT                         = 'X'
*   I_SAVE                            = ' '
*   IS_VARIANT                        = IS_VARIANT
*   it_events                         = gt_xevents
*   IT_EVENT_EXIT                     = IT_EVENT_EXIT
*   IS_PRINT                          = IS_PRINT
*   IS_REPREP_ID                      = IS_REPREP_ID
*   I_SCREEN_START_COLUMN             = 0
*   I_SCREEN_START_LINE               = 0
*   I_SCREEN_END_COLUMN               = 0
*   I_SCREEN_END_LINE                 = 0
*   I_HTML_HEIGHT_TOP                 = 0
*   I_HTML_HEIGHT_END                 = 0
*   IT_ALV_GRAPHICS                   = IT_ALV_GRAPHICS
*   IT_HYPERLINK                      = IT_HYPERLINK
*   IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
*   IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
*   IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
*   ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
      tables
        t_outtab                          = t_out
      exceptions
        program_error                     = 1
        others                            = 2.

  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

*&---------------------------------------------------------------------*
*&      Form  status_set
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&gtPT_EXTAB   text
*----------------------------------------------------------------------*
form status_set using pt_extab type slis_t_extab.           "#EC CALLED
  set pf-status 'ALV_STATUS'.
endform.     


*&---------------------------------------------------------------------*
*&      Form  alv_user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&gtL_UCOMM    text
*      --&gtL_SELFIELD text
*----------------------------------------------------------------------*
form alv_user_command using
                      l_ucomm like sy-ucomm
                      l_selfield type slis_selfield.
  case l_ucomm.
    when 'SAVE'.

      data:l_text(50) type c value
            'Confirm update database?',
            l_answer type c.

      perform month_check.

      call function 'POPUP_TO_CONFIRM'
        exporting
          titlebar              = 'Warning'
          text_question         = l_text
          text_button_1         = 'Yes'
          text_button_2         = 'No'
          default_button        = '2'
          display_cancel_button = 'X'
        importing
          answer                = l_answer
        exceptions
          text_not_found        = 1
          others                = 2.

      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.

      if l_answer = '1'.
        ......
        else.
          .......
          leave screen.
        endif.
      else.
        exit.
      endif.
  endcase.
endform.                    "alv_user_command

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

转载于:http://blog.itpub.net/21122155/viewspace-578422/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值