ABAP-FTP-配置
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.配置表
ABAP-FTP-配置的更多相关文章
- centos7: vsftpd安装及启动: ftp配置(以虚拟用户为例)
centos7: vsftpd安装及启动: ftp配置 1安装: yum -y install vsftpd /bin/systemctl start vsftpd.service #启动 /bin/ ...
- FTP文件上传以及获取ftp配置帮助类
帮助类: using QSProjectBase; using Reform.CommonLib; using System; using System.Collections.Generic; us ...
- [Windows Server 2008] IIS自带FTP配置方法
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:IIS自带FT ...
- [Windows Server 2012] IIS自带FTP配置方法
★ 欢迎来到[护卫神·V课堂],网站地址:http://v.huweishen.com★ 护卫神·V课堂 是护卫神旗下专业提供服务器教学视频的网站,每周更新视频.★ 本节我们将带领大家:IIS自带FT ...
- linux ftp配置及实操
一.基础知识: 1.ftp:file transfer protocal 及文件传输协,工作与应用层. 2.ftp协议的实现: 服务器端实现软件:vsftpd,pureftpd,filezilla s ...
- Centos 7.5 搭建FTP配置虚拟用户
Centos 7.5 搭建FTP配置虚拟用户 1.安装vsftpd #vsftpd下载地址 http://mirror.centos.org/centos/7/os/x86_64/Packages/v ...
- asp.net core 简单部署之FTP配置(CentOS 7.0安装配置Vsftp服务器)
配置过程原文地址:http://www.osyunwei.com/archives/9006.html 坑和结果 正确的跟着这个内容走,是靠谱的. 我自己给自己踩了个坑,请参照文章的朋友注意第七条:七 ...
- win7系统下的FTP配置
2016-07-12 工作中需要在win7操作系统下配置FTP,遇到许多问题,所以记录下来方便以后解决问题. FTP是文件传输协议的简称.用于Internet上的控制文件的双向传输.同时,它也是一个应 ...
- 阿里云服务器 FTP配置图文教程和添加两个FTP站点
1.添加FTP账号和密码. A. 选择“服务管理器”->“配置”->“本地用户和组”->“用户”:在空白处右键选择“新用户”: B. 输入用户名,全名和描述可以不填写:输入两遍密码: ...
- CentOS6.5 FTP配置
一:安装vsftpd 查看是否已经安装vsftpd rpm -qa | grep vsftpd 如果没有,就安装,并设置开机启动 yum -y install vsftpd chkconfig vsf ...
随机推荐
- MySQL5.7 GTID学习笔记
GTID(global transaction identifier)是对于一个已提交事务的全局唯一编号,前一部分是server_uuid,后面一部分是执行事务的唯一标志,通常是自增的. 下表整理了G ...
- python基础之centos6.5 升级 python2.7, 安装pip, MySQLdb
这个仅仅是为了运行脚本需求, 将centos6.5中的 python 2.6.6升级到了 2.7 并且安装和了 pip 和 MySQLdb 1.先装依赖 yum install zlib-devel ...
- ceph压力测试结果总结
万兆网速的ceph分布式存储单虚拟机下的带宽和iops测试结果: 带宽: 写:700-850MB 读:800-900MB iops: 写:15000-20000 读:45000-55000
- poi读取word的内容
pache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程序对Microsoft Office格式档案读和写的功能. 1.读取word 2003及word 2007需要的 ...
- 基于Verilog的简单FIFO读写实验
一.模块框图及基本思路 fifo_ip:ISE生成的IP fifo_control:在fifo未满情况下不断写入递增的四位数,每隔1s读出一个数据驱动Led显示 fifo_top:前两个模块的组合 二 ...
- 剑指Offer 43. 左旋转字符串 (字符串)
题目描述 汇编语言中有一种移位指令叫做循环左移(ROL),现在有个简单的任务,就是用字符串模拟这个指令的运算结果.对于一个给定的字符序列S,请你把其循环左移K位后的序列输出.例如,字符序列S=&quo ...
- phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接 解决办法
phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接.您应该检查配置文件中的主机.用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致. 原因有可能是因为修改了m ...
- 框架tensorflow2
TensorFlow 2 TensorFlow 激励函数 TensorFlow 添加层: 思考:matmul和multiply两种乘法的区别:http://www.soaringroad.com/?p ...
- 14.python-CS编程
一.客户端/服务器架构1.C/S架构:(1)硬件C/S架构(打印机)(2)软件C/S架构(web服务)2.生活中的C/S架构:饭店是S端,所有食客是C端3.C/S架构与socket的关系:socke就 ...
- cordova日期插件的使用:cordova-plugin-datepicker
1. 添加插件:cordova plugin add cordova-plugin-datepicker; 2.插件的主体样式设置: 3.以上5中样式的截图: THEME_TRADITIONAL的样式 ...