FUNCTION zfuftp_download_2.
*"----------------------------------------------------------------------
*"*"Interfase local
*" IMPORTING
*" REFERENCE(PI_IDFTP) TYPE ZIDFTP
*" REFERENCE(PI_FILENAME) TYPE UFPATHDAT
*" TABLES
*" P_ITABLE
*" EXCEPTIONS
*" TCPIP_ERROR
*" COMMAND_ERROR
*" DATA_ERROR
*"----------------------------------------------------------------------
DATA: BEGIN OF w_zmegaftp,
zidftp TYPE zmegaftp-zidftp,
zdirip TYPE zmegaftp-zdirip,
zpath TYPE zmegaftp-zpath,
zuserftp TYPE zmegaftp-zuserftp,
zpassw TYPE zmegaftp-zpassw,
END OF w_zmegaftp.
DATA: v_path TYPE zpath.
IF pi_filename CA '*/$&()@!?¿'.
MESSAGE e001(zab) WITH 'El archivo un carácter invalido'.
ENDIF.
SELECT SINGLE zidftp
zdirip
zpath
zuserftp
zpassw
INTO w_zmegaftp
FROM zmegaftp
WHERE zidftp = pi_idftp.
IF sy-subrc = 0.
IF NOT w_zmegaftp-zdirip IS INITIAL AND
NOT w_zmegaftp-zuserftp IS INITIAL AND
NOT w_zmegaftp-zpassw IS INITIAL.
CONCATENATE w_zmegaftp-zpath
pi_filename
INTO v_path.
PERFORM f_ftp_r3_to_server2 TABLES p_itable
USING v_path
w_zmegaftp-zdirip
w_zmegaftp-zuserftp
w_zmegaftp-zpassw
CHANGING v_subrc1
v_subrc2.
IF v_subrc1 NE 0.
CASE v_subrc1.
WHEN 1.
RAISE tcpip_error.
WHEN 2.
RAISE command_error.
WHEN 3.
RAISE data_error.
WHEN OTHERS.
ENDCASE.
ENDIF.
IF v_subrc2 NE 0.
CASE v_subrc2.
WHEN 1.
RAISE tcpip_error.
WHEN 2.
RAISE command_error.
WHEN 3.
RAISE data_error.
WHEN OTHERS.
RAISE others.
ENDCASE.
ENDIF.
ELSE.
MESSAGE a000(zab) WITH pi_idftp.
ENDIF.
ELSE.
MESSAGE a000(zab).
ENDIF.
ENDFUNCTION.
No hay comentarios:
Publicar un comentario