ITPub博客

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

动态内表

原创 Linux操作系统 作者:shangchongtian 时间:2009-01-13 12:36:57 0 删除 编辑
REPORT ZTEST .
DATA: d_ref TYPE REF TO data,
d_ref2 TYPE REF TO data ,
i_alv_cat TYPE TABLE OF lvc_s_fcat,
ls_alv_cat LIKE LINE OF i_alv_cat.

TYPES tabname LIKE dcobjdef-name .
parameter: p_tablen type tabname.
data: begin of itab occurs 0.
INCLUDE STRUCTURE dntab.
data: end of itab.

FIELD-SYMBOLS : TYPE table,
TYPE TABLE,
TYPE ANY,
TYPE TABLE.
REFRESH itab.
CALL FUNCTION 'NAMETAB_GET'
EXPORTING
langu = sy-langu
tabname = p_tablen
TABLES
nametab = itab
EXCEPTIONS
no_texts_found = 1.
LOOP AT itab .
ls_alv_cat-fieldname = itab-fieldname.
ls_alv_cat-ref_table = p_tablen.
ls_alv_cat-ref_field = itab-fieldname.
APPEND ls_alv_cat TO i_alv_cat.
ENDLOOP.
* internal table build
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING it_fieldcatalog = i_alv_cat
IMPORTING ep_table = d_ref .
ASSIGN d_ref->* TO .
SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE .

LOOP AT ASSIGNING .
*your code goes here.
ENDLOOP.

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

请登录后发表评论 登录
全部评论

注册时间:2009-01-13

  • 博文量
    18
  • 访问量
    30975