Data Set

Colapsar
X
 
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes
  • yapbig
    Senior Member
    • may
    • 261

    #1

    Data Set

    Tengo que leer y procesar un archivo plano con longitud variable con tabulación para la separación de campos, pero el proceso me cancela cuando intenta hacer el READ de c/u de las líneas para insertarlas en una tabla interna.
    El error que me está dando dice algo del juego de caracteres, como que no pude interpretar determinado caracter y convertirlo. ¿Aguna idea?

    OPEN DATASET pFile FOR INPUT IN LEGACY TEXT MODE CODE PAGE '4110' . " '4103'.

    IF SY-SUBRC <> 0.
    MESSAGE E000(ZFI_RET) with pfile.
    ENDIF.

    DO.
    READ DATASET pfile INTO recline.
    append recLine to REC_AUX.
    IF sy-subrc <> 0.
    EXIT.
    ENDIF.
    ENDDO.


    Texto breve
    A character set conversion is not possible.



    ¿Qué ha sucedido?
    At the conversion of a text from codepage '4110' to codepage '4103':

    - a character was found that cannot be displayed in one of the two
    codepages;
    - or it was detected that this conversion is not supported

    The running ABAP program 'ZFI_RET_UPDEXENCION' had to be terminated as the
    conversion
    would have produced incorrect data.

    The number of characters that could not be displayed (and therefore not
    be converted), is 1. If this number is 0, the second error case, as
    mentioned above, has occurred.



    ¿Qué puede hacer?
    Please make a note of the actions and input which caused the error.
    -

    To resolve the problem, contact your
    SAP system administrator.

    With transaction ST22 for the ABAP dump analysis, you can analyze and
    administrate termination messages, or store them for a longer time
    period.

    If you were requested by the application to enter a codepage, the
    termination may be avoided after the restart of the application if you
    enter a different codepage.

    If characters could not be converted: Please use transaction SCP to
    analyse the codepages used by you. Search for characters you wanted to
    convert, which are not entered in the table. (If you changed a codepage,
    you can use transaction SP12 to invalidate the character set buffer
    (CCC).

    You find further help tools to codepages in transaction SNLS.





    Anál.errores
    An exception occurred that is explained in detail below.
    The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
    caught in
    procedure "CARGAR_ARCHIVO" "(FORM)", nor was it propagated by a RAISING clause.
    Since the caller of the procedure could not have anticipated that the
    exception would occur, the current program is terminated.
    The reason for the exception is:
    Characters are always displayed in only a certain codepage. Many
    codepages only define a limited set of characters. If a text from a
    codepage should be converted into another codepage, and if this text
    contains characters that are not defined in one of the two codepages, a
    conversion error occurs.

    Moreover, a conversion error can occur if one of the needed codepages
    '4110' or '4103' is not known to the system.

    If the conversion error occurred at read or write of screen, the file
    name was '/home/exenciones/exenciones.txt'. (further information about the

    file: "X 248 152976rwxrwx---200912030929092009120221320820091202213555")



    Notas para corregir errores

    If the error occures in a non-modified SAP program, you may be able to
    find an interim solution in an SAP Note.
    If you have access to SAP Notes, carry out a search with the following
    keywords:

    "CONVT_CODEPAGE" "CX_SY_CONVERSION_CODEPAGE"
    "ZFI_RET_UPDEXENCION" or "ZFI_RET_UPDEXENCION"
    "CARGAR_ARCHIVO"


    If you cannot solve the problem yourself and want to send an error
    notification to SAP, include the following information:

    1. The description of the current problem (short dump)

    To save the description, choose "System->List->Save->Local File
    (Unconverted)".

    2. Corresponding system log

    Display the system log by calling transaction SM21.
    Restrict the time interval to 10 minutes before and five minutes
    after the short dump. Then choose "System->List->Save->Local File
    (Unconverted)".

    3. If the problem occurs in a problem of your own or a modified SAP
    program: The source code of the program
    In the editor, choose "Utilities->More
    Utilities->Upload/Download->Download".

    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.

    The exception must either be prevented, caught within proedure
    "CARGAR_ARCHIVO" "(FORM)", or its possible occurrence must be declared in the
    RAISING clause of the procedure.
    To prevent the exception, note the following:



    Propiedades fichero /home/exenciones/exenciones.txt
    Autorizaciones rwxrwx---
    Modificado el 02.12.2009 21:32:08
    Último acceso 03.12.2009 09:29:09
    Última modif.status 02.12.2009 21:35:55
    Tam. 152976 Byte
    Posición actual 248
    Gustavo A. Biglia
    Consultor SAP FI
  • ballan
    Senior Member
    • oct
    • 671

    #2
    Has probado a poner enconding default?

    Comentario

    • mysmb2
      Senior Member
      • ene
      • 406

      #3
      al especificar el CODE PAGE '4110' estas determinando como leer el archivo a nivel de bytes, tal vez el archivo no respete este ordenamiento, proba quitando el adicional LEGACY y dejalo así
      Código:
      OPEN DATASET l_path FOR OUTPUT IN TEXT MODE.
      Sebastián Chiavia
      http://www.programacionabap.com.ar

      Comentario

      • yapbig
        Senior Member
        • may
        • 261

        #4
        Seba:
        Así estaba abierto el archivo originalmente y también cancelaba.
        Ahora estoy probando con diferentes alternativas

        * OPEN DATASET pFile FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        * OPEN DATASET pFile FOR INPUT IN TEXT MODE ENCODING UTF-8.
        * OPEN DATASET pFile FOR INPUT IN LEGACY TEXT MODE CODE PAGE '4110'.

        OPEN DATASET pFile FOR INPUT IN LEGACY TEXT MODE CODE PAGE '4110' . " '4103'.
        Gustavo A. Biglia
        Consultor SAP FI

        Comentario

        • yapbig
          Senior Member
          • may
          • 261

          #5
          Les adjunto el archivo para que puedan analizarlo. Como ya comenté el error lo arroja al intentar leer el segundo registro

          rg830.zip

          Saludos, desde ya muchísimas gracias...
          Gustavo A. Biglia
          Consultor SAP FI

          Comentario

          • DavidXD_XD
            Moderator
            • ago
            • 1255

            #6
            Holas, una vez me sucedio algo parecido, tal vez puede q sea el atributo del programa, tiene activado el check de "Verif.unicode activa"?
            David Carballido Córdova

            Comentario

            • yapbig
              Senior Member
              • may
              • 261

              #7
              Sí, tiene ese check box activado. Sin el mismo no se activa el programa.
              Gustavo A. Biglia
              Consultor SAP FI

              Comentario

              • yapbig
                Senior Member
                • may
                • 261

                #8
                Alguien tendrá alguna otra sugerencia sobre este tema.

                Gracias....
                Gustavo A. Biglia
                Consultor SAP FI

                Comentario

                • yapbig
                  Senior Member
                  • may
                  • 261

                  #9
                  Siguiendo con este tema le saqué al archivo plano el primer registro de cabecera de título de campos y reemplazé en todos lados el caracter "é" por "e" y ahora se leen correctamente todos los registros del archivo sin ningún problema. Aún no sé si es por la cabecera que le saqué al archivo o por el caracter "é" que reemplacé, pero supongo que será por la segunda alternativa.
                  Ahora bien tengo todo esto en un línea cuyo separador de campor es el tab que en tiempo de ejecucución y debagueando el proceso me muestra como "#" el carácter numeral, pero no logro parsear este string con ninguna de las sentencias ABAP para lograr separar los valores en c/u de los campos correspondientes

                  La cadena de caracteres correspondientes es esta

                  2009-1-027-00019-2#20036915138#2009 #100#Regimen General#Definitivo con Provisorio#2776717 #09/10/2009#09/10/2009#31/05/2010

                  y las sentencias ABAP con las que estoy probando son: REPLACE, SPLIT, FIND. Algunas diréctamente es como que no reconocen el carácter "#" y directamente no lo encuentras y otras que lo encuentra como el FIND, pero en el offset me devuelven simpre cero.

                  replace '#' with space into rec_aux-linea.

                  find FIRST OCCURRENCE OF ' ' in rec_aux-linea match offset vl_offset.
                  find FIRST OCCURRENCE OF ' ' in rec_aux-linea results vl_result.

                  SPLIT rec_aux-linea AT ' ' INTO: table rec.

                  La idea y lo que necesito es separar esta cadena de valores en 10 campos con sus valores correspondientes. En este caso en particular debería quedarme:
                  campo1 = 2009-1-027-00019-2
                  campo2 = 20036915138
                  campo3 = 2009
                  campo4 = 100
                  campo5 = Regimen General
                  campo6 = Definitivo con Provisorio
                  campo7 = 2776717
                  campo8 = 09/10/2009
                  campo9 = 09/10/2009
                  campo10 = 31/05/2010


                  Saludos y desde ya muchísimas gracias....
                  Gustavo A. Biglia
                  Consultor SAP FI

                  Comentario

                  • yapbig
                    Senior Member
                    • may
                    • 261

                    #10
                    Pude comprobar definitivamente que el caracter que no reconoce el sistema es el "é"
                    ¿Alguien sabe que es lo que puedo hacer para que deje de cancelar este proceso y no tener que pedirle al usuario o al responsable de BAISIS que antes de subir el archivo al servidor Linux x86_64 reemplace el caracter "é" por "e"?

                    Desde ya muchas gracias...
                    Gustavo A. Biglia
                    Consultor SAP FI

                    Comentario

                    • yapbig
                      Senior Member
                      • may
                      • 261

                      #11
                      Sigo sin poder resolver este problema ahora encontré esta función que supuestamente me sapara en los n campos un string con formato CSV con algún caracter separador de campos. Utilizo la mismo y me divide únicamente en 8 campos en lugar de 10 campos y los valores están todos incorrectos

                      vl_linea = rec_aux-linea.

                      CALL FUNCTION 'RSDS_CONVERT_CSV'
                      EXPORTING
                      I_DATA_SEP = ' '
                      I_ESC_CHAR = ''
                      I_RECORD = vl_linea
                      I_FIELD_COUNT = 10
                      IMPORTING
                      E_T_DATA = vl_data
                      * EXCEPTIONS
                      * ESCAPE_NO_CLOSE = 1
                      * ESCAPE_IMPROPER = 2
                      * CONVERSION_ERROR = 3
                      * OTHERS = 4
                      .

                      Este es el string que se le pasa como parámetro a la función
                      2009-1-027-00019-2#20036915138#2009 #100#Regimen General#Definitivo con Provisorio#2776717 #09/10/2009#09/10/2009#31/05/2010#

                      y este es el resultado que devuelve la misma
                      1 2009-1-027-00019-2#20036915138#2009
                      2 #100#Regimen
                      3 General#Definitivo
                      4 con
                      5 Provisorio#2776717
                      6
                      7
                      8 #09/10/2009#09/10/2009#31/05/2010#

                      Como dije antes ninguna de las sentencias ABAP me responde como debería ni FIND, ni REPLACE, ni SPLIT

                      Saludos, desde ya muchas gracias...
                      Gustavo A. Biglia
                      Consultor SAP FI

                      Comentario

                      • ballan
                        Senior Member
                        • oct
                        • 671

                        #12
                        Tu problema esta en que aunque veas una # no significa que el caracter sea ese, la # la utiliza para indicar que ese caracter no lo puede interpretar, por ejemplo cuando hay un retorno de carro tambien te muestra la #

                        Yo lo que hice para solucionar estas cosas es un poco rudimentario pero efectivo, seria un algoritmo mas o menos asi

                        *Aqui pondrias todos los caracteres que consideras validos, letras, numeros, *signos de puntuacion, etc
                        data: lc_valores_validos type char100 value 'abcd..ABC..012..+-.,'

                        data: lv_in type char20,
                        lv_out type char20,
                        lv_len type i,
                        lv_index type syindex.

                        lv_len = strlen( lv_in ).

                        do lv_len times

                        lv_index = sy-index.
                        subtract 1 from lv_index.

                        if lv_in+lv_index(1) co lc_valores_validos.
                        concatenate lv_out lv_in+lv_index(1) into lv_out.
                        endif.

                        enddo.

                        El caso es ir recorriendo la cadena caracter a caracter e ir copiandolos en otra variable, si encuentras alguna valor no valido te lo saltas

                        Comentario

                        • yapbig
                          Senior Member
                          • may
                          • 261

                          #13
                          Ballan:
                          Muchísimas gracias por tu aporte, gracias al mismo ya pude resolver mi problema y quedó todo funcionando correctamente.

                          Gracias...
                          Gustavo A. Biglia
                          Consultor SAP FI

                          Comentario

                          • ballan
                            Senior Member
                            • oct
                            • 671

                            #14
                            De nada, de hecho te recomiendo que esta rutina la metas dentro de una funcion, metodo o algo porque si haces programas de cargas la vas a utilizar muchisimo

                            Por lo menos en mi caso gracias a los "maravillosos" ficheros de carga que me ha proporcionado el cliente ha sido imprescindible...

                            Comentario

                            • mysmb2
                              Senior Member
                              • ene
                              • 406

                              #15
                              Gustavo para que las sentencias abap REPLACE, SPLIT, FIND te reconoscan el '#' que tenes en tu archivo revisa este post.



                              Saludos!
                              Sebastián Chiavia
                              http://www.programacionabap.com.ar

                              Comentario

                              Trabajando...