abap的动态alv函数

DATA: lv_selection_id TYPE rsdynsel-selid,
      lt_tables_tab   TYPE STANDARD TABLE OF rsdstabs,
      ls_tables_tab   TYPE rsdstabs.
DATA: lt_fields_tab    TYPE STANDARD TABLE OF rsdsfields,
      lt_where_clauses TYPE rsds_twhere.

ls_tables_tab-prim_tab = 'ZTEST_LJR01'.  "数据库表名
APPEND ls_tables_tab TO lt_tables_tab.
CALL FUNCTION 'FREE_SELECTIONS_INIT'
  EXPORTING
    kind                     = 'T'
  IMPORTING
    selection_id             = lv_selection_id
  TABLES
    tables_tab               = lt_tables_tab
  EXCEPTIONS
    fields_incomplete        = 1
    fields_no_join           = 2
    field_not_found          = 3
    no_tables                = 4
    table_not_found          = 5
    expression_not_supported = 6
    incorrect_expression     = 7
    illegal_kind             = 8
    area_not_found           = 9
    inconsistent_area        = 10
    kind_f_no_fields_left    = 11
    kind_f_no_fields         = 12
    too_many_fields          = 13
    dup_field                = 14
    field_no_type            = 15
    field_ill_type           = 16
    dup_event_field          = 17
    node_not_in_ldb          = 18
    area_no_field            = 19
    OTHERS                   = 20.
IF sy-subrc EQ 0.
  CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
    EXPORTING
      selection_id    = lv_selection_id
      title           = '选择'
      frame_text      = '查询条件'
      as_window       = ''                "不显示成窗口
    IMPORTING
      where_clauses   = lt_where_clauses  "返回选择条件
    TABLES
      fields_tab      = lt_fields_tab     "选择画面中选中字段
    EXCEPTIONS
      internal_error  = 1
      no_action       = 2
      selid_not_found = 3
      illegal_status  = 4
      OTHERS          = 5.
  IF sy-subrc EQ 0.

  ENDIF.
ENDIF.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值