*&———————————————————————*
*& Report Z_SELECCIONA_ARCHIVO *
*& *
*&———————————————————————*
*& *
*& *
*&———————————————————————*
report Z_SELECCIONA_ARCHIVO.
" selecccionar un archivo en el servidor o en el cliente
data:
L_C_S type C, " archivo en cliente o en servidor
L_ARCH(255) type C,
L_ERROR_C type STRING,
L_AUX type STRING. " variable utilitaria
" para buscar el nombre del servidor
data:
L_SERVER like MSXXLIST-NAME,
L_RFCSI_EXPORT like RFCSI.
selection-screen begin of block B1 with frame.
parameters:
R_CLT radiobutton group RAD1 default ‘X’,
R_SRV radiobutton group RAD1.
selection-screen end of block B1.
"at selection-screen on value-request for P_PATH.
start-of-selection.
if R_SRV = ‘X’.
" application server (vulgo SERVIDOR SAP)
L_C_S = ‘A’.
" busco el nombre del servidor, para que la funcion F4_DXFILENAME_TOPRECURSION
" no lo pregunte
call function ‘RFC_SYSTEM_INFO’
importing
RFCSI_EXPORT = L_RFCSI_EXPORT.
move L_RFCSI_EXPORT-RFCDEST to L_SERVER.
else.
" presentation server (vulgo CLIENTE)
L_C_S = ‘P’.
endif.
" server
call function ‘F4_DXFILENAME_TOPRECURSION’
exporting
I_LOCATION_FLAG = L_C_S
I_SERVER = L_SERVER
I_PATH = ‘C:\SAPPayroll’
"FILEMASK = ‘*.txt’
"FILEOPERATION = ‘R’
importing
"O_LOCATION_FLAG =
"O_SERVER =
O_PATH = L_ARCH
"ABEND_FLAG =
exceptions
"RFC_ERROR = 1
"ERROR_WITH_GUI = 2
others = 3
.
if SY-SUBRC <> 0.
L_ERROR_C = SY-SUBRC.
concatenate ‘Error seleccionando archivo’ L_ERROR_C into L_AUX separated by SPACE.
message L_AUX type ‘E’.
endif.
start-of-selection.
if L_ARCH = SPACE.
message ‘Archivo no seleccionado’ type ‘E’.
else.
concatenate ‘Archivo ‘ L_ARCH into L_AUX separated by SPACE.
message L_AUX type ‘I’.
endif.
* END