1.界面

 

 

 

2.程序 ZFID0004_FTP_EXEC

 主程序:

 *&---------------------------------------------------------------------*
*& Report ZFID0004_FTP_EXEC
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------* report zfid0004_ftp_exec. include zfid0004_ftp_exec_top. include zfid0004_ftp_exec_scr. include zfid0004_ftp_exec_pro. include zfid0004_ftp_exec_frm.

 INCLUDE程序:

 *&---------------------------------------------------------------------*
*& 包括 ZFID0004_FTP_EXEC_TOP
*&---------------------------------------------------------------------* *&---------------------------------------------------------------------*
*& 包括 ZFID0004_FTP_EXEC_TOP
*&---------------------------------------------------------------------* data:
begin of wa_file,
line() type c,
end of wa_file.
data:
gt_file like table of wa_file. data:
gv_line type char15. field-symbols:
<ft_tab> type standard table,
<fs_ftp> type ztfi0037_etl_ftp,
<fs_hd> type ztfi0035_tab_hd,
<fs_itm> type ztfi0036_tab_itm,
<fs_file> like wa_file,
<fs_tab> type any. data:
gt_fieldcat_lvc type lvc_t_fcat, "定义存储alv字段内表
gt_style type lvc_t_styl,
gs_fieldcat_lvc type lvc_s_fcat, "定义存储alv字段工作区
gs_layout_lvc type lvc_s_layo, "定义alv栏目样式
gs_stable_lvc type lvc_s_stbl, "ALV刷新
gs_style type lvc_s_styl,
gv_repid_lvc type sy-repid . "定义当前程序
data:
go_grid_lvc type ref to cl_gui_alv_grid. "类
data:
gs_header_lvc type slis_t_listheader. "表头信息
constants:
gv_sign_lvc type c value 'X',
gv_pf_status_lvc type slis_formname value 'FRM_ALV_STATUS', "alv自定义按钮form名称
gv_user_command_lvc type slis_formname value 'FRM_ALV_COMMAND', "alv自定义按钮响应事件form名称
gv_top_page_lvc type slis_formname value 'TOP_OF_PAGE'. "alv抬头
 *&---------------------------------------------------------------------*
*& 包括 ZFID0004_FTP_EXEC_SCR
*&---------------------------------------------------------------------* selection-screen begin of block b_block1 with frame title text-.
parameters:
p_ftpnm type ztfi0037_etl_ftp-ftpnm obligatory,
p_tabnm type ztfi0035_tab_hd-tabnm obligatory,
p_path type char64 lower case default ''.
selection-screen end of block b_block1. selection-screen begin of block b_block2 with frame title text-.
parameters:
c_alv as checkbox.
selection-screen end of block b_block2.
 *&---------------------------------------------------------------------*
*& 包括 ZFID0004_FTP_EXEC_PRO
*&---------------------------------------------------------------------* initialization. at selection-screen on value-request for p_tabnm.
perform frm_help_tabnm. at selection-screen.
perform frm_tabhd_check. start-of-selection.
"动态数据表结构
perform frm_dynamic_stru.
"查询界面
perform frm_query_screen.
"ALV显示
if c_alv is not initial.
perform frm_alv_display.
else.
perform frm_frp_send.
endif.
 *&---------------------------------------------------------------------*
