MUNDOSAP

MUNDOSAP (foro/index.php)
-   Programación ABAP IV (foro/forumdisplay.php?f=4)
-   -   Problema al importar un fichero (foro/showthread.php?t=9655)

mekachu 11/12/07 17:20:39

Problema al importar un fichero
 
Hola :

Estoy intentando leer los datos de un fichero tipo TXT ( separado por tabuladores ) con el código siguiente. El problema es que en el último campo informado del fichero, me añade un # y eso hace que salten dumps.

Sospecho que el # es el fin de línea, pero no tengo ni idea de cómo controlarlo.
¿Alguien me puede echar un cable?.

Gracias.

OPEN DATASET d_fichero FOR INPUT IN TEXT MODE.

IF sy-subrc NE 0.
* Si no se puede abrir el fichero
MESSAGE i000(fb) WITH text-001
d_fichero.
* Marcado del flag de error
d_error = c_marca.
ENDIF.

IF d_error IS INITIAL.

* Se lee la línea de fichero y se guarda en la variable
CLEAR l_data.
READ DATASET d_fichero INTO l_data.

WHILE sy-subrc EQ 0.

* se pasa la línea a la tabla interna con la estructura de fichero
CLEAR i_fichero.

DO.
ASSIGN COMPONENT sy-index OF STRUCTURE i_fichero TO <fs>.
IF sy-subrc NE 0.
EXIT.
ENDIF.

IF l_data CA c_tabulador.
SPLIT l_data AT c_tabulador INTO <fs> l_data.

ELSE.
MOVE l_data TO <fs>.
EXIT.
ENDIF.
ENDDO.
* Se añade el registro a la tabla
APPEND i_fichero.
CLEAR i_fichero.


Husos Horarios son GMT. La hora en este momento es 14:00:04.

www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web