動的に作成された内部テーブルをメモリにエクスポートしています。
どういうわけか(別のプログラムから)それを取り戻すことが可能かどうか知りたいのですが、最初のプログラムは少なくとも私が動的にitabを作成したテーブルの名前を知っていますが、2番目のプログラムはそうではありません。
これが私のitabをエクスポートする私のコードです(これは:Pで動作します)。
parameters: pi_tbl(5) type c obligatory. "The table name - input from the user. can be jibberish.
data: gr_tabref type ref to data.
field-symbols:<gfs_tab> type any table.
form create_dynamic_gr_tabref .
data: lo_struct type ref to cl_abap_structdescr,
lo_tabref type ref to cl_abap_tabledescr.
lo_struct ?= cl_abap_typedescr=>describe_by_name( pi_tbl ).
try.
call method cl_abap_tabledescr=>create
exporting
p_line_type = lo_struct
receiving
p_result = lo_tabref
.
catch cx_sy_table_creation .
message 'Couldn''t create the table description. Quitting' type 'E'.
endtry.
create data gr_tabref type handle lo_tabref.
assign gr_tabref->* to <gfs_tab>.
select * from (pi_tbl) into table <gfs_tab> up to 200 rows.
data: lv_memory_id(30) type c.
lv_memory_id = 'MYMEMORYID'.
export itab from <gfs_tab> to memory id lv_memory_id.
endform.
テーブル名のパラメータのみでデータを取り戻すことはできますか?
私が欲しいのは、ジェネリックデータ型を宣言し、それにデータを貧弱にすることです。
Object myObject; import itab to myObject memory id 'MYMEMORYID'.