Cuando creamos una fuente de datos en un sistema fuente de tipo 'fichero', podemos especificar un fichero en la extracción, pero también podríamos usar una rutina ABAP para seleccionar el fichero mediante un diálogo. Para hacer tal cosa, pulsaremos el correspondiente botón a la derecha del cuadro de texto 'Fichero' en la pestaña 'Extracción'. Especificaremos un nombre técnico para la rutina y se abrirá un editor con código generado automáticamente por el sistema según el correspondiente modelo. Añadiremos las líneas necesarias. Bien, la rutina quedaría tal que así: program filename_routine. * Global code *$*$ begin of global - insert your declaration only below this line *-* * Enter here global variables and type declarations * as well as additional form routines, which you may call from the * main routine COMPUTE_FLAT_FILE_FILENAME below *TABLES: ... * DATA: ... *$*$ end of global - insert your declaration only before this line *-* * ------------------------------------------------------------------- form compute_flat_file_filename using p_infopackage type rslogdpid p_datasource type rsoltpsourcer p_logsys type rsslogsys changing p_filename type RSFILENM p_subrc like sy-subrc. *$*$ begin of routine - insert your code only below this line *-* * This routine will be called by the adapter, * when the infopackage is executed. DATA p_file TYPE rlgrap-filename. CALL FUNCTION 'F4_FILENAME' IMPORTING file_name = p_file. IF p_file IS NOT INITIAL. p_filename = p_file. p_subrc = 0. ELSE. CLEAR p_filename. p_subrc = 1. ENDIF. *$*$ end of routine - insert your code only before this line *-* endform. El único código que hay que añadir es el resaltado en negrita. Verificar y guardar el código. Activar la fuente de datos.