本例是獲取內錶ct_bp_basic的字段清單,基本型別是表型別,結構中包含include,故需要展開;無inlcude結構,則可忽略第二部分
data
(lo_table_basic)
= cast cl_abap_tabledescr( cl_abap_tabledescr=
>describe_by_data( ct_bp_basic )).
data
(lo_struct_basic)
= cast cl_abap_structdescr( lo_table_basic-
>get_table_line_type())
.data
(lt_component_basic_all)
= lo_struct_basic-
>get_components().
data
(lt_component_include)
= lt_component_basic_all.
delete lt_component_include where as_include ne abap_true.
delete lt_component_basic_all where as_include eq abap_true.
"展開include結構中
loop at lt_component_include assigning field-symbol(
).lo_struct_basic = cast cl_abap_structdescr(
-type).
data
(lt_components)
= lo_struct_basic-
>get_components().
of lt_components to lt_component_basic_all.
endloop.
附贈獲取abap動態獲取變數名稱/文字描述的方法
ABAP動態內錶
定義的動態內錶,對應內錶一行的工作區 field symbols type standard table type any.form create dynamic table data lt fcat type slis t fieldcat alv,ls fcat like line of lt ...
ABAP 動態內錶排序
動態內錶要排序時,因為不知道內錶中的欄位名字,所以不能直接用sort table by field1 field2.可以使用下面的方法來實現 sort table by sorttable 表型別 abap sortorder tab 結構型別 abap sortorder 示例 data w it...
ABAP建立動態內錶
說明 最近業務顧問有很多的需求,其實都是一樣的邏輯,就是處理的表不一樣,就要寫好多次程式,整理一下他的一系列需求之後,準備寫乙個動態的程式,這樣會方便很多,動態的其實核心是動態的內錶,所以簡單的說一下動態內錶的定義方式。1 根據資料庫表定義動態內錶 這種定義比較直接,直接把資料庫表的所有欄位都放在動...