ABAP 跨Client 拷貝表資料

2021-08-15 02:24:08 字數 2265 閱讀 7712

report  ztest_client_copy.

type-pools:abap.

tables:dd02l.

select-options:s_name for dd02l-tabname no intervals.

parameters p_mandt1 type mandt default '600'.

parameters p_mandt2 type mandt default '700'.

types:begin of ty_tname,tabname type dd02l-tabname,end of ty_tname.

data: lt_tname type table of ty_tname ,

ls_tname type ty_tname.

data: d_ref type ref to data,

lt_alv_cat type table of lvc_s_fcat,

ls_alv_cat like line of lt_alv_cat.

data: lt_table like table of dntab.

data: ls_table type dntab.

data: dyn_table type ref to data.

data: dyn_wa type ref to data.

field-symbols :

type table,

type any,

type any,

type any.

*取出表結構的字段目錄

*break-point.

select tabname into table lt_tname from dd02l where tabname in s_name.

loop at lt_tname into ls_tname.

call function 'nametab_get'

exporting

langu          = sy-langu

tabname        = ls_tname-tabname

tables

nametab        = lt_table

exceptions

no_texts_found = 1.

*根據取出的字段目錄生成參考字段目錄

loop at lt_table into ls_table.

ls_alv_cat-fieldname = ls_table-fieldname.

ls_alv_cat-ref_table = ls_tname-tabname.

ls_alv_cat-ref_field = ls_table-fieldname.

clear: ls_alv_cat,

ls_table.

endloop.

*內錶建立

call method cl_alv_table_create=>create_dynamic_table

exporting

it_fieldcatalog = lt_alv_cat

importing

ep_table        = d_ref.

*指定生成的內錶到字段符號

assign d_ref->* to .

*建立動態工作區結構

create data dyn_wa like line of .

*建立動態工作區

assign dyn_wa->* to .

*從動態表中取數到動態內錶中

select * into corresponding fields of table from (ls_tname-tabname)  client specified  

where mandt = p_mandt1.

loop at assigning .

assign component 'mandt' of structure to .

= p_mandt2.

endloop.

modify (ls_tname-tabname)  client specified from table .

if sy-subrc = 0.

write:/  ls_tname-tabname , ' copy successfully'.

endif.

clear: ls_tname,lt_table,ls_table,lt_alv_cat,ls_alv_cat.

free d_ref.

endloop.

scp跨機遠端拷貝

scp是secure copy的簡寫,用於在linux下進行遠端拷貝檔案的命令,和它類似的命令有cp,不過cp只是在本機進行拷貝不能跨伺服器,而且scp傳輸是加密的。當你伺服器硬碟變為唯讀 read only system時,用scp可以幫你把檔案移出來。例項1 從遠處複製檔案到本地目錄 scp r...

scp 跨機遠端拷貝

scp是secure copy的簡寫,用於在linux下進行遠端拷貝檔案的命令,和它類似的命令有cp,不過cp只是在本機進行拷貝不能跨伺服器,而且scp傳輸是加密的。當你伺服器硬碟變為唯讀 read only system時,用scp可以幫你把檔案移出來。註解類似的工具有rsync scp消耗資源少...

scp 跨機遠端拷貝

scp是secure copy的簡寫,用於在linux下進行遠端拷貝檔案的命令,和它類似的命令有cp,不過cp只是在本機進行拷貝不能跨伺服器,而且scp傳輸是加密的。當你伺服器硬碟變為唯讀 read only system時,用scp可以幫你把檔案移出來。註解類似的工具有rsync scp消耗資源少...