*& 包括 ZFID0004_FTP_EXEC_FRM
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form frm_help_tabnm
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_help_tabnm .
data:
lv_ftpnm type ztfi0035_tab_hd-ftpnm.
data:
lt_tabhd like table of ztfi0035_tab_hd,
lt_dfies like table of dfies,
lt_ddshr like table of ddshretval,
lt_dselc like table of dselc,
lt_dynpf like table of dynpread.
field-symbols:
<fs_dynpf> like dynpread. append initial line to lt_dynpf assigning <fs_dynpf>.
<fs_dynpf>-fieldname = 'P_FTPNM'.
unassign <fs_dynpf>. call function 'DYNP_VALUES_READ'
exporting
dyname = sy-repid
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = lt_dynpf
exceptions
invalid_abapworkarea =
invalid_dynprofield =
invalid_dynproname =
invalid_dynpronummer =
invalid_request =
no_fielddescription =
invalid_parameter =
undefind_error =
double_conversion =
stepl_not_found =
others = .
if sy-subrc <> .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
read table lt_dynpf assigning <fs_dynpf> index .
if sy-subrc = .
lv_ftpnm = <fs_dynpf>-fieldvalue.
endif.
endif. if lv_ftpnm is initial.
select *
into table lt_tabhd
from ztfi0035_tab_hd.
else.
select *
into table lt_tabhd
from ztfi0035_tab_hd
where ftpnm = lv_ftpnm.
endif. call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'TABNM'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_TABNM'
value_org = 'S'
tables
value_tab = lt_tabhd
field_tab = lt_dfies
return_tab = lt_ddshr
dynpfld_mapping = lt_dselc
exceptions
parameter_error =
no_values_found =
others = .
if sy-subrc <> .
* Implement suitable error handling here
endif.
endform. " frm_help_tabnm
*&---------------------------------------------------------------------*
*& Form frm_query_screen
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_query_screen .
data:
lv_subrc type sy-subrc.
data:
lc_seprate type c value ','.
data:
lt_tabit type table of ztfi0036_tab_itm,
lt_tabs type table of rsdstabs,
lt_flds type table of rsdsfields,
lt_mesg type table of bapiret2,
lt_tab_where type table of rsdswhere,
lt_tab_express type table of rsdsexpr.
field-symbols:
<fs_flds> type rsdsfields,
<fs_tabs> type rsdstabs,
<fs_any> type any,
<fs_fld> type any. select *
into table lt_tabit
from ztfi0036_tab_itm
where ftpnm = p_ftpnm
and tabnm = p_tabnm. sort lt_tabit by ftpnm tabnm fldno. "表
append initial line to lt_tabs assigning <fs_tabs>.
<fs_tabs>-prim_tab = p_tabnm.
unassign <fs_tabs>. "字段
loop at lt_tabit assigning <fs_itm>
where fg_qry = 'X'.
append initial line to lt_flds assigning <fs_flds>.
<fs_flds>-tablename = <fs_itm>-tabnm.
<fs_flds>-fieldname = <fs_itm>-fldnm.
unassign <fs_flds>.
endloop. call function 'ZAP_01_DYNAMICSELECTION'
exporting
tabtitle = '选择查询字段'
i_wind = ''
i_tree = 'X'
importing
e_subrc = lv_subrc
tables
it_tabs = lt_tabs
it_flds = lt_flds
tab_where = lt_tab_where
tab_express = lt_tab_express
zmesg = lt_mesg. if lv_subrc = .
clear:wa_file,gt_file. select *
into corresponding fields of table <ft_tab>
from (p_tabnm)
where (lt_tab_where). describe table <ft_tab>[] lines gv_line. loop at <ft_tab> assigning <fs_any>.
clear:wa_file.
loop at lt_tabit assigning <fs_itm>
where fg_exp = 'X'.
assign component <fs_itm>-fldnm of structure <fs_any> to <fs_fld>.
if sy-subrc = .
if wa_file is initial.
wa_file-line = <fs_fld>.
else.
concatenate wa_file-line lc_seprate <fs_fld> into wa_file-line.
endif.
endif.
unassign <fs_fld>.
endloop.
append wa_file to gt_file.
endloop.
endif.
endform. " frm_query_screen
*&---------------------------------------------------------------------*
*& Form frm_dynamic_stru
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_dynamic_stru .
data:
lt_tabit like table of ztfi0036_tab_itm.
data:
struct_type type ref to cl_abap_structdescr,
struct_styl type ref to cl_abap_structdescr,
ztab_type type ref to cl_abap_tabledescr,
styl_type type ref to cl_abap_tabledescr,
elem_type type ref to cl_abap_elemdescr,
comp_type type cl_abap_structdescr=>component_table,
comp_styl type cl_abap_structdescr=>component_table,
comp_field type cl_abap_structdescr=>component,
comp_line like line of comp_type,
dref type ref to data,
dline type ref to data.
field-symbols:
<fs_comp> like line of comp_type. select *
into table lt_tabit
from ztfi0036_tab_itm
where ftpnm = p_ftpnm
and tabnm = p_tabnm
and fg_exp = 'X'. struct_type ?= cl_abap_typedescr=>describe_by_name( p_tabnm ).
comp_type = struct_type->get_components( ). loop at comp_type assigning <fs_comp>.
read table lt_tabit assigning <fs_itm>
with key fldnm = <fs_comp>-name.
if sy-subrc <> .
delete comp_type.
endif.
endloop. struct_type = cl_abap_structdescr=>create( comp_type ).
ztab_type = cl_abap_tabledescr=>create( struct_type ). create data dref type handle ztab_type.
assign dref->* to <ft_tab>.
endform. " frm_dynamic_stru
*&---------------------------------------------------------------------*
*& Form frm_alv_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_alv_display .
data:
lt_tabit type table of ztfi0036_tab_itm,
lt_fieldcat type slis_t_fieldcat_alv.
data:
ls_fieldcat type slis_fieldcat_alv. call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
i_program_name = sy-repid "调用当前方法的程序名
i_structure_name = p_tabnm "数据字典ddic定义的结构名称,一定要有
changing
ct_fieldcat = lt_fieldcat[] "系统自动生成的fieldcat文件
exceptions
inconsistent_interface =
program_error =
others = .
if sy-subrc <> .
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif. select *
into table lt_tabit
from ztfi0036_tab_itm
where ftpnm = p_ftpnm
and tabnm = p_tabnm
and fg_exp = 'X'. loop at lt_fieldcat into ls_fieldcat.
read table lt_tabit assigning <fs_itm>
with key fldnm = ls_fieldcat-fieldname.
if sy-subrc <> .
delete lt_fieldcat.
endif.
endloop. loop at lt_fieldcat into ls_fieldcat
where seltext_l = ''.
select single ddtext
into ls_fieldcat-seltext_l
from dd03t
where tabname = p_tabnm
and ddlanguage = sy-langu
and fieldname = ls_fieldcat-fieldname.
modify lt_fieldcat from ls_fieldcat.
clear:ls_fieldcat.
endloop. loop at lt_fieldcat into ls_fieldcat.
move-corresponding ls_fieldcat to gs_fieldcat_lvc.
gs_fieldcat_lvc-scrtext_m = ls_fieldcat-seltext_l.
append gs_fieldcat_lvc to gt_fieldcat_lvc.
clear:ls_fieldcat,gs_fieldcat_lvc.
endloop. perform frm_alv_layout. "设置布局
perform frm_alv_fields. "设置显示字段
perform frm_alv_header using gs_header_lvc. "添加表头 "ALV输出
call function 'REUSE_ALV_GRID_DISPLAY_LVC'
exporting
i_callback_program = sy-repid
i_callback_pf_status_set = gv_pf_status_lvc
i_callback_user_command = gv_user_command_lvc
i_callback_top_of_page = gv_top_page_lvc
is_layout_lvc = gs_layout_lvc
it_fieldcat_lvc = gt_fieldcat_lvc
i_save = 'A'
tables
t_outtab = <ft_tab>[]
exceptions
program_error =
others = .
if sy-subrc <> .
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " frm_alv_display *&---------------------------------------------------------------------*
*& Form FRM_ALV_LAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_alv_layout .
gs_layout_lvc-zebra = 'X'. "设置行颜色变化
gs_layout_lvc-cwidth_opt = 'X'. "列宽自适应
gs_layout_lvc-stylefname = 'FIELD_STYLE'. "设置样式输出控制结构的stylename字段内容为单元格状态控制字段名
endform. "frm_alv_layout
*&---------------------------------------------------------------------*
*& Form FRM_ALV_FIELDS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_alv_fields . endform. "frm_alv_fields
*&---------------------------------------------------------------------*
*& Form FRM_ALV_HEADER
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_I_HEADER text
*----------------------------------------------------------------------*
form frm_alv_header using fs_header type slis_t_listheader.
data:ls_line type slis_listheader. check fs_header[] is initial.
ls_line-typ = 'H'.
select single ddtext
into ls_line-info
from dd02t
where tabname = p_tabnm
and ddlanguage = sy-langu.
shift gv_line left deleting leading space.
concatenate ls_line-info '-' gv_line into ls_line-info.
append ls_line to fs_header.
endform. "frm_alv_header
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form top_of_page.
* 如果是alv grid 显示,调用此fm初始化表头;
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = gs_header_lvc. " 把header的值传入
endform. "top_of_page
*&---------------------------------------------------------------------*
*& Form frm_alv_status
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> rt_extab slis_t_extab
*----------------------------------------------------------------------*
form frm_alv_status using rt_extab type slis_t_extab.
data:lt_gui type slis_t_extab with header line.
set pf-status 'ST_1000' excluding lt_gui.
endform. "frm_alv_status *&---------------------------------------------------------------------*
*& Form frm_alv_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_alv_command using fv_ucomm like sy-ucomm
fs_selfield type slis_selfield. data:lt_return type table of bapiret2. "ALV数据修改
perform frm_alv_change. case fv_ucomm.
when 'FTP'.
perform frm_frp_send. when others.
endcase.
"ALV格式刷新
perform frm_alv_refresh.
endform. "frm_alv_command *&---------------------------------------------------------------------*
*& Form frm_alv_change
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_alv_change.
call function 'GET_GLOBALS_FROM_SLVC_FULLSCR'
importing
e_grid = go_grid_lvc. call method go_grid_lvc->check_changed_data. endform. "frm_alv_change *&---------------------------------------------------------------------*
*& Form frm_alv_refresh
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_alv_refresh.
gs_stable_lvc-row = 'X'.
gs_stable_lvc-col = 'X'. call method go_grid_lvc->refresh_table_display
exporting
is_stable = gs_stable_lvc
exceptions
finished =
others = .
endform. "frm_alv_refresh
*&---------------------------------------------------------------------*
*& Form frm_frp_send
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_frp_send .
data:
lt_return type table of bapiret2,
lt_data like table of wa_file.
data:
lv_ftpds type char30,
lv_handle type i,
lv_outlen type i.
field-symbols:
<fs_return> like bapiret2. "连接FTP服务器
perform frm_connect_ftp tables lt_return lt_data using lv_handle lv_outlen lv_ftpds.
"传输文件至FTP服务器
perform frm_export_to_ftp tables lt_return lt_data using lv_handle lv_outlen.
"断开FTP服务器连接
perform frm_disconnect_ftp tables lt_return using lv_handle lv_ftpds.
"错误日志
perform frm_log_display tables lt_return.
endform. " frm_frp_send
*&---------------------------------------------------------------------*
*& Form frm_connect_ftp
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_connect_ftp tables ft_return structure bapiret2
ft_data structure wa_file
using fv_handle fv_outlen fv_ftpds.
data:
lv_key type i value '',
lv_slen type i,
lv_handle type i,
lv_command type char100,
lv_codepage() type n,
lv_encoding().
data:
lt_data type table of text.
data:
ls_return type bapiret2,
ls_ftp like ztfi0037_etl_ftp. select single *
into ls_ftp
from ztfi0037_etl_ftp
where ftpnm = p_ftpnm. lv_slen = strlen( ls_ftp-ftppw ). call function 'HTTP_SCRAMBLE'
exporting
source = ls_ftp-ftppw
sourcelen = lv_slen
key = lv_key
importing
destination = ls_ftp-ftppw. call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Connect to FTP Server'. call function 'FTP_CONNECT'
exporting
user = ls_ftp-ftpur
password = ls_ftp-ftppw
host = ls_ftp-ftpip
rfc_destination = ls_ftp-ftpds
importing
handle = lv_handle.
if sy-subrc = .
perform frm_message_info using ls_return 'ZFI_00' 'S' '' ls_ftp-ftpip ls_ftp-ftpds space space.
perform frm_message_handle tables ft_return using ls_return.
else.
perform frm_message_info using ls_return sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif. fv_handle = lv_handle.
fv_ftpds = ls_ftp-ftpds. clear:lt_data. if p_path is not initial.
concatenate 'cd' p_path into lv_command separated by space. call function 'FTP_COMMAND'
exporting
handle = lv_handle
command = lv_command
tables
data = lt_data
exceptions
tcpip_error =
command_error =
data_error = .
if sy-subrc = .
perform frm_message_info using ls_return 'ZFI_00' 'S' '' lv_command space space space.
perform frm_message_handle tables ft_return using ls_return.
else.
perform frm_message_info using ls_return sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif.
endif. call function 'SCP_CODEPAGE_BY_EXTERNAL_NAME'
exporting
external_name = 'GB2312'
importing
sap_codepage = lv_codepage.
lv_encoding = lv_codepage. call function 'SCMS_TEXT_TO_BINARY'
* exporting
* encoding = lv_encoding
importing
output_length = fv_outlen
tables
text_tab = gt_file
binary_tab = ft_data
exceptions
failed =
others = .
if sy-subrc = .
perform frm_message_info using ls_return 'ZFI_00' 'S' '' space space space space.
perform frm_message_handle tables ft_return using ls_return.
else.
perform frm_message_info using ls_return sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif. clear:lt_data. call function 'FTP_COMMAND'
exporting
handle = lv_handle
command = 'binary'
tables
data = lt_data
exceptions
tcpip_error =
command_error =
data_error = .
if sy-subrc = .
perform frm_message_info using ls_return 'ZFI_00' 'S' '' 'binary' space space space.
perform frm_message_handle tables ft_return using ls_return.
else.
perform frm_message_info using ls_return sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif. endform. " frm_connect_ftp
*&---------------------------------------------------------------------*
*& Form frm_export_to_ftp
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_export_to_ftp tables ft_return structure bapiret2
ft_data structure wa_file
using fv_handle
fv_outlen.
data:
ls_return type bapiret2.
data:
lv_filename type char50. read table ft_return into ls_return with key type = 'E'.
if sy-subrc = .
exit.
endif. concatenate p_tabnm '_' sy-datum '_' sy-uzeit '.txt' into lv_filename. if gt_file[] is not initial.
call function 'FTP_R3_TO_SERVER'
exporting
handle = fv_handle
fname = lv_filename
blob_length = fv_outlen
tables
blob = ft_data
exceptions
tcpip_error =
command_error =
data_error =
others = .
if sy-subrc = .
call function 'BAPI_TRANSACTION_COMMIT'.
perform frm_message_info using ls_return 'ZFI_00' 'S' '' lv_filename gv_line space space.
perform frm_message_handle tables ft_return using ls_return.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
perform frm_message_info using ls_return sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif.
else.
perform frm_message_info using ls_return 'ZFI_00' 'E' '' p_tabnm space space space.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif. endform. " frm_export_to_ftp
*&---------------------------------------------------------------------*
*& Form frm_disconnect_ftp
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_disconnect_ftp tables ft_return structure bapiret2
using fv_handle fv_ftpds.
data:
ls_return type bapiret2. call function 'FTP_DISCONNECT'
exporting
handle = fv_handle.
if sy-subrc = .
call function 'BAPI_TRANSACTION_COMMIT'.
perform frm_message_info using ls_return 'ZFI_00' 'S' '' p_ftpnm space space space.
perform frm_message_handle tables ft_return using ls_return.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
perform frm_message_info using ls_return sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif. call function 'RFC_CONNECTION_CLOSE'
exporting
destination = fv_ftpds
exceptions
others = .
if sy-subrc = .
call function 'BAPI_TRANSACTION_COMMIT'.
perform frm_message_info using ls_return 'ZFI_00' 'S' '' fv_ftpds space space space.
perform frm_message_handle tables ft_return using ls_return.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
perform frm_message_info using ls_return sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
perform frm_message_handle tables ft_return using ls_return.
exit.
endif.
endform. " frm_disconnect_ftp
*&---------------------------------------------------------------------*
*& Form frm_tabhd_check
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form frm_tabhd_check .
if p_tabnm is not initial
and p_ftpnm is not initial.
select single count(*)
from ztfi0035_tab_hd
where ftpnm = p_ftpnm
and tabnm = p_tabnm
and fg_ftp = 'X'.
if sy-subrc <> .
message e009(zfi_00) with p_ftpnm p_tabnm.
endif.
endif.
endform. " frm_tabhd_check *&---------------------------------------------------------------------*
*& Form frm_message_handle
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->FT_RETURN text
* -->FS_RETURN text
*----------------------------------------------------------------------*
form frm_message_handle tables ft_return structure bapiret2
using fs_return type bapiret2.
message id fs_return-id
type fs_return-type
number fs_return-number
with fs_return-message_v1
fs_return-message_v2
fs_return-message_v3
fs_return-message_v4
into fs_return-message. move-corresponding fs_return to ft_return.
append ft_return.
clear:fs_return.
endform. "frm_message_handle
*&---------------------------------------------------------------------*
*& Form frm_message_info
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_LS_RETURN text
* -->P_1125 text
* -->P_1126 text
* -->P_1127 text
* -->P_LS_FTP_FTPIP text
* -->P_LS_FTP_FTPDS text
* -->P_SPACE text
* -->P_SPACE text
*----------------------------------------------------------------------*
form frm_message_info using fs_return type bapiret2
fv_msgid
fv_msgty
fv_msgno
fv_msgv1
fv_msgv2
fv_msgv3
fv_msgv4.
clear:fs_return.
fs_return-id = fv_msgid.
fs_return-type = fv_msgty.
fs_return-number = fv_msgno.
fs_return-message_v1 = fv_msgv1.
fs_return-message_v2 = fv_msgv2.
fs_return-message_v3 = fv_msgv3.
fs_return-message_v4 = fv_msgv4.
fs_return-parameter = space.
fs_return-log_no = space.
fs_return-system = space.
endform. " frm_message_info
*&---------------------------------------------------------------------*
*& Form frm_log_display
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LT_RETURN text
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&--错误日志多条MESSAGE显示
*&
*&---------------------------------------------------------------------* form frm_log_display tables ft_zmesg structure bapiret2. data:lt_smesg type tsmesg.
field-symbols:<fs_msg> type smesg,
<fs_bap> type bapiret2. loop at ft_zmesg assigning <fs_bap>.
append initial line to lt_smesg assigning <fs_msg>.
<fs_msg>-zeile = sy-tabix.
<fs_msg>-msgty = <fs_bap>-type.
<fs_msg>-text = <fs_bap>-message.
<fs_msg>-arbgb = <fs_bap>-id.
<fs_msg>-txtnr = <fs_bap>-number.
<fs_msg>-msgv1 = <fs_bap>-message_v1.
<fs_msg>-msgv2 = <fs_bap>-message_v2.
<fs_msg>-msgv3 = <fs_bap>-message_v3.
<fs_msg>-msgv4 = <fs_bap>-message_v4.
endloop. call function 'FB_MESSAGES_DISPLAY_POPUP'
exporting
it_smesg = lt_smesg
* id_smesg_zeile =
* it_return =
* id_send_if_one =
exceptions
no_messages =
popup_cancelled =
others = .
if sy-subrc <> .
endif.
endform. "frm_log_display

