1.FTP配置:

  设置FTP参数:IP地址、账号、密码、路径、RFC目标。

  设置数据表:数据表及字段明细,设置查询字段及报表输出字段。

2.操作界面 

3.程序 ZFID0003_ETL_FTP

 主程序:

 *&---------------------------------------------------------------------*
*& Report ZFID0003_ETL_FTP
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* report zfid0003_etl_ftp. include zfid0003_etl_ftp_cls. include zfid0003_etl_ftp_top. include zfid0003_etl_ftp_scr. include zfid0003_etl_ftp_pro. include zfid0003_etl_ftp_frm.

 Include程序:

 *&---------------------------------------------------------------------*
*& 包括 ZFID0003_ETL_FTP_CLS
*&---------------------------------------------------------------------* *----------------------------------------------------------------------*
* CLASS lcl_alv_event_handler DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_alv_event_handler definition.
public section.
methods:
handle_double_click for event double_click
of cl_gui_alv_grid
importing e_row e_column es_row_no, handle_hotspot_click for event hotspot_click
of cl_gui_alv_grid
importing e_row_id e_column_id es_row_no, handle_toolbar for event toolbar
of cl_gui_alv_grid
importing e_object e_interactive, handle_toolbar_itm for event toolbar
of cl_gui_alv_grid
importing e_object e_interactive, handle_f4 for event onf4
of cl_gui_alv_grid
importing e_fieldname e_fieldvalue es_row_no er_event_data et_bad_cells, handle_command_ftp for event user_command
of cl_gui_alv_grid
importing e_ucomm, handle_command_tabhd for event user_command
of cl_gui_alv_grid
importing e_ucomm, handle_command_tabit for event user_command
of cl_gui_alv_grid
importing e_ucomm.
endclass. "lcl_alv_event_handler DEFINITION *----------------------------------------------------------------------*
* CLASS lcl_alv_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
class lcl_alv_event_handler implementation .
"双击行显示错误日志
method handle_double_click.
perform handle_double_click using e_row.
perform alv_refresh_display.
endmethod. "handle_double_click method handle_hotspot_click.
perform handle_hotspot_clk using e_row_id
e_column_id
es_row_no.
endmethod. "handle_1100_data_changed method handle_toolbar.
perform handle_toolbar using e_object e_interactive.
endmethod. "HANDLE_TOOLBAR method handle_toolbar_itm.
perform handle_toolbar_itm using e_object e_interactive.
endmethod. "HANDLE_TOOLBAR method handle_f4.
perform handle_f4 using e_fieldname e_fieldvalue es_row_no er_event_data et_bad_cells.
endmethod. "HANDLE_F4 method handle_command_ftp.
perform alv_changed_data.
perform handle_command_ftp using e_ucomm.
perform alv_refresh_display.
endmethod. "HANDLE_USER_COMMAND method handle_command_tabhd.
perform alv_changed_data.
perform handle_command_tabhd using e_ucomm.
perform alv_refresh_display.
endmethod. "HANDLE_USER_COMMAND method handle_command_tabit.
perform alv_changed_data.
perform handle_command_tabit using e_ucomm.
perform alv_refresh_display.
endmethod. "HANDLE_USER_COMMAND endclass. "lcl_alv_event_handler IMPLEMENTATION
 *&---------------------------------------------------------------------*
