如何使用 "call transaction 'se11' and skip first screen" 激活 ABAP 中的搜索框?

How do I use the "call transaction 'se11' and skip first screen" to activate the search box in ABAP?

我想做的是使用

Set Parameter ID 'DTB' Field 'z*'.
Call Transaction 'SE11' and skip First Screen.

此时我想激活搜索框并将结果放入内部 table。有什么想法吗?或者有没有办法使用数据库统计来更快地提取这些信息?

下面的代码会得到你想要的,你可能需要添加更多的 where 子句来只激活 tables (AS4LOCAL EQ 'A') 或者只透明 table s (TABCLASS EQ 'TRANSP') 因为这个 table 也包含结构。

DATA: t_tabname TYPE STANDARD TABLE OF tabname.
SELECT tabname INTO TABLE t_tabname FROM dd02l WHERE tabname LIKE 'Z%'.

您可能想要使用半官方的 API 而不是直接访问表,它不仅可以处理激活状态,还可以考虑权限:

  DATA: lt_tables TYPE STANDARD TABLE OF rpy_tabl.

  FIELD-SYMBOLS: <ls_table> TYPE rpy_tabl.

  CALL FUNCTION 'RPY_TABLE_SELECT'
    EXPORTING
      table_name       = 'Z*'
    TABLES
      tabl_inf_tab     = lt_tables
    EXCEPTIONS
      cancelled        = 1
      not_found        = 2
      permission_error = 3
      OTHERS           = 4.
  IF sy-subrc <> 0.
*   Implement suitable error handling here
  ELSE.

    LOOP AT lt_tables ASSIGNING <ls_table>.
      CASE <ls_table>-tablclass.
        WHEN 'TRANSP'.  " Transparent table
*         ...
        WHEN 'INTTAB'.  " Structure
*         ...
        WHEN 'CLUSTER'. " Cluster table
*         ...
        WHEN 'POOL'.    " Pooled table
*         ...
        WHEN 'VIEW'.    " Generated view structure
*         ...
        WHEN 'APPEND'.  " Append structure
*         ...
      ENDCASE.
    ENDLOOP.

  ENDIF.