ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 动态内表的实现

动态内表的实现

原创 Linux操作系统 作者:cheer77 时间:2008-03-19 12:20:07 0 删除 编辑

REPORT ZRAB_QJ_0050 .

TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
      is_fcat LIKE LINE OF it_fcat.

DATA: it_fieldcat TYPE lvc_t_fcat,
      is_fieldcat LIKE LINE OF it_fieldcat.

DATA: g_repid LIKE sy-repid,
      g_lin TYPE i.
DATA: new_table TYPE REF TO data.
DATA: new_line TYPE REF TO data.

FIELD-SYMBOLS: TYPE ANY TABLE,
              TYPE ANY,
              TYPE ANY.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            i_structure_name = 'SYST'
       CHANGING
            ct_fieldcat      = it_fcat[].

  LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
    MOVE-CORRESPONDING is_fcat TO is_fieldcat.
    is_fieldcat-fieldname = is_fcat-fieldname.
    is_fieldcat-ref_field = is_fcat-fieldname.
    is_fieldcat-ref_table = is_fcat-ref_tabname.
    APPEND is_fieldcat TO it_fieldcat.
  ENDLOOP.

CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog = it_fieldcat
    IMPORTING
      ep_table = new_table.

ASSIGN new_table->* TO .
  CREATE DATA new_line LIKE LINE OF .
  ASSIGN new_line->* TO .

* Test it...
DO 30 TIMES.
  ASSIGN COMPONENT 'SUBRC' OF STRUCTURE TO .
  = sy-index.
  INSERT INTO TABLE .
ENDDO.

LOOP AT ASSIGNING .
  ASSIGN COMPONENT 'SUBRC' OF STRUCTURE TO .
  WRITE .
ENDLOOP.

  LOOP AT ASSIGNING .
    ASSIGN COMPONENT 'SUBRC' OF STRUCTURE TO .
    WRITE .
  ENDLOOP.

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

上一篇: 什么都要来个序
请登录后发表评论 登录
全部评论

注册时间:2008-03-18

  • 博文量
    9
  • 访问量
    12998