ABAP选择屏幕单击按钮跳转到SM30维护界面

做某些ALV报表时,可能需要为自建表维护数据作为配置表,以下就是在选择屏幕上设置快捷按钮,通过按钮跳转到SM30数据维护界面为配置表维护数据。
ABAP选择屏幕单击按钮跳转到SM30维护界面_第1张图片
单击按钮跳转到数据维护界面
ABAP选择屏幕单击按钮跳转到SM30维护界面_第2张图片
在PBO事件之前,定义按钮并初始化,代码如下:ABAP选择屏幕单击按钮跳转到SM30维护界面_第3张图片ABAP选择屏幕单击按钮跳转到SM30维护界面_第4张图片ABAP选择屏幕单击按钮跳转到SM30维护界面_第5张图片
注意:在程序的开始声明TABLES参数SSCRFIELDS.
在这里插入图片描述
代码如下:

*----------------------------------------------------------------------*
*    Include & tables
*----------------------------------------------------------------------*
TABLES:BSEG,SSCRFIELDS.

DATA:FUNCTXT     TYPE SMP_DYNTXT.
*----------------------------------------------------------------------*
*    Initialization
*----------------------------------------------------------------------*
INITIALIZATION.
  FUNCTXT-ICON_ID   = ICON_INTENSIFY.
  FUNCTXT-QUICKINFO = '研发内部订单组维护'.
  FUNCTXT-ICON_TEXT = '研发内部订单组维护'.
  SSCRFIELDS-FUNCTXT_01 = FUNCTXT.

  FUNCTXT-ICON_ID   = ICON_INTENSIFY.
  FUNCTXT-QUICKINFO = '费用辅助信息维护'.
  FUNCTXT-ICON_TEXT = '费用辅助信息维护'.
  SSCRFIELDS-FUNCTXT_02 = FUNCTXT.

  FUNCTXT-ICON_ID   = ICON_INTENSIFY.
  FUNCTXT-QUICKINFO = '研发成本中心维护'.
  FUNCTXT-ICON_TEXT = '研发成本中心维护'.
  SSCRFIELDS-FUNCTXT_03 = FUNCTXT.



*----------------------------------------------------------------------*
*    At Selection-screen
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.

  CASE SSCRFIELDS-UCOMM.
    WHEN 'FC01'."系统预留的功能码
      PERFORM FRM_CALL_SM30 USING 'ZVCO0019'."研发内部订单组维护
    WHEN 'FC02'.
      PERFORM FRM_CALL_SM30 USING 'ZVCO0019A'.
    WHEN 'FC03'.
      PERFORM FRM_CALL_SM30 USING 'ZVCO0019B'.
    WHEN OTHERS.
  ENDCASE.
*&---------------------------------------------------------------------*
*&      Form  FRM_CALL_SM30
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM FRM_CALL_SM30 USING LV_NAME.
  DATA:GT_DBA_SELLIST TYPE STANDARD TABLE OF VIMSELLIST.
  DATA:GT_TABNAME TYPE DD02V-TABNAME ."表名称

  CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
    EXPORTING
      ACTION                         = 'U'
      GENERATE_MAINT_TOOL_IF_MISSING = 'X'
      VIEW_NAME                      = LV_NAME
    TABLES
      DBA_SELLIST                    = GT_DBA_SELLIST
    EXCEPTIONS
      CLIENT_REFERENCE               = 1
      FOREIGN_LOCK                   = 2
      INVALID_ACTION                 = 3
      NO_CLIENTINDEPENDENT_AUTH      = 4
      NO_DATABASE_FUNCTION           = 5
      NO_EDITOR_FUNCTION             = 6
      NO_SHOW_AUTH                   = 7
      NO_TVDIR_ENTRY                 = 8
      NO_UPD_AUTH                    = 9
      ONLY_SHOW_ALLOWED              = 10
      SYSTEM_FAILURE                 = 11
      UNKNOWN_FIELD_IN_DBA_SELLIST   = 12
      VIEW_NOT_FOUND                 = 13
      MAINTENANCE_PROHIBITED         = 14
      OTHERS                         = 15.

  IF SY-SUBRC <> 0.
* Implement suitable error handling here
  ENDIF.
ENDFORM.

你可能感兴趣的:(ABAP,乱乱记)