*& 包括 ZFID0003_ETL_FTP_TOP
*&---------------------------------------------------------------------* type-pools:
ole2. tables:
ztfi0035_tab_hd,
ztfi0036_tab_itm,
ztfi0037_etl_ftp,
sscrfields. data:
gt_tab_ftp like table of ztfi0037_etl_ftp,
gt_tab_hd like table of ztfi0035_tab_hd,
gt_all_itm like table of ztfi0036_tab_itm,
gt_tab_itm like table of ztfi0036_tab_itm. field-symbols:
<fs_tab_ftp> like ztfi0037_etl_ftp,
<fs_tab_hd> like ztfi0035_tab_hd,
<fs_tab_itm> like ztfi0036_tab_itm. *"ALV PARAMETERS
data:
go_docking_con type ref to cl_gui_docking_container,
go_splitter_con type ref to cl_gui_splitter_container,
go_splitter_con_left type ref to cl_gui_splitter_container,
go_splitter_con_right type ref to cl_gui_splitter_container,
go_con_left type ref to cl_gui_container,
go_con_right type ref to cl_gui_container. data:
go_con_ftp type ref to cl_gui_container,
go_con_tabhd type ref to cl_gui_container,
go_con_tabit type ref to cl_gui_container,
go_alv_ftp type ref to cl_gui_alv_grid,
go_alv_tabhd type ref to cl_gui_alv_grid,
go_alv_tabit type ref to cl_gui_alv_grid,
go_event_ftp type ref to lcl_alv_event_handler,
go_event_tabhd type ref to lcl_alv_event_handler,
go_event_tabit type ref to lcl_alv_event_handler. data:
gt_fieldcat_ftp type lvc_t_fcat,
gt_fieldcat_tabhd type lvc_t_fcat,
gt_fieldcat_tabit type lvc_t_fcat,
gt_f4_ftp type lvc_t_f4,
gt_f4_tabhd type lvc_t_f4,
gt_f4_tabit type lvc_t_f4,
gt_exclude type ui_functions.
data:
gs_fieldcat type lvc_s_fcat,
gs_f4 type lvc_s_f4,
gs_layout type lvc_s_layo.
 *&---------------------------------------------------------------------*
*& 包括 ZFID0003_ETL_FTP_SCR
*&---------------------------------------------------------------------* selection-screen begin of block b_block with frame title text-.
parameter:
p_ftpnm type ztfi0037_etl_ftp-ftpnm matchcode object zhfi0037_etl_ftp. selection-screen pushbutton () bt_query user-command bt_query.
selection-screen end of block b_block. selection-screen function key .
 *&---------------------------------------------------------------------*
*& 包括 ZFID0003_ETL_FTP_PRO
*&---------------------------------------------------------------------* initialization.
perform frm_initial_data. at selection-screen output.
perform frm_split_dock.
perform frm_event_dock.
perform frm_alv_display. at selection-screen.
perform frm_ucomm_handler. start-of-selection.
 *&---------------------------------------------------------------------*
