ABAP 调用视图DEMO


report zbuitf0402.

************************************************************************
*                         Part1----Declaration                         *
************************************************************************
*----------------------------------------------------------------------*
* <1.1-Table_Work_Areas Declaration
*----------------------------------------------------------------------*
data:l_view_name like dd02v-tabname,
     lt_vkeys    type table of vimsellist with header line.
data:line type p.
tables:zbut0402,t001.
*----------------------------------------------------------------------*
* <1.9-Selection Screen
*----------------------------------------------------------------------*

selection-screen begin of block b1 with frame title text-001.
select-options:s_gjahr for zbut0402-gjahr memory id gjr,
               s_monat for zbut0402-monat memory id mon,
               s_zhsxm for zbut0402-zhsxm
                    matchcode object zbuhp_zhsxm.
selection-screen end of block b1.

************************************************************************
*                         Part2----Processing                          *
************************************************************************

*----------------------------------------------------------------------*
* <2.3-Event Occurs After The Selection Screen Has Been Processed
*----------------------------------------------------------------------*
start-of-selection.
  perform frm_view_mantain.

************************************************************************
*                         Part4----Subroutine Description              *
************************************************************************
*&---------------------------------------------------------------------*
*&      Form  frm_view_mantain
*&---------------------------------------------------------------------*
*       text 表维护
*----------------------------------------------------------------------*
form frm_view_mantain.

  data: line type p.

*zqmlsydw_v
  l_view_name = 'ZBUT0402_VIEW'.


  refresh lt_vkeys.
  clear lt_vkeys.
  perform frm_init tables s_zhsxm using 'ZHSXM'.
  perform frm_init tables s_gjahr using 'GJAHR'.
  perform frm_init tables s_monat using 'MONAT'.


  call function 'VIEW_MAINTENANCE_CALL'
    exporting
      action                       = 'S'
*     CORR_NUMBER                  = '          '
*     GENERATE_MAINT_TOOL_IF_MISSING       = ' '
*     show_selection_popup         = 'X'
      view_name                    = l_view_name
*     NO_WARNING_FOR_CLIENTINDEP   = ' '
*     RFC_DESTINATION_FOR_UPGRADE  = ' '
*     CLIENT_FOR_UPGRADE           = ' '
*     VARIANT_FOR_SELECTION        = ' '
*     COMPLEX_SELCONDS_USED        = ' '
*     CHECK_DDIC_MAINFLAG          = ' '
*     SUPPRESS_WA_POPUP            = ' '
    tables
      dba_sellist                  = lt_vkeys
*     EXCL_CUA_FUNCT               =
    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.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
endform.


form frm_init tables s_s type standard table
              using pi_field.

  ranges s_t for vimsellist-value.

  loop at s_s.
    move-corresponding s_s to s_t.
    append s_t.
  endloop.

  case pi_field.
    when 'GJAHR'.
      loop at s_t.
        if s_t-high = '0000'.
          clear s_t-high.
        endif.
        modify s_t.
      endloop.
    when 'MONAT'.
      loop at s_t.
        if s_t-high = '00'.
          clear s_t-high.
        endif.
        modify s_t.
      endloop.
    when others.
  endcase.

  read table s_t index 1.
  if s_t-low is not initial.
    if s_t-high is not  initial.
      lt_vkeys-viewfield = pi_field.
      lt_vkeys-operator  = 'GE'.
      lt_vkeys-value     = s_t-low.
      lt_vkeys-and_or    = 'AND'.
      append lt_vkeys.
    else.
      describe table s_t lines line.
      if line eq 1.
        lt_vkeys-viewfield = pi_field.
        lt_vkeys-operator  = 'EQ'.
        lt_vkeys-value     = s_t-low.
        lt_vkeys-and_or    = 'AND'.
        append lt_vkeys.
      else.
        loop at s_t.
          lt_vkeys-viewfield = pi_field.
          lt_vkeys-operator  = 'EQ'.
          lt_vkeys-value     = s_t-low.
          if sy-tabix = line.
            lt_vkeys-and_or    = 'AND'.
          else.
            lt_vkeys-and_or    = 'OR'.
          endif.
          append lt_vkeys.
        endloop.
      endif.
    endif.
  endif.
  if s_t-high is not initial.
    lt_vkeys-viewfield = pi_field.
    lt_vkeys-operator  = 'LE'.
    lt_vkeys-value     = s_t-high.
    lt_vkeys-and_or    = 'AND'.
    append lt_vkeys.
  endif.
endform.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值