3.FTP传输问题

 调用FTP_COMMAND执行 'cd /' 打开路径,后续调用FTP_R3_TO_SERVER执行出现COMMAND_ERROR问题:E209(04)-FTP 子命令: 服务器报表错误

 将FTP_COMMAND执行 'cd /' 代码注释后执行成功,若是默认'/'路径下,则可以不用FTP_COMMAND执行。

ABAP-FTP-执行的更多相关文章

  1. ABAP程序执行效率和优化 ABAP Performance Examples

    一.             SQL Interface1.         Select ... Where vs. Select + Check用Select … Where语句效率比Select ...

  2. 批处理程序:自动上传FTP,再登陆linux服务器执行更新

    ----转载请注明出处:博客园-邦邦酱好 最近在学批处理程序,一直没找到能够结合工作来使用它的地方,前几天测试服务端的时候突然想到可以这样做: 写一个批处理程序,自动通过FTP上传软件包到指定的地方, ...

  3. centos启用ftp功能

    1.安装vsftpd组件,安装完后,有/etc/vsftpd/vsftpd.conf 文件,用来配置,还有新建了一个ftp用户和ftp的组,指向home目录为/var/ftp,默认是nologin(不 ...

  4. ABAP程序的效率(转)

    在网上看到的一篇文章: 程序的效率是每个程序员都应该重视的,无论您是采用哪一种语言进行开发. 程序有时候越短,并不一定越快,有时候程序很多代码,但不一定会很慢. 性能是一把双刃剑, 获得时间效率的同时 ...

  5. centos 6.5 搭建ftp服务器

    linux下一般使用vsftpd作为ftp服务器. vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序.特点是小巧轻快,安全易用. 下面是安装配置步骤: 1.安装vsftpd yum i ...

  6. 剑指架构师系列-ftp服务器

    1.安装FTP 我们在开发项目时,肯定需要专门的一台ftp服务器来存在上传的静态资源,今天我们就在CentOS下搭建一个ftp服务器. 1.安装vsftpd组件,安装完后,有/etc/vsftpd/v ...

  7. Centos 6.5使用vsftpd配置FTP服务器教程

    Centos 6.5使用vsftpd配置FTP服务器教程什么是vsftpd vsftpd是一款在Linux发行版中最受推崇的FTP服务器程序.特点是小巧轻快,安全易用.vsftpd 的名字代表”ver ...

  8. 使用Linux搭建FTP服务器实现文件共享

    使用Linux搭建FTP服务器实现文件共享... ---------------- Linux中的文件共享:FTPVSFTPDVSFTPD虚拟用户 FTP可以用在Linux与Linux 和Window ...

  9. ftp&nginx搭建图片服务器

    下面使用ftp+nginx搭建一个简单的服务器 ftp用于文件的传输 nginx提供http服务 nginx服务器的安装和配置可以参照之前的教程:nginx安装及其配置详细教程 下面介绍ftp服务的安 ...

  10. 使用Java+SAP云平台+SAP Cloud Connector调用ABAP On-Premise系统里的函数

    最近Jerry接到一个原型开发的任务,需要在微信里调用ABAP On Premise系统(SAP CRM On-Premise)里的某些函数.具体场景和我之前的公众号文章 Cloud for Cust ...

随机推荐

  1. 无法对含有多个.java(或.class)文档的程序进行编译(或解释)

    通常初学者会出现这样的问题:无法对含有多个.java(或.class)文档的程序进行编译(或解释). root@yogile-VirtualBox:/alive/string# javac work/ ...

  2. oracle 11g安装过程

    1,工具:Oracle_win64_11gR2_database(64位oracle 11g数据库).iso安装文件,win10系统 2,右键,解压后,点击setup.exe,系统会检测本机的环境,如 ...

  3. FreeMarker基础语法,宏,引用 等

    FreeMarker的插值有如下两种类型: 1,通用插值${expr}; 2,数字格式化插值:#{expr}或#{expr;format} ${book.name?if_exists } //用于判断 ...

  4. UVA-315 无向图求割点个数

    题意抽象: 给定一个无向图,输出割点个数. 割点定义:删除该点后,原图变为多个连通块. 考虑一下怎么利用tarjan判定割点: 对于点u和他相连的当时还未搜到的点v,dfs后如果DFN[u]<= ...

  5. jmeter4.0安装记录

    前提:jmeter需配置环境变量jdk,jmeter4.0版本需1.7以上版本, 查看jdk版本命令java -version 1.官网http://jmeter.apache.org/downloa ...

  6. 基于 Jenkins 构建持续集成任务

    1.1 Jenkins 配置使用心得 我是在windows10上安装的,安装过程很简单,从官网上下载下来msi安装包,双击执行就好了.安装程序完成后会自动打开http://localhost:8080 ...

  7. 看淘宝营销api 文档有感

    total: use appkey & secrect variance naming rule 提供沙箱环境 使用api gateway 使用rest(但返回结果包裹了 isp.thread ...

  8. hsdfz -- 6.16 -- day1

    恩这回不写游记了 按照老师要求记录今天的心里路程:这题似乎可做期望得分150->日部分分似乎不是很显然->a题似乎是结论题,大力猜一波结论->过不了样例,先看b题->b题动态树 ...

  9. C# EasyHook MessageBox 示例(极简而全)

    完整代码,原创无藏私,绝对实用.Windows10 X64 下调试通过,对 w3wp.exe, sqlserver.exe,notepad.exe,iexporer.exe 注入后,长时间运行稳定,未 ...

  10. PythonStudy——字典的操作 Dictionary operation

    dic = {'a': 1, 'b': 2} print(dic) # 增: 字典名[key] = 值 => key已存在就是修改值,不存在就是新增值 dic['c'] = 3 print(di ...