*& 包括 ZFID0003_ETL_FTP_FRM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form handle_toolbar
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_OBJECT text
* -->P_E_INTERACTIVE text
*----------------------------------------------------------------------*
form handle_toolbar using fv_object type ref to cl_alv_event_toolbar_set
fv_interactive type char1.
data: ls_toolbar type stb_button. ls_toolbar-function = 'INSERT_ROW'.
ls_toolbar-icon = icon_insert_row.
ls_toolbar-text = space.
ls_toolbar-quickinfo = '新增行'.
append ls_toolbar to fv_object->mt_toolbar.
clear: ls_toolbar. ls_toolbar-function = 'DELETE_ROW'.
ls_toolbar-icon = icon_delete_row.
ls_toolbar-text = space.
ls_toolbar-quickinfo = '删除行'.
append ls_toolbar to fv_object->mt_toolbar.
clear: ls_toolbar.
endform. " handle_toolbar
*&---------------------------------------------------------------------*
*& Form handle_f4
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_FIELDNAME text
* -->P_E_FIELDVALUE text
* -->P_ES_ROW_NO text
* -->P_ER_EVENT_DATA text
* -->P_ET_BAD_CELLS text
*----------------------------------------------------------------------*
form handle_f4 using fv_fieldname type lvc_fname
fv_fieldvalue type lvc_value
fs_row_no type lvc_s_roid
fo_event_data type ref to cl_alv_event_data
ft_bad_cells type lvc_t_modi.
data:
ls_modi type lvc_s_modi.
data:
lv_dtext type dd02t-ddtext.
field-symbols:
<ft_modi> type lvc_t_modi. fo_event_data->m_event_handled = 'X'. case fv_fieldname.
when 'TABNM'.
perform f4_dd_table(rsaqddic) using 'SAPLAQJD_CNTRL'
''
'G_DYN_0300-TNAME'
changing fv_fieldvalue.
when others.
endcase. select single ddtext
into lv_dtext
from dd02t
where tabname = fv_fieldvalue. assign fo_event_data->m_data->* to <ft_modi>.
ls_modi-row_id = fs_row_no-row_id."
ls_modi-fieldname = fv_fieldname.
ls_modi-value = fv_fieldvalue.
append ls_modi to <ft_modi>.
ls_modi-row_id = fs_row_no-row_id."
ls_modi-fieldname = 'TABTX'.
ls_modi-value = lv_dtext.
append ls_modi to <ft_modi>. endform. " handle_f4
*&---------------------------------------------------------------------*
*& Form handle_user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_UCOMM text
*----------------------------------------------------------------------*
form handle_command_ftp using fv_ucomm.
data:
ls_tab_ftp type ztfi0037_etl_ftp,
ls_selected_row type lvc_s_row.
data:
lt_selected_row type lvc_t_row. if fv_ucomm = 'INSERT_ROW'.
append ls_tab_ftp to gt_tab_ftp.
elseif fv_ucomm = 'DELETE_ROW'.
go_alv_ftp->get_selected_rows(
importing
et_index_rows = lt_selected_row ). read table lt_selected_row into ls_selected_row index .
if sy-subrc = .
delete gt_tab_ftp index ls_selected_row-index.
endif.
endif.
endform. " handle_user_command
*&---------------------------------------------------------------------*
*& Form frm_split_dock
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_split_dock .
check go_docking_con is initial. "创建容器
create object go_docking_con
exporting
ratio =
side = cl_gui_docking_container=>dock_at_bottom. "拆分为左、右
create object go_splitter_con
exporting
parent = go_docking_con
rows =
columns = .
go_splitter_con->set_column_width( exporting id = width = ). go_con_left = go_splitter_con->get_container( row = column = ).
go_con_right = go_splitter_con->get_container( row = column = ). "左侧再次拆分为上下
create object go_splitter_con_left
exporting
parent = go_con_left
rows =
columns = .
go_splitter_con_left->set_row_height( exporting id = height = ). "右侧不拆分
create object go_splitter_con_right
exporting
parent = go_con_right
rows =
columns = .
"go_splitter_con_right->set_row_height( EXPORTING id = 1 height = 40 ). "创建FTP的ALV
go_con_ftp = go_splitter_con_left->get_container( row = column = ).
create object go_alv_ftp
exporting
i_parent = go_con_ftp. "创建TABLE HEADER的ALV
go_con_tabhd = go_splitter_con_left->get_container( row = column = ).
create object go_alv_tabhd
exporting
i_parent = go_con_tabhd. "创建TABLE ITEM的ALV
go_con_tabit = go_splitter_con_right->get_container( row = column = ).
create object go_alv_tabit
exporting
i_parent = go_con_tabit.
endform. " frm_split_dock
*&---------------------------------------------------------------------*
*& Form frm_event_dock
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_event_dock .
if go_event_ftp is initial
or go_event_tabhd is initial
or go_event_tabit is initial.
create object:go_event_ftp,go_event_tabhd,go_event_tabit.
set handler:
go_event_ftp->handle_f4 for go_alv_ftp,
go_event_tabhd->handle_f4 for go_alv_tabhd,
go_event_tabit->handle_f4 for go_alv_tabit, go_event_ftp->handle_toolbar for go_alv_ftp,
go_event_tabhd->handle_toolbar for go_alv_tabhd,
go_event_tabit->handle_toolbar_itm for go_alv_tabit, go_event_ftp->handle_command_ftp for go_alv_ftp,
go_event_tabhd->handle_command_tabhd for go_alv_tabhd,
go_event_tabit->handle_command_tabit for go_alv_tabit, go_event_tabhd->handle_double_click for go_alv_tabhd.
endif.
endform. " frm_event_dock
*&---------------------------------------------------------------------*
*& Form frm_alv_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_alv_display.
define build_fieldcat.
gs_fieldcat-fieldname = &.
gs_fieldcat-edit = &.
gs_fieldcat-checkbox = &.
gs_fieldcat-f4availabl = &.
gs_fieldcat-lowercase = &.
gs_fieldcat-outputlen = &.
gs_fieldcat-coltext = &.
if & = 'FTPPW'.
gs_fieldcat-edit_mask = '******'.
endif.
append gs_fieldcat to &.
clear gs_fieldcat. if & = 'X'.
gs_f4-fieldname = &.
gs_f4-register = 'X'.
insert gs_f4 into table &.
clear gs_f4.
endif.
end-of-definition. perform frm_alv_toolbar tables gt_exclude.
perform frm_alv_layout changing gs_layout. if gt_fieldcat_ftp is initial.
"ALV显示FTP参数
build_fieldcat:
gt_fieldcat_ftp gt_f4_ftp 'FTPNM' 'X' ' ' ' ' ' ' 'FTP名称',
gt_fieldcat_ftp gt_f4_ftp 'FTPTX' 'X' ' ' ' ' ' ' 'FTP描述',
gt_fieldcat_ftp gt_f4_ftp 'FTPIP' 'X' ' ' ' ' ' ' 'FTP地址',
gt_fieldcat_ftp gt_f4_ftp 'FTPUR' 'X' ' ' ' ' 'X' 'FTP账号',
gt_fieldcat_ftp gt_f4_ftp 'FTPPW' 'X' ' ' ' ' 'X' 'FTP密码',
gt_fieldcat_ftp gt_f4_ftp 'FTPDS' 'X' ' ' ' ' ' ' 'RFC目标'. gs_layout-grid_title = 'FTP参数明细【参数设置】'.
"gs_layout-NO_TOOLBAR = 'X'.
gs_layout-cwidth_opt = 'X'. call method go_alv_ftp->set_table_for_first_display
exporting
it_toolbar_excluding = gt_exclude
is_layout = gs_layout
changing
it_outtab = gt_tab_ftp
it_fieldcatalog = gt_fieldcat_ftp.
endif. if gt_fieldcat_tabhd is initial.
"ALV显示TABLE抬头
build_fieldcat:
gt_fieldcat_tabhd gt_f4_tabhd 'FTPNM' ' ' ' ' ' ' ' ' 'FTP名称',
gt_fieldcat_tabhd gt_f4_tabhd 'TABNM' 'X' ' ' 'X' ' ' '表名',
gt_fieldcat_tabhd gt_f4_tabhd 'TABTX' 'X' ' ' 'X' ' ' '表描述',
gt_fieldcat_tabhd gt_f4_tabhd 'FG_FTP' 'X' 'X' ' ' ' ' '标识-启用'.
gs_layout-grid_title = '数据表抬头【请维护数据表并启用】'. call method go_alv_tabhd->set_table_for_first_display
exporting
it_toolbar_excluding = gt_exclude
is_layout = gs_layout
changing
it_outtab = gt_tab_hd
it_fieldcatalog = gt_fieldcat_tabhd. "注册事件-搜索帮助
go_alv_tabhd->register_f4_for_fields( exporting it_f4 = gt_f4_tabhd ).
go_alv_tabhd->register_edit_event( exporting i_event_id = cl_gui_alv_grid=>mc_evt_modified ).
endif. if gt_fieldcat_tabit is initial.
"ALV显示TABLE字段明细
build_fieldcat:
gt_fieldcat_tabit gt_f4_tabit 'FTPNM' ' ' ' ' ' ' ' ' 'FTP名称',
gt_fieldcat_tabit gt_f4_tabit 'TABNM' ' ' ' ' ' ' ' ' '表名',
gt_fieldcat_tabit gt_f4_tabit 'FLDNO' ' ' ' ' ' ' ' ' '行项目',
gt_fieldcat_tabit gt_f4_tabit 'FLDNM' ' ' ' ' ' ' ' ' '字段名',
gt_fieldcat_tabit gt_f4_tabit 'FLDTX' ' ' ' ' ' ' ' ' '描述',
gt_fieldcat_tabit gt_f4_tabit 'FG_QRY' 'X' 'X' ' ' ' ' '标识-查询',
gt_fieldcat_tabit gt_f4_tabit 'FG_EXP' 'X' 'X' ' ' ' ' '标识-输出'.
gs_layout-grid_title = '数据表明细【请单击左侧数据表并针对字段明细选择查询字段及输出字段】'. call method go_alv_tabit->set_table_for_first_display
exporting
it_toolbar_excluding = gt_exclude
is_layout = gs_layout
changing
it_outtab = gt_tab_itm
it_fieldcatalog = gt_fieldcat_tabit.
endif.
endform. " frm_alv_display
*&---------------------------------------------------------------------*
*& Form frm_initial_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_initial_data .
bt_query = '@BO@查询'.
sscrfields-functxt_01 = '@2L@保存设置'.
endform. " frm_initial_data
*&---------------------------------------------------------------------*
*& Form frm_alv_layout
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_LS_LAYOUT text
*----------------------------------------------------------------------*
form frm_alv_layout changing fs_layout type lvc_s_layo.
fs_layout-zebra = 'X'.
fs_layout-sel_mode = 'A'.
fs_layout-smalltitle = 'X'.
endform. " frm_alv_layout
*&---------------------------------------------------------------------*
*& Form frm_ucomm_handler
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_ucomm_handler .
data:
lv_flg type c.
data:
lt_return type table of bapiret2. perform alv_changed_data. case sy-ucomm.
when 'FC01'.
perform frm_save_check using lv_flg.
perform frm_save_data using lv_flg. when 'BT_QUERY'.
perform frm_query_check.
perform frm_query_data.
endcase. perform alv_refresh_display. clear:sy-ucomm.
endform. " frm_ucomm_handler
*&---------------------------------------------------------------------*
*& Form frm_query_check
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_query_check .
if gt_tab_ftp is not initial
or gt_tab_hd is not initial
or gt_tab_itm is not initial. endif.
endform. " frm_query_check
*&---------------------------------------------------------------------*
*& Form frm_query_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_query_data .
select *
into corresponding fields of table gt_tab_ftp
from ztfi0037_etl_ftp
where ftpnm = p_ftpnm. select *
into corresponding fields of table gt_tab_hd
from ztfi0035_tab_hd
where ftpnm = p_ftpnm.
endform. " frm_query_data
*&---------------------------------------------------------------------*
*& Form frm_alv_toolbar
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_GT_EXCLUDE text
*----------------------------------------------------------------------*
form frm_alv_toolbar tables ft_exclude type ui_functions.
"插入正确名称 <...>.
refresh: ft_exclude. append cl_gui_alv_grid=>mc_fc_maximum to ft_exclude.
append cl_gui_alv_grid=>mc_fc_minimum to ft_exclude.
append cl_gui_alv_grid=>mc_fc_subtot to ft_exclude.
append cl_gui_alv_grid=>mc_fc_sum to ft_exclude.
append cl_gui_alv_grid=>mc_fc_average to ft_exclude.
append cl_gui_alv_grid=>mc_mb_sum to ft_exclude.
append cl_gui_alv_grid=>mc_mb_subtot to ft_exclude.
append cl_gui_alv_grid=>mc_fc_sort_asc to ft_exclude.
append cl_gui_alv_grid=>mc_fc_sort_dsc to ft_exclude.
append cl_gui_alv_grid=>mc_fc_find to ft_exclude.
append cl_gui_alv_grid=>mc_fc_filter to ft_exclude.
append cl_gui_alv_grid=>mc_fc_print to ft_exclude.
append cl_gui_alv_grid=>mc_fc_print_prev to ft_exclude.
append cl_gui_alv_grid=>mc_mb_export to ft_exclude.
append cl_gui_alv_grid=>mc_fc_graph to ft_exclude.
append cl_gui_alv_grid=>mc_mb_export to ft_exclude.
append cl_gui_alv_grid=>mc_mb_view to ft_exclude.
append cl_gui_alv_grid=>mc_fc_detail to ft_exclude.
append cl_gui_alv_grid=>mc_fc_help to ft_exclude.
append cl_gui_alv_grid=>mc_fc_info to ft_exclude.
append cl_gui_alv_grid=>mc_mb_variant to ft_exclude.
append cl_gui_alv_grid=>mc_fc_refresh to ft_exclude.
append cl_gui_alv_grid=>mc_fc_check to ft_exclude.
append cl_gui_alv_grid=>mc_fc_loc_copy to ft_exclude.
append cl_gui_alv_grid=>mc_fc_loc_insert_row to ft_exclude.
append cl_gui_alv_grid=>mc_fc_loc_delete_row to ft_exclude.
append cl_gui_alv_grid=>mc_fc_loc_copy_row to ft_exclude.
append cl_gui_alv_grid=>mc_fc_loc_append_row to ft_exclude.
append cl_gui_alv_grid=>mc_fc_loc_undo to ft_exclude.
append cl_gui_alv_grid=>mc_fc_loc_cut to ft_exclude.
append cl_gui_alv_grid=>mc_mb_paste to ft_exclude.
endform. " frm_alv_toolbar
*&---------------------------------------------------------------------*
*& Form alv_refresh_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form alv_refresh_display .
go_alv_ftp->refresh_table_display( ).
go_alv_tabhd->refresh_table_display( ).
go_alv_tabit->refresh_table_display( ).
endform. " alv_refresh_display
*&---------------------------------------------------------------------*
*& Form handle_double_click
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_ROW text
*----------------------------------------------------------------------*
form handle_double_click using fv_row.
perform frm_check_ftp.
perform frm_check_tabhd using fv_row. perform frm_get_tabit using fv_row.
endform. " handle_double_click
*&---------------------------------------------------------------------*
*& Form handle_hotspot_clk
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_ROW_ID text
* -->P_E_COLUMN_ID text
* -->P_ES_ROW_NO text
*----------------------------------------------------------------------*
form handle_hotspot_clk using e_row_id type lvc_s_row
e_column_id type lvc_s_col
es_row_no type lvc_s_roid.
if e_column_id = 'VBELN'.
* read table gt_200_alv assigning <fs_200_alv>
* index es_row_no-row_id.
* if sy-subrc eq 0.
* check <fs_200_alv>-vbeln+0(1) ne 'Y'.
* set parameter id 'AUN' field <fs_200_alv>-vbeln.
* call transaction 'VA03' and skip first screen.
* endif.
endif.
endform. "handle_hotspot_clk
*&---------------------------------------------------------------------*
*& Form handle_command_tabhd
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_UCOMM text
*----------------------------------------------------------------------*
form handle_command_tabhd using fv_ucomm.
perform frm_check_ftp. data:
ls_tab_tabhd type ztfi0035_tab_hd,
ls_tab_ftp type ztfi0037_etl_ftp,
ls_selected_row type lvc_s_row.
data:
lt_selected_row type lvc_t_row. if fv_ucomm = 'INSERT_ROW'.
read table gt_tab_ftp into ls_tab_ftp index .
if sy-subrc = .
ls_tab_tabhd-ftpnm = ls_tab_ftp-ftpnm.
append ls_tab_tabhd to gt_tab_hd.
endif.
elseif fv_ucomm = 'DELETE_ROW'.
go_alv_ftp->get_selected_rows(
importing
et_index_rows = lt_selected_row ). read table lt_selected_row into ls_selected_row index .
if sy-subrc = .
delete gt_tab_hd index ls_selected_row-index.
endif.
endif. loop at gt_tab_hd into ls_tab_tabhd
where tabtx = space.
select single ddtext
into ls_tab_tabhd-tabtx
from dd02t
where tabname = ls_tab_tabhd-tabnm.
modify gt_tab_hd from ls_tab_tabhd.
clear:ls_tab_tabhd.
endloop. endform. " handle_command_tabhd
*&---------------------------------------------------------------------*
*& Form handle_command_tabit
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_UCOMM text
*----------------------------------------------------------------------*
form handle_command_tabit using fv_ucomm.
field-symbols:
<fs_all_itm> like ztfi0036_tab_itm. if fv_ucomm = 'SAVE_ITM'.
loop at gt_tab_itm assigning <fs_tab_itm>.
append initial line to gt_all_itm assigning <fs_all_itm>.
move-corresponding <fs_tab_itm> to <fs_all_itm>.
unassign <fs_all_itm>.
endloop.
endif.
message s007(zfi_00).
endform. " handle_command_tabit
*&---------------------------------------------------------------------*
*& Form frm_check_ftp
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_check_ftp .
data:
lv_count type i.
data:
ls_tab_ftp type ztfi0037_etl_ftp. if gt_tab_ftp[] is initial.
message e001(zfi_00).
else.
describe table gt_tab_ftp lines lv_count.
if lv_count > .
message e002(zfi_00).
endif.
read table gt_tab_ftp into ls_tab_ftp index .
if sy-subrc = .
if ls_tab_ftp-ftpnm is initial
or ls_tab_ftp-ftpip is initial
or ls_tab_ftp-ftpur is initial
or ls_tab_ftp-ftppw is initial.
message e003(zfi_00).
endif.
endif.
endif.
endform. " frm_check_ftp
*&---------------------------------------------------------------------*
*& Form frm_check_tabhd
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_check_tabhd using fv_row.
data:
ls_tab_hd type ztfi0035_tab_hd. read table gt_tab_hd into ls_tab_hd index fv_row.
if sy-subrc = .
if ls_tab_hd-ftpnm is initial.
message i004(zfi_00).
endif.
if ls_tab_hd-tabnm is initial.
message i005(zfi_00).
else.
select single count(*)
from dd02l
where tabname = ls_tab_hd-tabnm.
if sy-subrc <> .
message i006(zfi_00) with ls_tab_hd-tabnm.
endif.
endif.
endif. loop at gt_tab_hd into ls_tab_hd
where tabtx = space.
select single ddtext
into ls_tab_hd-tabtx
from dd02t
where tabname = ls_tab_hd-tabnm.
modify gt_tab_hd from ls_tab_hd.
clear:ls_tab_hd.
endloop.
endform. " frm_check_tabhd
*&---------------------------------------------------------------------*
*& Form alv_changed_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form alv_changed_data .
go_alv_ftp->check_changed_data( ).
go_alv_tabhd->check_changed_data( ).
go_alv_tabit->check_changed_data( ).
endform. " alv_changed_data
*&---------------------------------------------------------------------*
*& Form frm_get_tabit
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_FV_ROW text
*----------------------------------------------------------------------*
form frm_get_tabit using fv_row.
data:
lt_tab_itm like table of ztfi0036_tab_itm,
lt_dd03l like table of dd03l.
data:
ls_dd03l like dd03l,
ls_tab_itm type ztfi0036_tab_itm,
ls_tab_hd type ztfi0035_tab_hd.
field-symbols:
<fs_dd03l> like dd03l. clear:gt_tab_itm.
refresh:gt_tab_itm. read table gt_tab_hd into ls_tab_hd index fv_row.
if sy-subrc = .
read table gt_all_itm into ls_tab_itm
with key ftpnm = ls_tab_hd-ftpnm
tabnm = ls_tab_hd-tabnm.
if sy-subrc <> .
select *
into table gt_tab_itm
from ztfi0036_tab_itm
where ftpnm = ls_tab_hd-ftpnm
and tabnm = ls_tab_hd-tabnm.
if sy-subrc <> .
select *
into table lt_dd03l
from dd03l
where tabname = ls_tab_hd-tabnm. sort lt_dd03l by tabname position. loop at lt_dd03l assigning <fs_dd03l>.
append initial line to gt_tab_itm assigning <fs_tab_itm>.
<fs_tab_itm>-ftpnm = ls_tab_hd-ftpnm.
<fs_tab_itm>-tabnm = <fs_dd03l>-tabname.
<fs_tab_itm>-fldno = <fs_dd03l>-position.
<fs_tab_itm>-fldnm = <fs_dd03l>-fieldname.
if <fs_dd03l>-rollname is not initial.
select single ddtext
into <fs_tab_itm>-fldtx
from dd04t
where rollname = <fs_dd03l>-rollname
and ddlanguage = sy-langu.
else.
select single ddtext
into <fs_tab_itm>-fldtx
from dd03t
where tabname = <fs_dd03l>-tabname
and ddlanguage = sy-langu
and fieldname = <fs_dd03l>-fieldname.
endif.
unassign <fs_tab_itm>.
endloop.
endif.
else.
loop at gt_all_itm into ls_tab_itm
where ftpnm = ls_tab_hd-ftpnm
and tabnm = ls_tab_hd-tabnm.
append initial line to gt_tab_itm assigning <fs_tab_itm>.
move-corresponding ls_tab_itm to <fs_tab_itm>.
unassign <fs_tab_itm>.
endloop.
endif.
endif. endform. " frm_get_tabit
*&---------------------------------------------------------------------*
*& Form handle_toolbar_itm
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_E_OBJECT text
* -->P_E_INTERACTIVE text
*----------------------------------------------------------------------*
form handle_toolbar_itm using fv_object type ref to cl_alv_event_toolbar_set
fv_interactive type char1.
data: ls_toolbar type stb_button. ls_toolbar-function = 'SAVE_ITM'.
ls_toolbar-icon = icon_system_save.
ls_toolbar-text = '临时存储'.
ls_toolbar-quickinfo = '保存明细'.
append ls_toolbar to fv_object->mt_toolbar.
clear: ls_toolbar. endform. " handle_toolbar_itm
*&---------------------------------------------------------------------*
*& Form frm_save_check
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_save_check using fv_flg.
data:
lv_erflg type c,
lv_count type i.
data:
ls_tab_ftp type ztfi0037_etl_ftp. if gt_tab_ftp[] is initial.
message i001(zfi_00).
lv_erflg = 'X'.
else.
describe table gt_tab_ftp lines lv_count.
if lv_count > .
message i002(zfi_00).
lv_erflg = 'X'.
endif.
read table gt_tab_ftp into ls_tab_ftp index .
if sy-subrc = .
if ls_tab_ftp-ftpnm is initial
or ls_tab_ftp-ftpip is initial
or ls_tab_ftp-ftpur is initial
or ls_tab_ftp-ftppw is initial.
message i003(zfi_00).
lv_erflg = 'X'.
endif.
endif.
endif.
fv_flg = lv_erflg.
endform. " frm_save_check
*&---------------------------------------------------------------------*
*& Form frm_save_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_save_data using fv_flg.
check fv_flg is initial. "存储FTP
modify ztfi0037_etl_ftp from table gt_tab_ftp. "存储TABHD
modify ztfi0035_tab_hd from table gt_tab_hd. "存储TABITM
modify ztfi0036_tab_itm from table gt_all_itm. commit work and wait.
if sy-subrc = .
message s008(zfi_00).
endif.
endform. " frm_save_data

