如何将结构动态转换为内表 [英] How to convert a structure to an internal table dynamically
本文介绍了如何将结构动态转换为内表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建一种方法,该方法将导入一个结构,假设所有结构元素都是扁平的并且具有相同的数据类型.然后我想将它动态转换为具有该类型的表并返回它.我应该从哪里开始?我一直试图让它工作几个小时,但一无所获.
I'm trying to create a method that will import a structure assuming that all structure elements are flat and the same data type. Then I want to convert it to a table with that type dynamically and return it. Where should I start? I've been trying to get this to work for several hours and am getting nowhere.
推荐答案
您可以使用 cl_alv_table_create
使用 create_dynamic_table
表单,如下所示:
You can use the create_dynamic_table
form using cl_alv_table_create
like so:
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
i_length_in_byte = 'X' "added by Paul Robert Oct 28, 2009 17:04
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
* Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
这里是一个可以帮助您的链接你开始吧.
Here is a link that will help you get started.
这篇关于如何将结构动态转换为内表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文