4.配置表

最新文章

  1. 学习C语言感悟
  2. Android入门第八篇之GridView(九宫图)
  3. Android学习二:Http操作
  4. Hbase总结(一)-hbase命令,hbase安装,与Hive的区别,与传统数据库的区别,Hbase数据模型
  5. Java [Leetcode 39]Combination Sum
  6. Android开发_控制硬加速hardwareAccelerated
  7. C#。2. 2 语句
  8. hdu5573 二叉树找规律,二进制相关
  9. Spring之bean一基础
  10. JDBC详解系列(四)之建立Stament和执行SQL语句
  11. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column &#39;content&#39; a
  12. SpringMVC之数据传递一
  13. Encryption and decryption、Steganography、Decryption Tools
  14. 简单的可以跑起来的dubbo例子
  15. 大快DKhadoop安装教程与常见问题汇总
  16. net 编译报错:编辑器或项目正在尝试签出在内存中修改的文件,这将导致保存该文件
  17. IBatisNet 缓存使用
  18. Docker简介与安装配置
  19. 亚马逊MWS开发套路演示
  20. mongodb ---- findAndModify 写法

热门文章

  1. GOPATH
  2. 解决VS2010使用mscomm控件无法接收数据的问题【转】
  3. IDE Fix Pack 6.4.2 released (bugfix release)
  4. UITabView使用详解
  5. 机器学习算法中如何选取超参数:学习速率、正则项系数、minibatch size
  6. eclipse中,将springboot项目打成jar包
  7. 戴尔R710服务器安装系统——配置raid
  8. java实现表格tr拖动
  9. 第3章 Java数组(上): 一维数组和二维数组
  10. Redis 集群知识点及命令